From 69cd801ae602bd1ab86724f091e84273600cd3ee Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 25 Sep 2021 07:43:41 +0300 Subject: [PATCH] Fix enabling warning keys specific to GCC versions. --- Valentina.pro | 38 -------------------------------------- common.pri | 36 +++++++++++++++--------------------- 2 files changed, 15 insertions(+), 59 deletions(-) diff --git a/Valentina.pro b/Valentina.pro index 81ed324c7..01558d0f6 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -13,43 +13,5 @@ count(LIST, 1, >): error("The build will fail. Path '$${PWD}' contains space!!!" LIST = $$split(OUT_PWD,' ') count(LIST, 1, >): error("The build will fail. Path '$${OUT_PWD}' contains space!!!") -unix { - *g++* { - GCC_VERSION = $$system("g++ -dumpversion") - contains(GCC_VERSION, ^9.*$) { - message( "g++ version 9.x found" ) - CONFIG += g++9 - } else { - GCC_VERSION = $$system("g++ -dumpversion") - contains(GCC_VERSION, ^8.*$) { - message( "g++ version 8.x found" ) - CONFIG += g++8 - } else { - contains(GCC_VERSION, ^7.*$) { - message( "g++ version 7.x found" ) - CONFIG += g++7 - } else { - contains(GCC_VERSION, ^6.*$) { - message( "g++ version 6.x found" ) - CONFIG += g++6 - } else { - contains(GCC_VERSION, ^5.*$) { - message( "g++ version 5.x found" ) - CONFIG += g++5 - } else { - contains(GCC_VERSION, ^4.*$) { - message( "g++ version 4.x found" ) - CONFIG += g++4 - } else { - message( "Unknown GCC configuration" ) - } - } - } - } - } - } - } -} - TEMPLATE = subdirs SUBDIRS = src diff --git a/common.pri b/common.pri index 83e2fbeee..0d117cbeb 100644 --- a/common.pri +++ b/common.pri @@ -14,6 +14,19 @@ win32{ } unix{ + *g++* { + GCC_VERSION = $$system("g++ -dumpfullversion -dumpversion") + message("g++ version $$GCC_VERSION found") + COMPILER_MAJOR_VERSION = $$str_member($${GCC_VERSION}) + + greaterThan(COMPILER_MAJOR_VERSION, 3):CONFIG += g++4 + greaterThan(COMPILER_MAJOR_VERSION, 4):CONFIG += g++5 + greaterThan(COMPILER_MAJOR_VERSION, 5):CONFIG += g++6 + greaterThan(COMPILER_MAJOR_VERSION, 6):CONFIG += g++7 + greaterThan(COMPILER_MAJOR_VERSION, 7):CONFIG += g++8 + greaterThan(COMPILER_MAJOR_VERSION, 8):CONFIG += g++9 + } + macx{ VCOPY = $$QMAKE_COPY } else { @@ -402,12 +415,6 @@ g++5:GCC_DEBUG_CXXFLAGS += \ # Since GCC 6 g++6:GCC_DEBUG_CXXFLAGS += \ - -Wswitch-bool \ - -Wlogical-not-parentheses \ - -Wsizeof-array-argument \ - -Wbool-compare \ - -Wsuggest-final-types \ - -Wsuggest-final-methods \ -Wshift-negative-value \ -Wshift-overflow \ -Wshift-overflow=2 \ @@ -418,19 +425,6 @@ g++6:GCC_DEBUG_CXXFLAGS += \ # Since GCC 7 g++7:GCC_DEBUG_CXXFLAGS += \ - -Wswitch-bool \ - -Wlogical-not-parentheses \ - -Wsizeof-array-argument \ - -Wbool-compare \ - -Wsuggest-final-types \ - -Wsuggest-final-methods \ - -Wshift-negative-value \ - -Wshift-overflow \ - -Wshift-overflow=2 \ - -Wtautological-compare \ - -Wnull-dereference \ - -Wduplicated-cond \ - -Wmisleading-indentation \ -Wduplicated-branches \ -Wrestrict \ -Walloc-zero \ @@ -439,8 +433,8 @@ g++7:GCC_DEBUG_CXXFLAGS += \ # Since GCC 8 g++8:GCC_DEBUG_CXXFLAGS += \ - -Wmultistatement-macros \ - -Warray-bounds + -Wmultistatement-macros \ + -Warray-bounds # Usefull Clang warnings keys. CLANG_DEBUG_CXXFLAGS += \