AaronBallman wrote: > Another aspect is that we don't even build with -Wlifetime-safety enabled, > and this attribute (via third-party code or otherwise) is all gated behind > __has_cpp_attribute, so why should we be hit by this?
Because `__has_cpp_attribute` returns `true` because the implementation knows about the attributes. And because of that, the macros will expand to use the attributes, which means you *are* using them regardless of whether you pass `-Wlifetime-safety` or not. But yeah, I can see how that's a bit odd -- if the attributes are removed in a future version of Clang, `__has_cpp_attribute` will report false and so you'll avoid the unknown attribute warnings anyway. > Maybe these attributes should not be available when the feature is off? That > would at least limit the impact of these changes to those who actually use > the extension. Perhaps that would be useful to the developers of this feature > as well, as they could then explore the design space of the extension a bit > more freely. That's a design worth exploring but I don't know of any other attribute that works that way, so we have to think through the implications carefully. The feature test macros have never been intended to tell you that you can use the feature *without diagnostics* and that's effectively what you're aiming for here. e.g., we've had people who have expected (extension) feature test macros to report `false` if `-pedantic-errors` is passed because they get pedantic error diagnostics from using the extension despite explicitly requesting pedantic error diagnostics when using extensions. https://github.com/llvm/llvm-project/pull/196635 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
