Skycoder42 / QHotkey

A global shortcut/hotkey for Desktop Qt-Applications
BSD 3-Clause "New" or "Revised" License
552 stars 162 forks source link

warning during compilation on Linux #9

Closed Kolcha closed 6 years ago

Kolcha commented 6 years ago

Ubuntu 16.04, GCC 5.4.0 RedHat 6.9, GCC 5.3.1 RedHat 6.9, GCC 6.3.1

../../../3rdparty/QHotkey/QHotkey/qhotkey_x11.cpp: In static member function ‘static int QHotkeyPrivateX11::HotkeyErrorHandler::handleError(Display*, XErrorEvent*)’:
../../../3rdparty/QHotkey/QHotkey/qhotkey_x11.cpp:176:24: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas]
 QT_WARNING_DISABLE_GCC("-Wimplicit-fallthrough")
                        ^

I think, you added this to prevent/disable warning produced by GCC 7. If so, see https://stackoverflow.com/questions/45129741/gcc-7-wimplicit-fallthrough-warnings-and-portable-way-to-clear-them for other (and more portable) ways to do this.

I commented macro which produces this warning on GCC 5 and 6, compiled with GCC 7 and got warning exact you disabled. I tested suggested solution (added comment before default) with GCC 7.2.1 on RedHat 6.9 and it really works. No warning produced even without macro (macro is commented). I think this will be a better solution, because this produces no warning for wide range of compilers (GCC 5, 6, and 7)