Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release/19.x: Revert "[AIX] Turn on #pragma mc_func check by default (#101336)" #101737

Merged
merged 1 commit into from
Aug 4, 2024

Conversation

llvmbot
Copy link
Collaborator

@llvmbot llvmbot commented Aug 2, 2024

Backport dd7a4c3

Requested by: @qiongsiwu

@llvmbot llvmbot added this to the LLVM 19.X Release milestone Aug 2, 2024
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:PowerPC clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Aug 2, 2024
@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 2, 2024

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-backend-powerpc

Author: None (llvmbot)

Changes

Backport dd7a4c3

Requested by: @qiongsiwu


Full diff: https://github.com/llvm/llvm-project/pull/101737.diff

4 Files Affected:

  • (modified) clang/include/clang/Driver/Options.td (+2-2)
  • (modified) clang/include/clang/Lex/PreprocessorOptions.h (+2-2)
  • (modified) clang/lib/Driver/ToolChains/AIX.cpp (+4-2)
  • (modified) clang/test/Preprocessor/pragma_mc_func.c (+2-4)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index bed6e7af9dce9..359a698ea87dd 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -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">>;
diff --git a/clang/include/clang/Lex/PreprocessorOptions.h b/clang/include/clang/Lex/PreprocessorOptions.h
index f48b7ecb90e1e..3f7dd9db18ba7 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 0615a8a9e8d17..fb780fb75651d 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -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");
 }
 
diff --git a/clang/test/Preprocessor/pragma_mc_func.c b/clang/test/Preprocessor/pragma_mc_func.c
index bf12f7107ff5c..f0d3e49e5dddc 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

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 2, 2024

@llvm/pr-subscribers-clang

Author: None (llvmbot)

Changes

Backport dd7a4c3

Requested by: @qiongsiwu


Full diff: https://github.com/llvm/llvm-project/pull/101737.diff

4 Files Affected:

  • (modified) clang/include/clang/Driver/Options.td (+2-2)
  • (modified) clang/include/clang/Lex/PreprocessorOptions.h (+2-2)
  • (modified) clang/lib/Driver/ToolChains/AIX.cpp (+4-2)
  • (modified) clang/test/Preprocessor/pragma_mc_func.c (+2-4)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index bed6e7af9dce9..359a698ea87dd 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -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">>;
diff --git a/clang/include/clang/Lex/PreprocessorOptions.h b/clang/include/clang/Lex/PreprocessorOptions.h
index f48b7ecb90e1e..3f7dd9db18ba7 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 0615a8a9e8d17..fb780fb75651d 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -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");
 }
 
diff --git a/clang/test/Preprocessor/pragma_mc_func.c b/clang/test/Preprocessor/pragma_mc_func.c
index bf12f7107ff5c..f0d3e49e5dddc 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

Copy link
Member

@daltenty daltenty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this is current breaking our ability to build compiler-rt

@tru tru merged commit 9be2c0e into llvm:release/19.x Aug 4, 2024
7 of 9 checks passed
Copy link

github-actions bot commented Aug 4, 2024

@qiongsiwu (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix. When you are done, please add the release:note label to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:PowerPC clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
Development

Successfully merging this pull request may close these issues.

3 participants