Bug 390994 - [dev] Compiler warnings with gcc-6.4.0
Summary: [dev] Compiler warnings with gcc-6.4.0
Status: RESOLVED FIXED
Alias: None
Product: krusader
Classification: Applications
Component: general (show other bugs)
Version: Git
Platform: Gentoo Packages Linux
: NOR minor
Target Milestone: ---
Assignee: Krusader Bugs Distribution List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-24 07:19 UTC by Nikita Melnichenko
Modified: 2018-05-06 00:15 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Melnichenko 2018-02-24 07:19:09 UTC
wdirs/krusader/krusader/Dialogs/packguibase.cpp: In member function ‘virtual bool PackGUIBase::extraProperties(QMap<QString, QString>&)’:
wdirs/krusader/krusader/Dialogs/packguibase.cpp:432:13: warning: attributes at the beginning of statement are ignored [-Wattributes]
             [[gnu::fallthrough]];
             ^
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/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];
                                   ^
wdirs/krusader/krusader/KViewer/panelviewer.cpp: In member function ‘KParts::ReadOnlyPart* PanelViewer::getDefaultPart(KFileItem)’:
wdirs/krusader/krusader/KViewer/panelviewer.cpp:202:9: warning: attributes at the beginning of statement are ignored [-Wattributes]
         [[gnu::fallthrough]];
         ^
wdirs/krusader/krusader/Panel/PanelView/krview.cpp: In member function ‘virtual bool KrView::handleKeyEvent(QKeyEvent*)’:
wdirs/krusader/krusader/Panel/PanelView/krview.cpp:850:9: warning: attributes at the beginning of statement are ignored [-Wattributes]
         [[gnu::fallthrough]];
         ^
wdirs/krusader/krusader/Panel/PanelView/listmodel.cpp: In member function ‘virtual QVariant ListModel::data(const QModelIndex&, int) const’:
wdirs/krusader/krusader/Panel/PanelView/listmodel.cpp:124:9: warning: attributes at the beginning of statement are ignored [-Wattributes]
         [[gnu::fallthrough]];
         ^
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)
                                                                                 ^~~~~
Comment 1 Davide Gianforte 2018-02-25 21:35:03 UTC
Git commit 8837fa2b4bf294d4b8b118c7e42024e302be04e4 by Davide Gianforte.
Committed on 25/02/2018 at 21:34.
Pushed by gengisdave into branch 'master'.

Fix compiler warnings for older GCC

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

GCC older than version 7 doesn't have the attribute [[gnu::fallthrough]]. This
patch suppresses that compiler warning. The other warnings mentioned in the bug
report are still present in version 7 of GCC.

M  +2    -0    krusader/Dialogs/packguibase.cpp
M  +2    -0    krusader/KViewer/panelviewer.cpp
M  +2    -0    krusader/Panel/PanelView/krview.cpp
M  +2    -0    krusader/Panel/PanelView/listmodel.cpp

https://commits.kde.org/krusader/8837fa2b4bf294d4b8b118c7e42024e302be04e4
Comment 2 Nikita Melnichenko 2018-02-25 22:12:25 UTC
Thanks Davide for taking care of the gnu::fallthrough warnings!

The other 3 warnings are still reproducible on master with gcc-6.4.0 on my system, so I'm reopening the bug.
Comment 3 Nikita Melnichenko 2018-03-04 06:22:14 UTC
Git commit dd7d756f65137ccaf0df7b126fd375201f86c061 by Nikita Melnichenko.
Committed on 02/03/2018 at 07:04.
Pushed by melnichenko into branch 'master'.

Fixed a crash when browsing dirs with malformed symlinks

Two major changes for improved stability:
* check the status of lstat and show a "broken" file entry
* use new readLinkSafely function which does not consider stat_p.st_size
but gradually increases buffer until the link destination path fits into
the buffer - this helps in case st_size contains garbage
(some network fs don't care about setting the right size)

As a complementary bonus, the change fixes the following warning:
filesystem.cpp:239:35: warning: variable length array ‘buffer’ is used

FIXED: [ 389413 ] Krusader crashes when entering directories with read errors
Related: bug 389413

Differential Revision: https://phabricator.kde.org/D10761

M  +8    -0    krusader/FileSystem/fileitem.cpp
M  +3    -1    krusader/FileSystem/fileitem.h
M  +58   -23   krusader/FileSystem/filesystem.cpp
M  +4    -1    krusader/FileSystem/filesystem.h

https://commits.kde.org/krusader/dd7d756f65137ccaf0df7b126fd375201f86c061
Comment 4 Nikita Melnichenko 2018-03-15 07:07:53 UTC
Git commit fd085eb8d09c897777500df8b7883bbbaa3c0b00 by Nikita Melnichenko.
Committed on 15/03/2018 at 07:04.
Pushed by melnichenko into branch 'master'.

Fixed compiler warnings with gcc-6.4.0

FIXED: [ 390994 ] [dev] Compiler warnings with gcc-6.4.0
Differential Revision: https://phabricator.kde.org/D11310


https://commits.kde.org/krusader/fd085eb8d09c897777500df8b7883bbbaa3c0b00