[clang] [clang][PAC] ptrauth_qualifier must be considered a feature (PR #153291)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 13 15:43:30 PDT 2025


ojhunt wrote:

> > No, ptrauth is not a feature, it is an extension and should be reported as such. The real bug here is that you're missing an extension warning when `__ptrauth` is used
> 
> I thought our general policy was that we don't trigger pedantic warnings for reserved keywords (like anything with a `__` prefix)?

the problem is that `__has_extension` simply reports false on anything marked as an extension, so feature checks performed via `__has_extension` stop working.

The more I think about this the more weird the behavior is - you can still use the extensions (I think you can simply suppress the warnings for the cases where extensions do actually produce them), you just can't check for them :-/

An alternative approach - that would require significant code updates - would be to blast down a pile of implicit macros for all the current feature tests, which would at least provide a non-`__has_extension` based approach for testing. Obviously this will require a pile of work and testing and basically end up with a lot of `__has_feature(...) || defined(feature macro)` but that would resolve the `__has_extension` problem.

Failing that we could add a flag to the internal extension model so that some extensions will return the correct value even if -pedantic-errors is set.

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


More information about the cfe-commits mailing list