From 159b3306d66d91274feb9fd28fdc176cecf47755 Mon Sep 17 00:00:00 2001 From: Helio Chissini de Castro Date: Wed, 27 Sep 2017 10:11:50 +0200 Subject: [PATCH] Change fallthrough detection order to fix clang detection Clang compiler defines fallthrough, but wrongly detects QT_HAS_CPP_ATTRIBUTE(fallthrough). This makes compiler breaks compilation due clang be expecting clang::fallthrough. Change the order makes the exceptions. clang/gnu, been tested before the generic, setting then proper defines at end. LLVM-bug: https://bugs.llvm.org/show_bug.cgi?id=33518 Change-Id: Ic287e9028936af3bdade5c1ee319ca8914b36ea7 Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 2c58ff87e9..231ac2c9b0 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1347,12 +1347,12 @@ } while (false) #if defined(__cplusplus) -#if QT_HAS_CPP_ATTRIBUTE(fallthrough) -# define Q_FALLTHROUGH() [[fallthrough]] -#elif QT_HAS_CPP_ATTRIBUTE(clang::fallthrough) +#if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough) # define Q_FALLTHROUGH() [[clang::fallthrough]] #elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough) # define Q_FALLTHROUGH() [[gnu::fallthrough]] +#elif QT_HAS_CPP_ATTRIBUTE(fallthrough) +# define Q_FALLTHROUGH() [[fallthrough]] #endif #endif #ifndef Q_FALLTHROUGH