ProjectExplorer: Do not pass the -fcolor-diagnostic option

... when detecting toolchains.
Apparently, this can somehow get onto the command line due to CMake
magic even when not actually present in the project flags, and older
GCCs don't know about it.

Change-Id: I4dc2e0eb3d3ed325f8d250aa51ccc139f95379b9
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2024-12-16 18:13:45 +01:00
parent e4bb567b8d
commit 59174398c8

View File

@@ -570,7 +570,9 @@ 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.startsWith("-f") || a.startsWith("-O")
} else if (a.startsWith("-m")
|| (a.startsWith("-f") && !a.startsWith("-fcolor") && !a.startsWith("-fno-color"))
|| a.startsWith("-O")
|| a.startsWith("-std=") || a.startsWith("-stdlib=")
|| a.startsWith("-specs=") || a == "-ansi" || a == "-undef"
|| a.startsWith("-D") || a.startsWith("-U")