Fix compiler warning on GCC <= 7
ClosedPublic

Authored by gengisdave on Feb 25 2018, 9:21 AM.

Details

Reviewers
martinkostolny
Group Reviewers
Krusader
Summary

When using an older GCC, the compiler doesn't recognize the attribute gnu::fallthrough, this patch fixes the warnings.

The other three warnings are still present in GCC 7

FIXED: [ 390994 ] [dev] Compiler warnings with gcc-6.4.0
BUG: 390994

Test Plan

Test with a GCC lower than 7

Diff Detail

Repository
R167 Krusader
Lint
Lint Skipped
Unit
Unit Tests Skipped
gengisdave requested review of this revision.Feb 25 2018, 9:21 AM
gengisdave created this revision.
gengisdave created this object with visibility "All Users".
gengisdave changed the visibility from "All Users" to "Public (No Login Required)".
martinkostolny accepted this revision.Feb 25 2018, 6:32 PM
martinkostolny added a subscriber: martinkostolny.

Thanks, Davide, for taking care of older setups!

I cannot test with older gcc, so I'm just confirming that everything seems to work fine after compiling with gcc 7.3.0.

This revision is now accepted and ready to land.Feb 25 2018, 6:32 PM
gengisdave closed this revision.Feb 25 2018, 9:37 PM

Tested on Slackware 14.2 with gcc 5 and Fedora 25 with gcc 6

asensi added a subscriber: asensi.Feb 27 2018, 6:24 PM

It also works using gcc 5.4.0 under Ubuntu 16.04 LTS (its latest Long Term Service version). Thanks!

nmel added a subscriber: nmel.Feb 28 2018, 4:34 AM

Just to confirm, do you guys see the other 3 warnings with gcc < 7? Because all of them are valid points.

BTW, filesystem.cpp warning I already fixed with D10761, don't bother. krarc.cpp is trivial, I'm also on it. The only thing I'm not sure how to fix yet is "case 2000: //HACK for summary view" in map.cpp.

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 https://bugs.kde.org/show_bug.cgi?id=390994) 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):