[clang] [clang] Fix `gnu::init_priority` attribute handling for reserved values (PR #121577)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 24 06:12:57 PST 2025
================
@@ -3644,16 +3644,20 @@ static void handleInitPriorityAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
return;
}
- // Only perform the priority check if the attribute is outside of a system
- // header. Values <= 100 are reserved for the implementation, and libc++
- // benefits from being able to specify values in that range.
- if ((prioritynum < 101 || prioritynum > 65535) &&
- !S.getSourceManager().isInSystemHeader(AL.getLoc())) {
+ if (prioritynum > 65535) {
S.Diag(AL.getLoc(), diag::err_attribute_argument_out_of_range)
- << E->getSourceRange() << AL << 101 << 65535;
+ << E->getSourceRange() << AL << 0 << 65535;
AL.setInvalid();
return;
}
+
+ // Only perform the priority check if the attribute is outside of a system
+ // header. Values <= 100 are reserved for the implementation, and libc++
+ // benefits from being able to specify values in that range.
+ if (prioritynum < 101) {
----------------
erichkeane wrote:
We don't use curleys per coding standard for single statement 'if' blocks, so please remove them.
https://github.com/llvm/llvm-project/pull/121577
More information about the cfe-commits
mailing list