Fixed warnings that appear when building release version

Authored by nmel on Mar 23 2018, 7:08 AM.


Diff Detail

R167 Krusader
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
nmel requested review of this revision.Mar 23 2018, 7:08 AM
nmel created this revision.
martinkostolny accepted this revision.Mar 25 2018, 3:39 PM
martinkostolny added a subscriber: martinkostolny.

Thanks Nikita for fixing the warnings :). I can only replicate the one in krjob.cpp. How do do I display the rest of the warnings? I've only used -DCMAKE_BUILD_TYPE=Release when calling cmake, is there something else to set up for release building? Maybe the version of my gcc (7.3.1) can play a part in this...

This revision is now accepted and ready to land.Mar 25 2018, 3:39 PM
nmel added a subscriber: asensi.Mar 26 2018, 7:24 AM

I'm not sure, maybe you compiler has less warnings enabled by default. It might be new behavior of gcc-7 as well. You can try to explicitly specify the -Wunused-result flag and see if a warning appears.

BTW, it's not just my compiler settings, Toni also confirmed this earlier (check his attachment):

Just to confirm, do you guys see the other 3 warnings with gcc < 7?

Using Ubuntu 16_04 LTS (with gcc 5.4.0):

Those two warnings (mentioned in are seen:

wdirs/krusader/krusader/DiskUsage/radialMap/map.cpp: In member function ‘void RadialMap::Map::colorise()’:
wdirs/krusader/krusader/DiskUsage/radialMap/map.cpp:184:13: warning: case value ‘2000’ not in enumerated type ‘Filelight::MapScheme’ [-Wswitch]
    case 2000: //HACK for summary view
wdirs/krusader/krArc/krarc.cpp: In member function ‘virtual void kio_krarcProtocol::rename(const QUrl&, const QUrl&, KIO::JobFlags)’:
wdirs/krusader/krArc/krarc.cpp:778:81: warning: unused parameter ‘flags’ [-Wunused-parameter]
    void kio_krarcProtocol::rename(const QUrl& src, const QUrl& dest, KIO::JobFlags flags)

This warning does not appear:

wdirs/krusader/krusader/FileSystem/filesystem.cpp: In static member function ‘static FileItem* FileSystem::createLocalFileItem(const QString&, const QString&, bool)’:
wdirs/krusader/krusader/FileSystem/filesystem.cpp:239:35: warning: variable length array ‘buffer’ is used [-Wvla]
    char buffer[stat_p.st_size];

Although others warnings are seen (it's an old gcc version):

This revision was automatically updated to reflect the committed changes.
nmel added a comment.Mar 26 2018, 7:39 AM

Martin, I included warning messages into the merge commit message. The output contains flags that enable the warnings: -Wmaybe-uninitialized -Wstrict-aliasing -Wunused-result (just in case you want to check you compiler).


BTW, it's not just my compiler settings, Toni also confirmed this earlier [...]

Yes, those warnings were seen (although the warnings that Martin was talking about... were not seen :-) using gcc 7.2.0 under Kubuntu 17.10)

Thanks, Nikita!

Thanks for extensive info! I was still unable to see all the warnings with the flags -Wmaybe-uninitialized -Wstrict-aliasing -Wunused-result enabled. So I guess it is indeed specific to GCC version 7. It doesn't really matter, thanks Nikita for taking care of the warnings!