Bug 482524

Summary: dolphin svn plugin: ODR violations when building with LTO
Product: [Applications] dolphin Reporter: Erik Quaeghebeur <bugs.kde.org>
Component: plugins: svnAssignee: Sebastian Dörner <sebastian>
Status: RESOLVED FIXED    
Severity: normal CC: ab4bd, kfm-devel
Priority: NOR    
Version: 23.08.5   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Erik Quaeghebeur 2024-03-06 08:46:45 UTC
SUMMARY
When compiling the dolphin svn plugin with LTO enabled (compiler flag: -flto=auto) and treating some LTO-problematic warnings as errors (compiler flags: -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing), the build fails as follows:

```
/var/tmp/portage/kde-apps/dolphin-plugins-subversion-23.08.5/work/dolphin-plugins-23.08.5/svn/svncommitdialog.cpp:70:6: error: type ‘columns_t’ violates the C++ One Definition Rule [-Werror=odr]
   70 | enum columns_t {
      |      ^
/var/tmp/portage/kde-apps/dolphin-plugins-subversion-23.08.5/work/dolphin-plugins-23.08.5/svn/svnlogdialog.cpp:67:6: note: an enum with different value name is defined in another translation unit
   67 | enum columns_t {
      |      ^
/var/tmp/portage/kde-apps/dolphin-plugins-subversion-23.08.5/work/dolphin-plugins-23.08.5/svn/svncommitdialog.cpp:71:5: note: name ‘columnPath’ differs from name ‘columnRevision’ defined in another translation unit
   71 |     columnPath,
      |     ^
/var/tmp/portage/kde-apps/dolphin-plugins-subversion-23.08.5/work/dolphin-plugins-23.08.5/svn/svnlogdialog.cpp:68:5: note: mismatching definition
   68 |     columnRevision,
      |     ^
lto1: some warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/x86_64-pc-linux-gnu-g++ returned 1 exit status
compilation terminated.
```

SOFTWARE/OS VERSIONS
Linux: 6.6.13-gentoo-a #1 SMP
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.12
GCC: 13.2.1_p20240113

ADDITIONAL INFORMATION
Downstream bug: https://bugs.gentoo.org/926233
Comment 1 Bug Janitor Service 2024-03-29 13:14:40 UTC
A possibly relevant merge request was started @ https://invent.kde.org/sdk/dolphin-plugins/-/merge_requests/56
Comment 2 Nikolai Krasheninnikov 2024-04-02 09:07:57 UTC
Git commit 772a4d712abcf1c6c86f25bd306785815132d886 by Nikolai Krasheninnikov.
Committed on 02/04/2024 at 09:07.
Pushed by nikolaik into branch 'master'.

svn: Fix gcc-13 One Definition Rule compilation error with LTO enabled

columns_t enum defined multiple times in different translation units. Although this
should not be an error, we move the definition to a separate unnamed namespace.

M  +5    -5    svn/svncommitdialog.cpp
M  +7    -7    svn/svnlogdialog.cpp

https://invent.kde.org/sdk/dolphin-plugins/-/commit/772a4d712abcf1c6c86f25bd306785815132d886