Skip to content

Commit ef440df

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

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8087,8 +8087,8 @@ def source_date_epoch : Separate<["-"], "source-date-epoch">,
80878087
} // let Visibility = [CC1Option]
80888088

80898089
defm err_pragma_mc_func_aix : BoolFOption<"err-pragma-mc-func-aix",
8090-
PreprocessorOpts<"ErrorOnPragmaMcfuncOnAIX">, DefaultFalse,
8091-
PosFlag<SetTrue, [], [ClangOption, CC1Option],
8090+
PreprocessorOpts<"ErrorOnPragmaMcfuncOnAIX">, DefaultTrue,
8091+
PosFlag<SetTrue, [], [ClangOption],
80928092
"Treat uses of #pragma mc_func as errors">,
80938093
NegFlag<SetFalse,[], [ClangOption, CC1Option],
80948094
"Ignore uses of #pragma mc_func">>;

clang/include/clang/Lex/PreprocessorOptions.h

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -558,10 +558,8 @@ void AIX::addClangTargetOptions(
558558
options::OPT_fno_sized_deallocation))
559559
CC1Args.push_back("-fno-sized-deallocation");
560560

561-
if (Args.hasFlag(options::OPT_ferr_pragma_mc_func_aix,
562-
options::OPT_fno_err_pragma_mc_func_aix, false))
563-
CC1Args.push_back("-ferr-pragma-mc-func-aix");
564-
else
561+
if (!Args.hasFlag(options::OPT_ferr_pragma_mc_func_aix,
562+
options::OPT_fno_err_pragma_mc_func_aix, true))
565563
CC1Args.push_back("-fno-err-pragma-mc-func-aix");
566564
}
567565

clang/test/Preprocessor/pragma_mc_func.c

Lines changed: 4 additions & 2 deletions
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)