[clang] [clang] Fix `gnu::init_priority` attribute handling for reserved values (PR #121577)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 3 15:21:24 PST 2025
================
@@ -33,23 +33,22 @@ Two goo __attribute__((init_priority(2,3))) ( 5, 6 ); // expected-error {{'init_
Two coo[2] __attribute__((init_priority(100)));
#if !defined(SYSTEM)
- // expected-error at -2 {{'init_priority' attribute requires integer constant between 101 and 65535 inclusive}}
+ // expected-error at -2 {{requested 'init_priority' 100 is reserved for internal use}}
// unknown-warning at -3 {{unknown attribute 'init_priority' ignored}}
#endif
-Two boo[2] __attribute__((init_priority(65536)));
-#if !defined(SYSTEM)
- // expected-error at -2 {{'init_priority' attribute requires integer constant between 101 and 65535 inclusive}}
- // unknown-warning at -3 {{unknown attribute 'init_priority' ignored}}
-#endif
+Two zoo[2] __attribute__((init_priority(-1))); // expected-error {{'init_priority' attribute requires integer constant between 0 and 65535 inclusive}}
+// unknown-warning at -1 {{unknown attribute 'init_priority' ignored}}
+
+Two boo[2] __attribute__((init_priority(65536))); // expected-error {{'init_priority' attribute requires integer constant between 0 and 65535 inclusive}}
----------------
shafik wrote:
Can we also test `65535` which should be valid, just for completeness sake.
https://github.com/llvm/llvm-project/pull/121577
More information about the cfe-commits
mailing list