From 88be00fe422c9794f1c44f603f2cfd85b99e9c95 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 6 Aug 2016 19:32:51 +0300 Subject: [PATCH] Fixed build on Qt lower version 5.5.0. --HG-- branch : develop --- src/libs/qmuparser/qmudef.h | 58 +++++++++++++++ src/libs/qmuparser/qmuparserbytecode.cpp | 1 - src/libs/vmisc/diagnostic.h | 92 ++++++++++++++++++++++++ src/libs/vmisc/vmisc.pri | 3 +- src/libs/vobj/predicates.cpp | 3 +- 5 files changed, 154 insertions(+), 3 deletions(-) create mode 100644 src/libs/vmisc/diagnostic.h diff --git a/src/libs/qmuparser/qmudef.h b/src/libs/qmuparser/qmudef.h index ef5dafb5e..9f59b4e6c 100644 --- a/src/libs/qmuparser/qmudef.h +++ b/src/libs/qmuparser/qmudef.h @@ -26,6 +26,64 @@ #include +#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) + +/* + * Warning/diagnostic handling + */ + +#define QT_DO_PRAGMA(text) _Pragma(#text) +#if defined(Q_CC_INTEL) && defined(Q_CC_MSVC) +/* icl.exe: Intel compiler on Windows */ +# undef QT_DO_PRAGMA /* not needed */ +# define QT_WARNING_PUSH __pragma(warning(push)) +# define QT_WARNING_POP __pragma(warning(pop)) +# define QT_WARNING_DISABLE_MSVC(number) +# define QT_WARNING_DISABLE_INTEL(number) __pragma(warning(disable: number)) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_GCC(text) +#elif defined(Q_CC_INTEL) +/* icc: Intel compiler on Linux or OS X */ +# define QT_WARNING_PUSH QT_DO_PRAGMA(warning(push)) +# define QT_WARNING_POP QT_DO_PRAGMA(warning(pop)) +# define QT_WARNING_DISABLE_INTEL(number) QT_DO_PRAGMA(warning(disable: number)) +# define QT_WARNING_DISABLE_MSVC(number) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_GCC(text) +#elif defined(Q_CC_MSVC) && _MSC_VER >= 1500 +# undef QT_DO_PRAGMA /* not needed */ +# define QT_WARNING_PUSH __pragma(warning(push)) +# define QT_WARNING_POP __pragma(warning(pop)) +# define QT_WARNING_DISABLE_MSVC(number) __pragma(warning(disable: number)) +# define QT_WARNING_DISABLE_INTEL(number) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_GCC(text) +#elif defined(Q_CC_CLANG) +# define QT_WARNING_PUSH QT_DO_PRAGMA(clang diagnostic push) +# define QT_WARNING_POP QT_DO_PRAGMA(clang diagnostic pop) +# define QT_WARNING_DISABLE_CLANG(text) QT_DO_PRAGMA(clang diagnostic ignored text) +# define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text)// GCC directives work in Clang too +# define QT_WARNING_DISABLE_INTEL(number) +# define QT_WARNING_DISABLE_MSVC(number) +#elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) +# define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push) +# define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop) +# define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_INTEL(number) +# define QT_WARNING_DISABLE_MSVC(number) +#else // All other compilers, GCC < 4.6 and MSVC < 2008 +# define QT_WARNING_DISABLE_GCC(text) +# define QT_WARNING_PUSH +# define QT_WARNING_POP +# define QT_WARNING_DISABLE_INTEL(number) +# define QT_WARNING_DISABLE_MSVC(number) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_GCC(text) +#endif + +#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) + #ifdef Q_CC_GNU #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wattributes" diff --git a/src/libs/qmuparser/qmuparserbytecode.cpp b/src/libs/qmuparser/qmuparserbytecode.cpp index a1ab7f6aa..c3774a7b7 100644 --- a/src/libs/qmuparser/qmuparserbytecode.cpp +++ b/src/libs/qmuparser/qmuparserbytecode.cpp @@ -27,7 +27,6 @@ #include #include #include -#include namespace qmu { diff --git a/src/libs/vmisc/diagnostic.h b/src/libs/vmisc/diagnostic.h new file mode 100644 index 000000000..935d05672 --- /dev/null +++ b/src/libs/vmisc/diagnostic.h @@ -0,0 +1,92 @@ +/************************************************************************ + ** + ** @file diagnostic.h + ** @author Roman Telezhynskyi + ** @date 6 8, 2016 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2016 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef DIAGNOSTIC_H +#define DIAGNOSTIC_H + +#include + +#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) + +/* + * Warning/diagnostic handling + */ + +#define QT_DO_PRAGMA(text) _Pragma(#text) +#if defined(Q_CC_INTEL) && defined(Q_CC_MSVC) +/* icl.exe: Intel compiler on Windows */ +# undef QT_DO_PRAGMA /* not needed */ +# define QT_WARNING_PUSH __pragma(warning(push)) +# define QT_WARNING_POP __pragma(warning(pop)) +# define QT_WARNING_DISABLE_MSVC(number) +# define QT_WARNING_DISABLE_INTEL(number) __pragma(warning(disable: number)) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_GCC(text) +#elif defined(Q_CC_INTEL) +/* icc: Intel compiler on Linux or OS X */ +# define QT_WARNING_PUSH QT_DO_PRAGMA(warning(push)) +# define QT_WARNING_POP QT_DO_PRAGMA(warning(pop)) +# define QT_WARNING_DISABLE_INTEL(number) QT_DO_PRAGMA(warning(disable: number)) +# define QT_WARNING_DISABLE_MSVC(number) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_GCC(text) +#elif defined(Q_CC_MSVC) && _MSC_VER >= 1500 +# undef QT_DO_PRAGMA /* not needed */ +# define QT_WARNING_PUSH __pragma(warning(push)) +# define QT_WARNING_POP __pragma(warning(pop)) +# define QT_WARNING_DISABLE_MSVC(number) __pragma(warning(disable: number)) +# define QT_WARNING_DISABLE_INTEL(number) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_GCC(text) +#elif defined(Q_CC_CLANG) +# define QT_WARNING_PUSH QT_DO_PRAGMA(clang diagnostic push) +# define QT_WARNING_POP QT_DO_PRAGMA(clang diagnostic pop) +# define QT_WARNING_DISABLE_CLANG(text) QT_DO_PRAGMA(clang diagnostic ignored text) +# define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) // GCC directives work in Clang too +# define QT_WARNING_DISABLE_INTEL(number) +# define QT_WARNING_DISABLE_MSVC(number) +#elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) +# define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push) +# define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop) +# define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_INTEL(number) +# define QT_WARNING_DISABLE_MSVC(number) +#else // All other compilers, GCC < 4.6 and MSVC < 2008 +# define QT_WARNING_DISABLE_GCC(text) +# define QT_WARNING_PUSH +# define QT_WARNING_POP +# define QT_WARNING_DISABLE_INTEL(number) +# define QT_WARNING_DISABLE_MSVC(number) +# define QT_WARNING_DISABLE_CLANG(text) +# define QT_WARNING_DISABLE_GCC(text) +#endif + +#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) + +#endif // DIAGNOSTIC_H diff --git a/src/libs/vmisc/vmisc.pri b/src/libs/vmisc/vmisc.pri index 5ff9195dc..2e45e30a5 100644 --- a/src/libs/vmisc/vmisc.pri +++ b/src/libs/vmisc/vmisc.pri @@ -33,7 +33,8 @@ HEADERS += \ $$PWD/commandoptions.h \ $$PWD/qxtcsvmodel.h \ $$PWD/vtablesearch.h \ - $$PWD/abstracttest.h + $$PWD/abstracttest.h \ + $$PWD/diagnostic.h # Qt's versions # 5.0.0, 5.0.1, 5.0.2 diff --git a/src/libs/vobj/predicates.cpp b/src/libs/vobj/predicates.cpp index 487f1d025..5d8fde02a 100644 --- a/src/libs/vobj/predicates.cpp +++ b/src/libs/vobj/predicates.cpp @@ -108,7 +108,8 @@ #include #include #include -#include + +#include "../vmisc/diagnostic.h" QT_WARNING_PUSH QT_WARNING_DISABLE_MSVC(4701)