GccToolChain: whitelist all -f* and -O* gcc options

there are way too many -f* options to catch all relevant ones.
my particular case was the linux kernel, for which passing
-mcmodel=kernel but not -fno-PIE caused a gcc error.
if any particular option causes trouble, it should be blacklisted
instead.

also handle -O* while at it; -Og comes to mind as a relevant one.

this follows 3b79fafb3 in spirit.

Change-Id: I5de56082b695205409a8e82de2cab0618e2806a8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Oswald Buddenhagen
2022-07-14 12:06:50 +02:00
parent 6fe15c58c9
commit 9841a10f35
6 changed files with 10 additions and 14 deletions

View File

@@ -27,7 +27,7 @@ SOURCES = \
privateFuncDefCompletion.cpp \
signalCompletion.cpp
QMAKE_CXXFLAGS += -ffoo
QMAKE_CXXFLAGS += -broken
HEADERS = mainwindow.h
FORMS = mainwindow.ui

View File

@@ -2,4 +2,4 @@ TEMPLATE = app
QT = core
HEADERS = defs.h
SOURCES = main.cpp
QMAKE_CXXFLAGS += -ffoo
QMAKE_CXXFLAGS += -broken

View File

@@ -2,4 +2,4 @@ TEMPLATE = app
CONFIG -= qt
HEADERS = cursor.h header.h
SOURCES = cursor.cpp main.cpp
QMAKE_CXXFLAGS += -ffoo
QMAKE_CXXFLAGS += -broken

View File

@@ -1,4 +1,4 @@
TEMPLATE = app
CONFIG -= qt
SOURCES = highlighting.cpp
QMAKE_CXXFLAGS += -ffoo
QMAKE_CXXFLAGS += -broken

View File

@@ -1,4 +1,4 @@
TEMPLATE = app
CONFIG -= qt
SOURCES = references.cpp
QMAKE_CXXFLAGS += -ffoo
QMAKE_CXXFLAGS += -broken

View File

@@ -449,18 +449,14 @@ static QStringList filteredFlags(const QStringList &allFlags, bool considerSysro
|| a == "-gcc-toolchain" || a == "-target" || a == "-mllvm" || a == "-isystem") {
if (++i < allFlags.length())
filtered << a << allFlags.at(i);
} else if (a.startsWith("-m") || a == "-Os" || a == "-O0" || a == "-O1" || a == "-O2"
|| a == "-O3" || a == "-ffinite-math-only" || a == "-fshort-double"
|| a == "-fshort-wchar" || a == "-fsignaling-nans" || a == "-fno-inline"
|| a == "-fno-exceptions" || a == "-fstack-protector"
|| a == "-fstack-protector-all" || a == "-fsanitize=address"
|| a == "-fno-rtti" || a.startsWith("-std=") || a.startsWith("-stdlib=")
} else if (a.startsWith("-m") || a.startsWith("-f") || a.startsWith("-O")
|| a.startsWith("-std=") || a.startsWith("-stdlib=")
|| a.startsWith("-specs=") || a == "-ansi" || a == "-undef"
|| a.startsWith("-D") || a.startsWith("-U") || a == "-fopenmp"
|| a == "-Wno-deprecated" || a == "-fPIC" || a == "-fpic" || a == "-fPIE"
|| a == "-fpie" || a.startsWith("-stdlib=") || a.startsWith("-B")
|| a.startsWith("-D") || a.startsWith("-U")
|| a.startsWith("-stdlib=") || a.startsWith("-B")
|| a.startsWith("--target=")
|| (a.startsWith("-isystem") && a.length() > 8)
|| a == "-Wno-deprecated"
|| a == "-nostdinc" || a == "-nostdinc++") {
filtered << a;
}