diff --git a/src/libs/qmuparser/qmuparserbase.cpp b/src/libs/qmuparser/qmuparserbase.cpp index e32a8c0d4..9f5b5f500 100644 --- a/src/libs/qmuparser/qmuparserbase.cpp +++ b/src/libs/qmuparser/qmuparserbase.cpp @@ -1404,7 +1404,7 @@ void QmuParserBase::CreateRPN() const } ++stArgCount.top(); // fallthrough intentional (no break!) - QMUP_FALLTHROUGH + Q_FALLTHROUGH(); case cmEND: ApplyRemainingOprt(stOpt, stVal); break; @@ -1461,7 +1461,7 @@ void QmuParserBase::CreateRPN() const case cmIF: m_nIfElseCounter++; // fallthrough intentional (no break!) - QMUP_FALLTHROUGH + Q_FALLTHROUGH(); case cmLE: case cmGE: case cmNEQ: diff --git a/src/libs/qmuparser/qmuparserdef.h b/src/libs/qmuparser/qmuparserdef.h index ed5f29468..468c5601c 100644 --- a/src/libs/qmuparser/qmuparserdef.h +++ b/src/libs/qmuparser/qmuparserdef.h @@ -55,23 +55,33 @@ # define __has_cpp_attribute(x) 0 #endif -#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough) -# define QMUP_FALLTHROUGH [[fallthrough]]; -#elif defined(Q_CC_CLANG) && __cplusplus >= 201103L - /* clang's fallthrough annotations are only available starting in C++11. */ -# define QMUP_FALLTHROUGH [[clang::fallthrough]]; -#elif defined(Q_CC_MSVC) - /* - * MSVC's __fallthrough annotations are checked by /analyze (Code Analysis): - * https://msdn.microsoft.com/en-us/library/ms235402%28VS.80%29.aspx - */ -# include -# define QMUP_FALLTHROUGH __fallthrough; -#elif defined(Q_CC_GNU) && (__GNUC__ >= 7) -# define QMUP_FALLTHROUGH [[gnu::fallthrough]]; +#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0) + +#ifndef QT_HAS_CPP_ATTRIBUTE +#ifdef __has_cpp_attribute +# define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) #else -# define QMUP_FALLTHROUGH +# define QT_HAS_CPP_ATTRIBUTE(x) 0 #endif +#endif // QT_HAS_CPP_ATTRIBUTE + +#if defined(__cplusplus) +#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 +# if (defined(Q_CC_GNU) && Q_CC_GNU >= 700) && !defined(Q_CC_INTEL) +# define Q_FALLTHROUGH() __attribute__((fallthrough)) +# else +# define Q_FALLTHROUGH() (void)0 +#endif +#endif // defined(__cplusplus) +#endif // QT_VERSION < QT_VERSION_CHECK(5, 8, 0) /** @brief If this macro is defined mathematical exceptions (div by zero) will be thrown as exceptions. */ //#define QMUP_MATH_EXCEPTIONS diff --git a/src/libs/vdxf/libdxfrw/drw_base.h b/src/libs/vdxf/libdxfrw/drw_base.h index 5d2a41e06..14609e32a 100644 --- a/src/libs/vdxf/libdxfrw/drw_base.h +++ b/src/libs/vdxf/libdxfrw/drw_base.h @@ -53,23 +53,33 @@ # define __has_cpp_attribute(x) 0 #endif -#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough) -# define DRW_FALLTHROUGH [[fallthrough]]; -#elif defined(Q_CC_CLANG) && __cplusplus >= 201103L - /* clang's fallthrough annotations are only available starting in C++11. */ -# define DRW_FALLTHROUGH [[clang::fallthrough]]; -#elif defined(Q_CC_MSVC) - /* - * MSVC's __fallthrough annotations are checked by /analyze (Code Analysis): - * https://msdn.microsoft.com/en-us/library/ms235402%28VS.80%29.aspx - */ -# include -# define DRW_FALLTHROUGH __fallthrough; -#elif defined(Q_CC_GNU) && (__GNUC__ >= 7) -# define DRW_FALLTHROUGH [[gnu::fallthrough]]; +#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0) + +#ifndef QT_HAS_CPP_ATTRIBUTE +#ifdef __has_cpp_attribute +# define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) #else -# define DRW_FALLTHROUGH +# define QT_HAS_CPP_ATTRIBUTE(x) 0 #endif +#endif // QT_HAS_CPP_ATTRIBUTE + +#if defined(__cplusplus) +#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 +# if (defined(Q_CC_GNU) && Q_CC_GNU >= 700) && !defined(Q_CC_INTEL) +# define Q_FALLTHROUGH() __attribute__((fallthrough)) +# else +# define Q_FALLTHROUGH() (void)0 +#endif +#endif // defined(__cplusplus) +#endif // QT_VERSION < QT_VERSION_CHECK(5, 8, 0) typedef signed char dint8; /* 8 bit signed */ typedef signed short dint16; /* 16 bit signed */ diff --git a/src/libs/vdxf/libdxfrw/libdxfrw.cpp b/src/libs/vdxf/libdxfrw/libdxfrw.cpp index 110657c94..3f775a573 100644 --- a/src/libs/vdxf/libdxfrw/libdxfrw.cpp +++ b/src/libs/vdxf/libdxfrw/libdxfrw.cpp @@ -2530,7 +2530,7 @@ bool dxfRW::processPolyline() { processVertex(&pl); } } - DRW_FALLTHROUGH + Q_FALLTHROUGH(); default: pl.parseCode(code, reader); break; @@ -2556,7 +2556,7 @@ bool dxfRW::processVertex(DRW_Polyline *pl) { v.reset(new DRW_Vertex()); //another vertex } } - DRW_FALLTHROUGH + Q_FALLTHROUGH(); default: v->parseCode(code, reader); break; diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index a47b77e03..c4cb10d14 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -329,6 +329,15 @@ enum class GSizes : unsigned char { ALL, #endif #if QT_VERSION < QT_VERSION_CHECK(5, 8, 0) + +#ifndef QT_HAS_CPP_ATTRIBUTE +#ifdef __has_cpp_attribute +# define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) +#else +# define QT_HAS_CPP_ATTRIBUTE(x) 0 +#endif +#endif // QT_HAS_CPP_ATTRIBUTE + #if defined(__cplusplus) #if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough) # define Q_FALLTHROUGH() [[clang::fallthrough]] @@ -344,8 +353,8 @@ enum class GSizes : unsigned char { ALL, # else # define Q_FALLTHROUGH() (void)0 #endif -#endif -#endif +#endif // defined(__cplusplus) +#endif // QT_VERSION < QT_VERSION_CHECK(5, 8, 0) bool IsOptionSet(int argc, char *argv[], const char *option); void InitHighDpiScaling(int argc, char *argv[]);