[clang] [clang] Fix `gnu::init_priority` attribute handling for reserved values (PR #121577)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 27 06:50:28 PST 2025


================
@@ -3324,6 +3324,9 @@ def err_attribute_argument_out_of_range : Error<
 def err_init_priority_object_attr : Error<
   "can only use 'init_priority' attribute on file-scope definitions "
   "of objects of class type">;
+def warn_init_priority_reserved : Warning<
----------------
AaronBallman wrote:

Sorry, my fault for being unclear! :-)

There are three attributes which all take a "priority" value with a reserved range: `init_priority`, `constructor`, and `destructor`. Currently, `init_priority` diagnoses use of reserved values, while `constructor` and `destructor` do not. I was wondering if we should make them consistent.

However, I don't think that needs to be done in this patch (or something you need to do in a follow-up); I didn't realize they were *already* inconsistent today.

https://github.com/llvm/llvm-project/pull/121577


More information about the cfe-commits mailing list