Skip to content

Commit 5f9cb1a

Browse files
committed
Clarify warning message, add to group
1 parent a4c6ab8 commit 5f9cb1a

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,8 @@ def err_pauth_cpu_feature_missing : Error<
536536
"neither FEAT_PAUTH nor -fptrauth-soft is enabled. Most of PAuth features are unavailable">;
537537

538538
def warn_pauth_feature_ignored : Warning<
539-
"%0 is ignored because %1 is not specified">;
539+
"%0 is ignored because neither -fptrauth-calls nor -mbranch-protection=pauthabi is specified">,
540+
InGroup<OptionIgnored>;
540541

541542
def err_cmse_pi_are_incompatible : Error<
542543
"cmse is not compatible with %select{RWPI|ROPI}0">;

clang/lib/Basic/Targets/AArch64.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -203,24 +203,20 @@ AArch64TargetInfo::AArch64TargetInfo(const llvm::Triple &Triple,
203203
void AArch64TargetInfo::validatePAuthOptions(DiagnosticsEngine &Diags,
204204
const LangOptions &Opts) const {
205205
if (!Opts.PointerAuthCalls) {
206-
auto IgnoredWithoutPtrAuthCalls = [&Diags](const StringRef OptString) {
207-
Diags.Report(diag::warn_pauth_feature_ignored)
208-
<< OptString << "-fptrauth-calls";
209-
};
210-
211206
if (Opts.PointerAuthInitFini)
212-
IgnoredWithoutPtrAuthCalls("-fptrauth-init-fini");
207+
Diags.Report(diag::warn_pauth_feature_ignored) << "-fptrauth-init-fini";
213208
if (Opts.FunctionPointerTypeDiscrimination)
214-
IgnoredWithoutPtrAuthCalls(
215-
"-fptrauth-function-pointer-type-discrimination");
209+
Diags.Report(diag::warn_pauth_feature_ignored) <<
210+
"-fptrauth-function-pointer-type-discrimination";
216211
if (Opts.PointerAuthVTPtrAddressDiscrimination)
217-
IgnoredWithoutPtrAuthCalls(
218-
"-fptrauth-vtable-pointer-address-discrimination");
212+
Diags.Report(diag::warn_pauth_feature_ignored) <<
213+
"-fptrauth-vtable-pointer-address-discrimination";
219214
if (Opts.PointerAuthVTPtrTypeDiscrimination)
220-
IgnoredWithoutPtrAuthCalls(
221-
"-fptrauth-vtable-pointer-type-discrimination");
215+
Diags.Report(diag::warn_pauth_feature_ignored) <<
216+
"-fptrauth-vtable-pointer-type-discrimination";
222217
if (Opts.PointerAuthBlockDescriptorPointers)
223-
IgnoredWithoutPtrAuthCalls("-fptrauth-block-descriptor-pointers");
218+
Diags.Report(diag::warn_pauth_feature_ignored) <<
219+
"-fptrauth-block-descriptor-pointers";
224220
}
225221

226222
if (HasPAuth || Opts.SoftPointerAuth)

clang/test/CodeGen/ptrauth-cpu-feature.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ int g(int (^bptr)(int)) {
5050
// Ideally, this should be fixed, but it seems rather harmless.
5151
//
5252
// FAIL-COUNT-2: error: neither FEAT_PAUTH nor -fptrauth-soft is enabled. Most of PAuth features are unavailable
53-
// WARN-COUNT-2: warning: [[OPTION]] is ignored because -fptrauth-calls is not specified
53+
// WARN-COUNT-2: warning: [[OPTION]] is ignored because neither -fptrauth-calls nor -mbranch-protection=pauthabi is specified
5454

5555
// COMPAT: f:
5656
// COMPAT: hint {{#25|#27}}

0 commit comments

Comments
 (0)