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();
// 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:

View File

@ -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 <sal.h>
# 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

View File

@ -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 <sal.h>
# 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 */

View File

@ -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;

View File

@ -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[]);