Bug 419702 - recent kio-extras fails to compile against Qt 5.14
Summary: recent kio-extras fails to compile against Qt 5.14
Status: RESOLVED FIXED
Alias: None
Product: kio-extras
Classification: Frameworks and Libraries
Component: Samba (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-06 03:28 UTC by bluescreenavenger
Modified: 2020-04-07 10:14 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bluescreenavenger 2020-04-06 03:28:10 UTC
Hi

Compiling kio-extras master against Qt 5.14 seems to have a new build error:

This is the log output I get while compiling
[ 93%] Built target kded_networkwatcher
[ 93%] Building CXX object smb/CMakeFiles/kio_smb_static.dir/smburl.cpp.o
[ 94%] Building CXX object smb/CMakeFiles/kio_smb_static.dir/kio_smb_mount.cpp.o
[ 94%] Building CXX object smb/CMakeFiles/kio_smb_static.dir/wsdiscoverer.cpp.o
[ 94%] Building CXX object smb/CMakeFiles/kio_smb_static.dir/dnssddiscoverer.cpp.o
[ 95%] Building CXX object smb/CMakeFiles/kio_smb_static.dir/discovery.cpp.o
[ 95%] Building CXX object smb/CMakeFiles/kio_smb_static.dir/transfer.cpp.o
[ 95%] Building CXX object smb/CMakeFiles/kio_smb_static.dir/smb-logsettings.cpp.o
/srcbuild/kio-extras/smb/transfer.cpp: In static member function ‘static off_t TransferSegment::segmentSizeForFileSize(off_t)’:
/srcbuild/kio-extras/smb/transfer.cpp:17:46: error: no matching function for call to ‘qMax(long int, const off_t&)’
     const off_t fileSize = qMax(0L, fileSize_);
                                              ^
In file included from /opt/include/QtCore/QtGlobal:1,
                 from /srcbuild/kio-extras/smb/transfer.h:9,
                 from /srcbuild/kio-extras/smb/transfer.cpp:6:
/opt/include/QtCore/qglobal.h:663:27: note: candidate: ‘template<class T> constexpr const T& qMax(const T&, const T&)’
 constexpr inline const T &qMax(const T &a, const T &b) { return (a < b) ? b : a; }
                           ^~~~
/opt/include/QtCore/qglobal.h:663:27: note:   template argument deduction/substitution failed:
/srcbuild/kio-extras/smb/transfer.cpp:17:46: note:   deduced conflicting types for parameter ‘const T’ (‘long int’ and ‘off_t’ {aka ‘long long int’})
     const off_t fileSize = qMax(0L, fileSize_);
                                              ^
/srcbuild/kio-extras/smb/transfer.cpp: In member function ‘void TransferRingBuffer::unpop()’:
/srcbuild/kio-extras/smb/transfer.cpp:75:10: warning: operation on ‘((TransferRingBuffer*)this)->TransferRingBuffer::tail’ may be undefined [-Wsequence-point]
     tail = ++tail % m_capacity;
     ~~~~~^~~~~~~~~~~~~~~~~~~~~
make[2]: *** [smb/CMakeFiles/kio_smb_static.dir/build.make:236: smb/CMakeFiles/kio_smb_static.dir/transfer.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:3520: smb/CMakeFiles/kio_smb_static.dir/all] Error 2
make: *** [Makefile:158: all] Error 2

Thanks
Comment 1 Harald Sitter 2020-04-06 09:47:34 UTC
Git commit 95a5ed3167788b24111a0fffaae662cc55585443 by Harald Sitter.
Committed on 06/04/2020 at 09:47.
Pushed by sitter into branch 'master'.

smb: make sure we use balanced arguments on qmax

previously there was opportunity for failure here when the deduced literal
type was different from the actual off_t type and qmax is very picky
about explicit input types. so, instead cast to off_t, as any int will
accommodate 0 anyway so the cast has no downsides.

M  +1    -1    smb/transfer.cpp

https://commits.kde.org/kio-extras/95a5ed3167788b24111a0fffaae662cc55585443
Comment 2 bluescreenavenger 2020-04-06 12:51:05 UTC
That seems to get it a bit further, but now I get

kio-extras: [ 90%] Built target kded_networkwatcher
kio-extras: [ 90%] Building CXX object smb/CMakeFiles/kio_smb_static.dir/transfer.cpp.o
kio-extras: /srcbuild/kio-extras/smb/transfer.cpp: In static member function ‘static off_t TransferSegment::segmentSizeForFileSize(off_t)’:
kio-extras: /srcbuild/kio-extras/smb/transfer.cpp:38:72: error: no matching function for call to ‘qMin(long long int, const long int&)’
kio-extras:      const off_t idealSegmentSize = qMin(fileSize / 50, c_maxSegmentSize);
kio-extras:                                                                         ^
kio-extras: In file included from /opt/include/QtCore/QtGlobal:1,
kio-extras:                  from /srcbuild/kio-extras/smb/transfer.h:9,
kio-extras:                  from /srcbuild/kio-extras/smb/transfer.cpp:6:
kio-extras: /opt/include/QtCore/qglobal.h:661:27: note: candidate: ‘template<class T> constexpr const T& qMin(const T&, const T&)’
kio-extras:  constexpr inline const T &qMin(const T &a, const T &b) { return (a < b) ? a : b; }
kio-extras:                            ^~~~
kio-extras: /opt/include/QtCore/qglobal.h:661:27: note:   template argument deduction/substitution failed:
kio-extras: /srcbuild/kio-extras/smb/transfer.cpp:38:72: note:   deduced conflicting types for parameter ‘const T’ (‘long long int’ and ‘long int’)
kio-extras:      const off_t idealSegmentSize = qMin(fileSize / 50, c_maxSegmentSize);
kio-extras:                                                                         ^
kio-extras: /srcbuild/kio-extras/smb/transfer.cpp: In member function ‘void TransferRingBuffer::unpop()’:
kio-extras: /srcbuild/kio-extras/smb/transfer.cpp:75:10: warning: operation on ‘((TransferRingBuffer*)this)->TransferRingBuffer::tail’ may be undefined [-Wsequence-point]
kio-extras:      tail = ++tail % m_capacity;
kio-extras:      ~~~~~^~~~~~~~~~~~~~~~~~~~~
kio-extras: make[2]: *** [smb/CMakeFiles/kio_smb_static.dir/build.make:236: smb/CMakeFiles/kio_smb_static.dir/transfer.cpp.o] Error 1
kio-extras: make[1]: *** [CMakeFiles/Makefile2:3520: smb/CMakeFiles/kio_smb_static.dir/all] Error 2
kio-extras: make: *** [Makefile:158: all] Error 2
kio-extras: PackageInstallSource finished in 1 seconds with result 2
kio-extras:  PackagePostInstall finished in 0 seconds
Comment 3 Harald Sitter 2020-04-07 10:14:20 UTC
Git commit f4da469b41891cbf85af4b6a56c3e6e365ee7944 by Harald Sitter.
Committed on 07/04/2020 at 10:14.
Pushed by sitter into branch 'master'.

smb: make all qmin and qmax explicitly typed off_t

also explicitly set the min/max constexprs to off_t explicitly.
this should now make all related calls act exclusively on concretely typed
off_ts and as a result build on all platforms with all compilers 🤞

M  +3    -3    smb/transfer.cpp
M  +2    -2    smb/transfer.h

https://commits.kde.org/kio-extras/f4da469b41891cbf85af4b6a56c3e6e365ee7944