diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index f690467bb82cd3..59c6bb70d75a22 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -8097,8 +8097,8 @@ def source_date_epoch : Separate<["-"], "source-date-epoch">, } // let Visibility = [CC1Option] defm err_pragma_mc_func_aix : BoolFOption<"err-pragma-mc-func-aix", - PreprocessorOpts<"ErrorOnPragmaMcfuncOnAIX">, DefaultTrue, - PosFlag, DefaultFalse, + PosFlag, NegFlag>; diff --git a/clang/include/clang/Lex/PreprocessorOptions.h b/clang/include/clang/Lex/PreprocessorOptions.h index f48b7ecb90e1e5..3f7dd9db18ba7d 100644 --- a/clang/include/clang/Lex/PreprocessorOptions.h +++ b/clang/include/clang/Lex/PreprocessorOptions.h @@ -213,7 +213,7 @@ class PreprocessorOptions { /// If set, the preprocessor reports an error when processing #pragma mc_func /// on AIX. - bool ErrorOnPragmaMcfuncOnAIX = true; + bool ErrorOnPragmaMcfuncOnAIX = false; public: PreprocessorOptions() : PrecompiledPreambleBytes(0, false) {} @@ -252,7 +252,7 @@ class PreprocessorOptions { PrecompiledPreambleBytes.first = 0; PrecompiledPreambleBytes.second = false; RetainExcludedConditionalBlocks = false; - ErrorOnPragmaMcfuncOnAIX = true; + ErrorOnPragmaMcfuncOnAIX = false; } }; diff --git a/clang/lib/Driver/ToolChains/AIX.cpp b/clang/lib/Driver/ToolChains/AIX.cpp index aa51c1a8df58cf..b2885b7776d132 100644 --- a/clang/lib/Driver/ToolChains/AIX.cpp +++ b/clang/lib/Driver/ToolChains/AIX.cpp @@ -561,8 +561,10 @@ void AIX::addClangTargetOptions( options::OPT_fno_sized_deallocation)) CC1Args.push_back("-fno-sized-deallocation"); - if (!Args.hasFlag(options::OPT_ferr_pragma_mc_func_aix, - options::OPT_fno_err_pragma_mc_func_aix, true)) + if (Args.hasFlag(options::OPT_ferr_pragma_mc_func_aix, + options::OPT_fno_err_pragma_mc_func_aix, false)) + CC1Args.push_back("-ferr-pragma-mc-func-aix"); + else CC1Args.push_back("-fno-err-pragma-mc-func-aix"); } diff --git a/clang/test/Preprocessor/pragma_mc_func.c b/clang/test/Preprocessor/pragma_mc_func.c index bf12f7107ff5cb..f0d3e49e5dddca 100644 --- a/clang/test/Preprocessor/pragma_mc_func.c +++ b/clang/test/Preprocessor/pragma_mc_func.c @@ -1,8 +1,5 @@ -// RUN: not %clang --target=powerpc64-ibm-aix -fsyntax-only %s 2>&1 | FileCheck %s // RUN: not %clang --target=powerpc64-ibm-aix -ferr-pragma-mc-func-aix -fsyntax-only \ // RUN: %s 2>&1 | FileCheck %s -// RUN: not %clang --target=powerpc64-ibm-aix -fno-err-pragma-mc-func-aix \ -// RUN: -ferr-pragma-mc-func-aix -fsyntax-only %s 2>&1 | FileCheck %s #pragma mc_func asm_barrier {"60000000"} // CHECK: error: #pragma mc_func is not supported @@ -11,10 +8,11 @@ // RUN: %clang --target=powerpc64-ibm-aix -fno-err-pragma-mc-func-aix -fsyntax-only %s // RUN: %clang --target=powerpc64-ibm-aix -ferr-pragma-mc-func-aix -fsyntax-only \ // RUN: -fno-err-pragma-mc-func-aix %s +// RUN: %clang --target=powerpc64-ibm-aix -fsyntax-only %s // RUN: %clang --target=powerpc64-ibm-aix -Werror=unknown-pragmas \ // RUN: -fno-err-pragma-mc-func-aix -fsyntax-only %s -// Cases on a non-AIX target. +// Cases where we have errors or warnings. // RUN: not %clang --target=powerpc64le-unknown-linux-gnu \ // RUN: -Werror=unknown-pragmas -fno-err-pragma-mc-func-aix -fsyntax-only %s 2>&1 | \ // RUN: FileCheck --check-prefix=UNUSED %s