From 51a7eaa2fdbf870eebedcafc51c263b38554b8af Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 16 Apr 2025 13:45:10 +0200 Subject: [PATCH] CppEditor: Work around parse error in Darwin headers Apple compilers secretly inject a command-line option to suppress the error, so we do the same for the clang tools. Fixes: QTCREATORBUG-32499 Change-Id: I9600babd4911e328b04c1aec5e42428fd78c61a2 Reviewed-by: David Schulz --- src/plugins/cppeditor/compileroptionsbuilder.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/cppeditor/compileroptionsbuilder.cpp b/src/plugins/cppeditor/compileroptionsbuilder.cpp index 417cce92748..1385461b7e4 100644 --- a/src/plugins/cppeditor/compileroptionsbuilder.cpp +++ b/src/plugins/cppeditor/compileroptionsbuilder.cpp @@ -3,13 +3,11 @@ #include "compileroptionsbuilder.h" -#include "cppmodelmanager.h" #include "headerpathfilter.h" #include #include -#include #include #include @@ -18,7 +16,6 @@ #include #include #include -#include #include #include @@ -961,6 +958,12 @@ void CompilerOptionsBuilder::evaluateCompilerFlags() m_clStyle = true; m_compilerFlags.flags.prepend("--driver-mode=cl"); } + + // Apple's headers are broken, see QTCREATORBUG-32499. + // Note that the condition is not technically correct, but we don't know the target OS + // here, and it shouldn't hurt to have the option where it is not strictly needed. + if (HostOsInfo::isMacHost()) + m_compilerFlags.flags << "-Wno-elaborated-enum-base"; } bool CompilerOptionsBuilder::isClStyle() const