GCC warnings.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-05-30 18:44:16 +03:00
parent b4f081727d
commit 965d908663
44 changed files with 94 additions and 15 deletions

View File

@ -55,6 +55,7 @@ Q_DECLARE_LOGGING_CATEGORY(vXML)
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
/** /**
* @brief The VDomDocument class represents a Valentina document (.val file). * @brief The VDomDocument class represents a Valentina document (.val file).

View File

@ -1407,9 +1407,7 @@ void QmuParserBase::CreateRPN() const
} }
++stArgCount.top(); ++stArgCount.top();
// fallthrough intentional (no break!) // fallthrough intentional (no break!)
#ifdef Q_CC_CLANG QMUP_FALLTHROUGH
[[clang::fallthrough]];
#endif
case cmEND: case cmEND:
ApplyRemainingOprt(stOpt, stVal); ApplyRemainingOprt(stOpt, stVal);
break; break;
@ -1466,9 +1464,7 @@ void QmuParserBase::CreateRPN() const
case cmIF: case cmIF:
m_nIfElseCounter++; m_nIfElseCounter++;
// fallthrough intentional (no break!) // fallthrough intentional (no break!)
#ifdef Q_CC_CLANG QMUP_FALLTHROUGH
[[clang::fallthrough]];
#endif
case cmLE: case cmLE:
case cmGE: case cmGE:
case cmNEQ: case cmNEQ:

View File

@ -52,6 +52,24 @@
# define QMUP_NOEXCEPT_EXPR(x) # define QMUP_NOEXCEPT_EXPR(x)
# endif # 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]];
#else
# define QMUP_FALLTHROUGH
#endif
/** @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

@ -530,5 +530,23 @@ const double dxfColors[][3] =
#define DL_DCS_TRANS_CODE 2 #define DL_DCS_TRANS_CODE 2
#define DL_PCS_TRANS_CODE 3 #define DL_PCS_TRANS_CODE 3
#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough)
# define DL_FALLTHROUGH [[fallthrough]];
#elif defined(Q_CC_CLANG) && __cplusplus >= 201103L
/* clang's fallthrough annotations are only available starting in C++11. */
# define DL_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 DL_FALLTHROUGH __fallthrough;
#elif defined(Q_CC_GNU) && (__GNUC__ >= 7)
# define DL_FALLTHROUGH [[gnu::fallthrough]];
#else
# define DL_FALLTHROUGH
#endif
#endif #endif

View File

@ -5866,14 +5866,10 @@ int DL_Dxf::getLibVersion(const std::string& str)
{ {
case 4: case 4:
v3 = ver.at(3).toInt(); v3 = ver.at(3).toInt();
#ifdef Q_CC_CLANG DL_FALLTHROUGH
[[clang::fallthrough]];
#endif
case 3: case 3:
v2 = ver.at(2).toInt(); v2 = ver.at(2).toInt();
#ifdef Q_CC_CLANG DL_FALLTHROUGH
[[clang::fallthrough]];
#endif
case 2: case 2:
v0 = ver.at(0).toInt(); v0 = ver.at(0).toInt();
v1 = ver.at(1).toInt(); v1 = ver.at(1).toInt();

View File

@ -37,6 +37,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VAbstractArcData : public QSharedData class VAbstractArcData : public QSharedData
{ {

View File

@ -36,6 +36,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VAbstractCurveData : public QSharedData class VAbstractCurveData : public QSharedData
{ {

View File

@ -36,6 +36,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VArcData : public QSharedData class VArcData : public QSharedData
{ {

View File

@ -39,6 +39,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VCubicBezierData : public QSharedData class VCubicBezierData : public QSharedData
{ {

View File

@ -36,6 +36,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VCubicBezierPathData : public QSharedData class VCubicBezierPathData : public QSharedData
{ {

View File

@ -8,6 +8,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VEllipticalArcData : public QSharedData class VEllipticalArcData : public QSharedData
{ {

View File

@ -36,6 +36,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VGObjectData : public QSharedData class VGObjectData : public QSharedData
{ {

View File

@ -36,6 +36,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VPointFData : public QSharedData class VPointFData : public QSharedData
{ {

View File

@ -38,6 +38,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VSplineData : public QSharedData class VSplineData : public QSharedData
{ {

View File

@ -34,6 +34,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VSplinePathData : public QSharedData class VSplinePathData : public QSharedData
{ {

View File

@ -39,6 +39,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VFSplinePointData : public QSharedData class VFSplinePointData : public QSharedData
{ {

View File

@ -44,6 +44,7 @@ class VAbstractPieceData;
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
/** /**
* @brief The VSAPoint class seam allowance point * @brief The VSAPoint class seam allowance point

View File

@ -37,6 +37,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VAbstractPieceData : public QSharedData class VAbstractPieceData : public QSharedData
{ {

View File

@ -36,6 +36,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VContourData : public QSharedData class VContourData : public QSharedData
{ {

View File

@ -38,6 +38,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VLayoutPaperData : public QSharedData class VLayoutPaperData : public QSharedData
{ {

View File

@ -44,6 +44,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VLayoutPieceData : public QSharedData class VLayoutPieceData : public QSharedData
{ {

View File

@ -37,6 +37,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VLayoutPiecePathData : public QSharedData class VLayoutPiecePathData : public QSharedData
{ {

View File

@ -29,6 +29,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class QCommandLineOptionPrivate : public QSharedData class QCommandLineOptionPrivate : public QSharedData
{ {

View File

@ -30,6 +30,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class QCommandLineOptionPrivate; class QCommandLineOptionPrivate;

View File

@ -35,6 +35,7 @@ QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wswitch-default") QT_WARNING_DISABLE_GCC("-Wswitch-default")
QT_WARNING_DISABLE_GCC("-Wsuggest-attribute=noreturn") QT_WARNING_DISABLE_GCC("-Wsuggest-attribute=noreturn")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
typedef QHash<QString, int> NameHash_t; typedef QHash<QString, int> NameHash_t;

View File

@ -33,6 +33,7 @@ class QCoreApplication;
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class QCommandLineParser class QCommandLineParser
{ {

View File

@ -282,8 +282,20 @@ enum class GSizes : unsigned char { ALL,
#define SCASSERT(cond) qt_noop(); #define SCASSERT(cond) qt_noop();
#endif /* V_NO_ASSERT */ #endif /* V_NO_ASSERT */
#ifdef Q_CC_CLANG #if __cplusplus > 201402L && __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]]; # 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 <sal.h>
# define V_FALLTHROUGH __fallthrough;
#elif defined(Q_CC_GNU) && (__GNUC__ >= 7)
# define V_FALLTHROUGH [[gnu::fallthrough]];
#else #else
# define V_FALLTHROUGH # define V_FALLTHROUGH
#endif #endif

View File

@ -36,6 +36,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VAbstractFloatItemDataPrivate : public QSharedData class VAbstractFloatItemDataPrivate : public QSharedData
{ {

View File

@ -38,6 +38,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VGrainlineDataPrivate : public QSharedData class VGrainlineDataPrivate : public QSharedData
{ {

View File

@ -37,6 +37,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VPatternLabelDataPrivate : public QSharedData class VPatternLabelDataPrivate : public QSharedData
{ {

View File

@ -37,6 +37,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VPieceLabelDataPrivate : public QSharedData class VPieceLabelDataPrivate : public QSharedData
{ {

View File

@ -35,6 +35,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VArcRadiusData : public QSharedData class VArcRadiusData : public QSharedData
{ {

View File

@ -36,6 +36,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VCurveVariableData : public QSharedData class VCurveVariableData : public QSharedData
{ {

View File

@ -37,6 +37,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VIncrementData : public QSharedData class VIncrementData : public QSharedData
{ {

View File

@ -35,6 +35,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VInternalVariableData : public QSharedData class VInternalVariableData : public QSharedData
{ {

View File

@ -36,6 +36,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VLineAngleData : public QSharedData class VLineAngleData : public QSharedData
{ {

View File

@ -36,6 +36,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VLengthLineData : public QSharedData class VLengthLineData : public QSharedData
{ {

View File

@ -36,6 +36,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VMeasurementData : public QSharedData class VMeasurementData : public QSharedData
{ {

View File

@ -35,6 +35,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VVariableData : public QSharedData class VVariableData : public QSharedData
{ {

View File

@ -62,6 +62,7 @@ class VEllipticalArc;
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_INTEL(2021) QT_WARNING_DISABLE_INTEL(2021)
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VContainerData : public QSharedData //-V690 class VContainerData : public QSharedData //-V690
{ {

View File

@ -35,6 +35,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VNodeDetailData : public QSharedData class VNodeDetailData : public QSharedData
{ {

View File

@ -42,6 +42,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VPieceData : public QSharedData class VPieceData : public QSharedData
{ {

View File

@ -36,6 +36,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VPieceNodeData : public QSharedData class VPieceNodeData : public QSharedData
{ {

View File

@ -37,6 +37,7 @@
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VPiecePathData : public QSharedData class VPiecePathData : public QSharedData
{ {