From fc5b9911745dd1d14149b84c2e21b5dc949a5055 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 16 Mar 2019 12:22:09 +0200 Subject: [PATCH] Use Q_FALLTHROUGH instead of V_FALLTHROUGH. --HG-- branch : develop --- src/libs/ifc/xml/vpatternconverter.cpp | 106 ++++++++++++------------- src/libs/ifc/xml/vvitconverter.cpp | 12 +-- src/libs/ifc/xml/vvstconverter.cpp | 10 +-- src/libs/vmisc/def.h | 33 ++++---- 4 files changed, 81 insertions(+), 80 deletions(-) diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index dce4f7516..122e77ea7 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -251,215 +251,215 @@ void VPatternConverter::ApplyPatches() case (FORMAT_VERSION(0, 1, 4)): ToV0_2_0(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 0)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 2, 0)): ToV0_2_1(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 1)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 2, 1)): ToV0_2_2(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 2)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 2, 2)): ToV0_2_3(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 3)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 2, 3)): ToV0_2_4(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 4)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 2, 4)): ToV0_2_5(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 5)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 2, 5)): ToV0_2_6(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 6)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 2, 6)): ToV0_2_7(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 7)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 2, 7)): ToV0_3_0(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 0)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 3, 0)): ToV0_3_1(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 1)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 3, 1)): ToV0_3_2(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 2)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 3, 2)): ToV0_3_3(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 3)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 3, 3)): ToV0_3_4(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 4)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 3, 4)): ToV0_3_5(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 5)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 3, 5)): ToV0_3_6(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 6)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 3, 6)): ToV0_3_7(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 7)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 3, 7)): ToV0_3_8(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 8)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 3, 8)): ToV0_3_9(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 9)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 3, 9)): ToV0_4_0(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 0)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 4, 0)): ToV0_4_1(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 1)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 4, 1)): ToV0_4_2(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 2)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 4, 2)): ToV0_4_3(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 3)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 4, 3)): ToV0_4_4(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 4)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 4, 4)): ToV0_4_5(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 5)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 4, 5)): ToV0_4_6(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 6)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 4, 6)): ToV0_4_7(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 7)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 4, 7)): ToV0_4_8(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 8)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 4, 8)): ToV0_5_0(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 5, 0)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 5, 0)): ToV0_5_1(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 5, 1)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 5, 1)): ToV0_6_0(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 0)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 6, 0)): ToV0_6_1(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 1)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 6, 1)): ToV0_6_2(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 2)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 6, 2)): ToV0_6_3(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 3)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 6, 3)): ToV0_6_4(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 4)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 6, 4)): ToV0_6_5(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 5)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 6, 5)): ToV0_6_6(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 6)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 6, 6)): ToV0_7_0(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 0)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 7, 0)): ToV0_7_1(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 1)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 7, 1)): ToV0_7_2(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 2)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 7, 2)): ToV0_7_3(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 3)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 7, 3)): ToV0_7_4(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 4)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 7, 4)): ToV0_7_5(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 5)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 7, 5)): ToV0_7_6(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 6)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 7, 6)): ToV0_7_7(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 7)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 7, 7)): ToV0_7_8(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 8)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 7, 8)): ToV0_7_9(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 9)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 7, 9)): ToV0_7_10(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 10)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 7, 10)): ToV0_7_11(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 11)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 7, 11)): ToV0_7_12(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 12)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 7, 12)): ToV0_7_13(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 13)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 7, 13)): ToV0_8_0(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 0)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 8, 0)): ToV0_8_1(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 1)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 8, 1)): ToV0_8_2(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 2)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 8, 2)): break; default: diff --git a/src/libs/ifc/xml/vvitconverter.cpp b/src/libs/ifc/xml/vvitconverter.cpp index 0eeb12f20..5c319c499 100644 --- a/src/libs/ifc/xml/vvitconverter.cpp +++ b/src/libs/ifc/xml/vvitconverter.cpp @@ -110,27 +110,27 @@ void VVITConverter::ApplyPatches() case (FORMAT_VERSION(0, 2, 0)): ToV0_3_0(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 0)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 3, 0)): ToV0_3_1(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 1)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 3, 1)): ToV0_3_2(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 2)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 3, 2)): ToV0_3_3(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 3)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 3, 3)): ToV0_4_0(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 0)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 4, 0)): ToV0_5_0(); ValidateXML(XSDSchema(FORMAT_VERSION(0, 5, 0)), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (FORMAT_VERSION(0, 5, 0)): break; default: diff --git a/src/libs/ifc/xml/vvstconverter.cpp b/src/libs/ifc/xml/vvstconverter.cpp index be646aa77..b6698739f 100644 --- a/src/libs/ifc/xml/vvstconverter.cpp +++ b/src/libs/ifc/xml/vvstconverter.cpp @@ -104,23 +104,23 @@ void VVSTConverter::ApplyPatches() case (0x000300): ToV0_4_0(); ValidateXML(XSDSchema(0x000400), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (0x000400): ToV0_4_1(); ValidateXML(XSDSchema(0x000401), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (0x000401): ToV0_4_2(); ValidateXML(XSDSchema(0x000402), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (0x000402): ToV0_4_3(); ValidateXML(XSDSchema(0x000403), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (0x000403): ToV0_4_4(); ValidateXML(XSDSchema(0x000404), m_convertedFileName); - V_FALLTHROUGH + Q_FALLTHROUGH(); case (0x000404): break; default: diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index a3227f970..a47b77e03 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -328,22 +328,23 @@ enum class GSizes : unsigned char { ALL, # define __has_cpp_attribute(x) 0 #endif -#if __cplusplus >= 201703L && __has_cpp_attribute(fallthrough) -# define V_FALLTHROUGH [[fallthrough]]; -#elif defined(Q_CC_CLANG) && __cplusplus >= 201103L - /* clang's fallthrough annotations are only available starting in C++11. */ -# define V_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 V_FALLTHROUGH __fallthrough; -#elif defined(Q_CC_GNU) && (__GNUC__ >= 7) -# define V_FALLTHROUGH [[gnu::fallthrough]]; -#else -# define V_FALLTHROUGH +#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0) +#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 #endif bool IsOptionSet(int argc, char *argv[], const char *option);