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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 17 05:47:31 PST 2025


AaronBallman wrote:

> While this is a valid concern, I don't think it's much of a problem in reality. GCC just warns on this (not even an error by default) and I wasn't able to find a single use outside implementations of the reserved value range.

I wouldn't expect to find uses within the reserved value range except in system headers given that we have an error.

> For that reason I don't think we should make life unnecessarily hard for implementations. Using line markers is a huge burden, since they are anything but readable, people don't know what they are, and they are really easy to get wrong when modifying code, since you have to hard-code the line number. When you have a warning that's by default an error I don't see many people disabling that to stomp on implementers' toes.

I disagree. There's no value to a reserved range that's not actually reserved. You can use GNU line markers, but if you find those distasteful (which is reasonable), there's also `#pragma GCC system_header` as well.

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


More information about the cfe-commits mailing list