From 59174398c80e651e9b333c242628192c62daf231 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 16 Dec 2024 18:13:45 +0100 Subject: [PATCH] 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 --- src/plugins/projectexplorer/gcctoolchain.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 6c35a127efb..c7d5ea054f4 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -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")