Fix enabling warning keys specific to GCC versions.

This commit is contained in:
Roman Telezhynskyi 2021-09-25 07:43:41 +03:00
parent 475484b80c
commit 69cd801ae6
2 changed files with 15 additions and 59 deletions

View File

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

View File

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