Revert "[AIX] Turn on `#pragma mc_func` check by default (#101336)"
authorQiongsi Wu <qwu@ibm.com>
Fri, 2 Aug 2024 19:01:15 +0000 (15:01 -0400)
committerTobias Hieta <tobias@hieta.se>
Sun, 4 Aug 2024 09:28:02 +0000 (11:28 +0200)
This reverts commit b9335176db718bf64c72d48107eb9dff28ed979e.

(cherry picked from commit dd7a4c3e5ee3300588b7c12631f3305553d8ea6c)

clang/include/clang/Driver/Options.td
clang/include/clang/Lex/PreprocessorOptions.h
clang/lib/Driver/ToolChains/AIX.cpp
clang/test/Preprocessor/pragma_mc_func.c

index bed6e7af9dce9b04bae52d5d2010b93a87aff869..359a698ea87dd0705794fd7e63f9fd0f2b254c37 100644 (file)
@@ -8087,8 +8087,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<SetTrue, [], [ClangOption],
+  PreprocessorOpts<"ErrorOnPragmaMcfuncOnAIX">, DefaultFalse,
+  PosFlag<SetTrue, [], [ClangOption, CC1Option],
           "Treat uses of #pragma mc_func as errors">,
   NegFlag<SetFalse,[], [ClangOption, CC1Option],
           "Ignore uses of #pragma mc_func">>;
index f48b7ecb90e1e5b86535f2de04b32969d0328c65..3f7dd9db18ba7d1f02010fe33cf77ee5131ab39b 100644 (file)
@@ -213,7 +213,7 @@ public:
 
   /// 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 @@ public:
     PrecompiledPreambleBytes.first = 0;
     PrecompiledPreambleBytes.second = false;
     RetainExcludedConditionalBlocks = false;
-    ErrorOnPragmaMcfuncOnAIX = true;
+    ErrorOnPragmaMcfuncOnAIX = false;
   }
 };
 
index 0615a8a9e8d17dd30fa0453257dd0983dce08101..fb780fb75651d2af907735cd0160cd405d880665 100644 (file)
@@ -558,8 +558,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");
 }
 
index bf12f7107ff5cb8bd8d72f28d33f5e6395254abc..f0d3e49e5dddcafec9ecef0cd4fe946bd74c6466 100644 (file)
@@ -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
 // 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