Skip to content

Commit b933517

Browse files
authored
[AIX] Turn on #pragma mc_func check by default (#101336)
#99888 added a check (and corresponding options) to flag uses of `#pragma mc_func` on AIX. This PR turns on the check by default.
1 parent e145123 commit b933517

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

clang/include/clang/Driver/Options.td

+2-2
Original file line numberDiff line numberDiff line change
@@ -8097,8 +8097,8 @@ def source_date_epoch : Separate<["-"], "source-date-epoch">,
80978097
} // let Visibility = [CC1Option]
80988098

80998099
defm err_pragma_mc_func_aix : BoolFOption<"err-pragma-mc-func-aix",
8100-
PreprocessorOpts<"ErrorOnPragmaMcfuncOnAIX">, DefaultFalse,
8101-
PosFlag<SetTrue, [], [ClangOption, CC1Option],
8100+
PreprocessorOpts<"ErrorOnPragmaMcfuncOnAIX">, DefaultTrue,
8101+
PosFlag<SetTrue, [], [ClangOption],
81028102
"Treat uses of #pragma mc_func as errors">,
81038103
NegFlag<SetFalse,[], [ClangOption, CC1Option],
81048104
"Ignore uses of #pragma mc_func">>;

clang/include/clang/Lex/PreprocessorOptions.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class PreprocessorOptions {
213213

214214
/// If set, the preprocessor reports an error when processing #pragma mc_func
215215
/// on AIX.
216-
bool ErrorOnPragmaMcfuncOnAIX = false;
216+
bool ErrorOnPragmaMcfuncOnAIX = true;
217217

218218
public:
219219
PreprocessorOptions() : PrecompiledPreambleBytes(0, false) {}
@@ -252,7 +252,7 @@ class PreprocessorOptions {
252252
PrecompiledPreambleBytes.first = 0;
253253
PrecompiledPreambleBytes.second = false;
254254
RetainExcludedConditionalBlocks = false;
255-
ErrorOnPragmaMcfuncOnAIX = false;
255+
ErrorOnPragmaMcfuncOnAIX = true;
256256
}
257257
};
258258

clang/lib/Driver/ToolChains/AIX.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,8 @@ void AIX::addClangTargetOptions(
561561
options::OPT_fno_sized_deallocation))
562562
CC1Args.push_back("-fno-sized-deallocation");
563563

564-
if (Args.hasFlag(options::OPT_ferr_pragma_mc_func_aix,
565-
options::OPT_fno_err_pragma_mc_func_aix, false))
566-
CC1Args.push_back("-ferr-pragma-mc-func-aix");
567-
else
564+
if (!Args.hasFlag(options::OPT_ferr_pragma_mc_func_aix,
565+
options::OPT_fno_err_pragma_mc_func_aix, true))
568566
CC1Args.push_back("-fno-err-pragma-mc-func-aix");
569567
}
570568

clang/test/Preprocessor/pragma_mc_func.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
// RUN: not %clang --target=powerpc64-ibm-aix -fsyntax-only %s 2>&1 | FileCheck %s
12
// RUN: not %clang --target=powerpc64-ibm-aix -ferr-pragma-mc-func-aix -fsyntax-only \
23
// RUN: %s 2>&1 | FileCheck %s
4+
// RUN: not %clang --target=powerpc64-ibm-aix -fno-err-pragma-mc-func-aix \
5+
// RUN: -ferr-pragma-mc-func-aix -fsyntax-only %s 2>&1 | FileCheck %s
36
#pragma mc_func asm_barrier {"60000000"}
47

58
// CHECK: error: #pragma mc_func is not supported
@@ -8,11 +11,10 @@
811
// RUN: %clang --target=powerpc64-ibm-aix -fno-err-pragma-mc-func-aix -fsyntax-only %s
912
// RUN: %clang --target=powerpc64-ibm-aix -ferr-pragma-mc-func-aix -fsyntax-only \
1013
// RUN: -fno-err-pragma-mc-func-aix %s
11-
// RUN: %clang --target=powerpc64-ibm-aix -fsyntax-only %s
1214
// RUN: %clang --target=powerpc64-ibm-aix -Werror=unknown-pragmas \
1315
// RUN: -fno-err-pragma-mc-func-aix -fsyntax-only %s
1416

15-
// Cases where we have errors or warnings.
17+
// Cases on a non-AIX target.
1618
// RUN: not %clang --target=powerpc64le-unknown-linux-gnu \
1719
// RUN: -Werror=unknown-pragmas -fno-err-pragma-mc-func-aix -fsyntax-only %s 2>&1 | \
1820
// RUN: FileCheck --check-prefix=UNUSED %s

0 commit comments

Comments
 (0)