Continue replacing custom *_FALLTHROUGH macroses with Q_FALLTHROUGH().

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-03-27 13:31:02 +02:00
parent 91925c2618
commit a214a78006
5 changed files with 65 additions and 36 deletions

View File

@ -1404,7 +1404,7 @@ void QmuParserBase::CreateRPN() const
} }
++stArgCount.top(); ++stArgCount.top();
// fallthrough intentional (no break!) // fallthrough intentional (no break!)
QMUP_FALLTHROUGH Q_FALLTHROUGH();
case cmEND: case cmEND:
ApplyRemainingOprt(stOpt, stVal); ApplyRemainingOprt(stOpt, stVal);
break; break;
@ -1461,7 +1461,7 @@ void QmuParserBase::CreateRPN() const
case cmIF: case cmIF:
m_nIfElseCounter++; m_nIfElseCounter++;
// fallthrough intentional (no break!) // fallthrough intentional (no break!)
QMUP_FALLTHROUGH Q_FALLTHROUGH();
case cmLE: case cmLE:
case cmGE: case cmGE:
case cmNEQ: case cmNEQ:

View File

@ -55,23 +55,33 @@
# define __has_cpp_attribute(x) 0 # define __has_cpp_attribute(x) 0
#endif #endif
#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough) #if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
# define QMUP_FALLTHROUGH [[fallthrough]];
#elif defined(Q_CC_CLANG) && __cplusplus >= 201103L #ifndef QT_HAS_CPP_ATTRIBUTE
/* clang's fallthrough annotations are only available starting in C++11. */ #ifdef __has_cpp_attribute
# define QMUP_FALLTHROUGH [[clang::fallthrough]]; # define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
#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 <sal.h>
# define QMUP_FALLTHROUGH __fallthrough;
#elif defined(Q_CC_GNU) && (__GNUC__ >= 7)
# define QMUP_FALLTHROUGH [[gnu::fallthrough]];
#else #else
# define QMUP_FALLTHROUGH # define QT_HAS_CPP_ATTRIBUTE(x) 0
#endif #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. */ /** @brief If this macro is defined mathematical exceptions (div by zero) will be thrown as exceptions. */
//#define QMUP_MATH_EXCEPTIONS //#define QMUP_MATH_EXCEPTIONS

View File

@ -53,23 +53,33 @@
# define __has_cpp_attribute(x) 0 # define __has_cpp_attribute(x) 0
#endif #endif
#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough) #if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
# define DRW_FALLTHROUGH [[fallthrough]];
#elif defined(Q_CC_CLANG) && __cplusplus >= 201103L #ifndef QT_HAS_CPP_ATTRIBUTE
/* clang's fallthrough annotations are only available starting in C++11. */ #ifdef __has_cpp_attribute
# define DRW_FALLTHROUGH [[clang::fallthrough]]; # define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
#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 <sal.h>
# define DRW_FALLTHROUGH __fallthrough;
#elif defined(Q_CC_GNU) && (__GNUC__ >= 7)
# define DRW_FALLTHROUGH [[gnu::fallthrough]];
#else #else
# define DRW_FALLTHROUGH # define QT_HAS_CPP_ATTRIBUTE(x) 0
#endif #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 char dint8; /* 8 bit signed */
typedef signed short dint16; /* 16 bit signed */ typedef signed short dint16; /* 16 bit signed */

View File

@ -2530,7 +2530,7 @@ bool dxfRW::processPolyline() {
processVertex(&pl); processVertex(&pl);
} }
} }
DRW_FALLTHROUGH Q_FALLTHROUGH();
default: default:
pl.parseCode(code, reader); pl.parseCode(code, reader);
break; break;
@ -2556,7 +2556,7 @@ bool dxfRW::processVertex(DRW_Polyline *pl) {
v.reset(new DRW_Vertex()); //another vertex v.reset(new DRW_Vertex()); //another vertex
} }
} }
DRW_FALLTHROUGH Q_FALLTHROUGH();
default: default:
v->parseCode(code, reader); v->parseCode(code, reader);
break; break;

View File

@ -329,6 +329,15 @@ enum class GSizes : unsigned char { ALL,
#endif #endif
#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0) #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 defined(__cplusplus)
#if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough) #if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
# define Q_FALLTHROUGH() [[clang::fallthrough]] # define Q_FALLTHROUGH() [[clang::fallthrough]]
@ -344,8 +353,8 @@ enum class GSizes : unsigned char { ALL,
# else # else
# define Q_FALLTHROUGH() (void)0 # define Q_FALLTHROUGH() (void)0
#endif #endif
#endif #endif // defined(__cplusplus)
#endif #endif // QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
bool IsOptionSet(int argc, char *argv[], const char *option); bool IsOptionSet(int argc, char *argv[], const char *option);
void InitHighDpiScaling(int argc, char *argv[]); void InitHighDpiScaling(int argc, char *argv[]);