diff --git a/language/duchain/navigation/abstractnavigationcontext.cpp b/language/duchain/navigation/abstractnavigationcontext.cpp --- a/language/duchain/navigation/abstractnavigationcontext.cpp +++ b/language/duchain/navigation/abstractnavigationcontext.cpp @@ -21,6 +21,8 @@ #include #include +#include + #include "abstractdeclarationnavigationcontext.h" #include "abstractnavigationwidget.h" #include "usesnavigationcontext.h" @@ -182,7 +184,7 @@ browser->showUses(action.decl); return NavigationContextPointer(this); } - // fall-through + Q_FALLTHROUGH(); } case NavigationAction::ShowUses: return registerChild(new UsesNavigationContext(action.decl.data(), this)); diff --git a/language/duchain/stringhelpers.cpp b/language/duchain/stringhelpers.cpp --- a/language/duchain/stringhelpers.cpp +++ b/language/duchain/stringhelpers.cpp @@ -20,6 +20,8 @@ #include "safetycounter.h" #include "util/debug.h" +#include + #include #include @@ -170,6 +172,7 @@ break; case '>': if( last == '-' ) break; + Q_FALLTHROUGH(); case ')': case ']': case '}': @@ -233,6 +236,7 @@ case '>': if( validEnd != ' ' && validEnd != str[a] ) continue; + Q_FALLTHROUGH(); case ',': return a; } diff --git a/plugins/quickopen/quickopenwidget.cpp b/plugins/quickopen/quickopenwidget.cpp --- a/plugins/quickopen/quickopenwidget.cpp +++ b/plugins/quickopen/quickopenwidget.cpp @@ -30,6 +30,8 @@ #include #include +#include + #include #include #include @@ -414,6 +416,7 @@ } return false; } + Q_FALLTHROUGH(); } case Qt::Key_PageUp: case Qt::Key_PageDown: diff --git a/qtcompat_p.h b/qtcompat_p.h --- a/qtcompat_p.h +++ b/qtcompat_p.h @@ -39,3 +39,26 @@ #endif #endif + +// compat for Q_FALLTHROUGH +#if QT_VERSION < QT_VERSION_CHECK(5,8,0) + +#if defined(__has_cpp_attribute) +# if __has_cpp_attribute(fallthrough) +# define Q_FALLTHROUGH() [[fallthrough]] +# elif __has_cpp_attribute(clang::fallthrough) +# define Q_FALLTHROUGH() [[clang::fallthrough]] +# elif __has_cpp_attribute(gnu::fallthrough) +# define Q_FALLTHROUGH() [[gnu::fallthrough]] +# endif +#endif + +#ifndef Q_FALLTHROUGH +# if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 700) +# define Q_FALLTHROUGH() __attribute__((fallthrough)) +# else +# define Q_FALLTHROUGH() (void)0 +# endif +#endif + +#endif