-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Basic: Update the rule for whether to use FEATURE or EXTENSION. #153104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic: Update the rule for whether to use FEATURE or EXTENSION. #153104
Conversation
Created using spr 1.3.6-beta.1
@llvm/pr-subscribers-clang Author: Peter Collingbourne (pcc) ChangesIt was discovered that EXTENSION has some unexpected implications for Full diff: https://github.com/llvm/llvm-project/pull/153104.diff 1 Files Affected:
diff --git a/clang/include/clang/Basic/Features.def b/clang/include/clang/Basic/Features.def
index c58e3f2400adc..94d5432f5fb3d 100644
--- a/clang/include/clang/Basic/Features.def
+++ b/clang/include/clang/Basic/Features.def
@@ -18,9 +18,10 @@
// extension will be made available.
//
// FEATURE(...) should be used to advertise support for standard language
-// features, whereas EXTENSION(...) should be used for clang extensions. Note
-// that many of the identifiers in this file don't follow this rule for backward
-// compatibility reasons.
+// features or ABI-affecting clang extensions, whereas EXTENSION(...) should be
+// used for clang extensions which do not affect ABI. Note that many of the
+// identifiers in this file don't follow this rule for backward compatibility
+// reasons.
//
//===----------------------------------------------------------------------===//
|
Other possibilities:
|
I'm not super excited about this, but I'd like to understand more about what problem needs solving because this has some significant impacts on user-facing It took years for us to get to the point where extensions were being listed as |
Here's the problem that I was solving. I wanted to opt-in certain libc++ types to pointer field protection (PFP) by making them non-standard-layout. This was part of #151652 and I later wrote an RFC for my proposal. So I had something like this:
The problem was that We're also considering other possibilities for how to opt structs into PFP; it may be possible to avoid relying on The same problem seems to affect
|
@AaronBallman Oh, that's a real problem with the conversion from |
This change seems reasonable to me - the existing silently semantic changes incurred by the I'm going to r+ this, but I do want @AaronBallman to approve as well before making this change. |
IMO, that's not an issue with So maybe we want to clarify the internal and external documentation more along those lines? And then PFP can use
That's a similar ODR violation, but they also have a bug;
|
Obviously more details in the other PRs for making the ptrauth_qualifier a feature or disabling -pedantic-errors when pointer auth is enabled: the problem here is that I would argue that the bigger issue is this behavior from The follow on problem here is that |
Per discussion with @ojhunt and @AaronBallman we are moving towards predefined macros and away from __has_feature and __has_extension for detecting sanitizers and other similar features. The rationale is that __has_feature is only really meant for standardized features (see the comment at the top of clang/include/clang/Basic/Features.def), and __has_extension has the issues discovered as part of #153104. Let's start by defining macros for ASan, HWASan and TSan, consistently with gcc. Reviewers: vitalybuka, ojhunt, AaronBallman, fmayer Reviewed By: fmayer, vitalybuka Pull Request: #153888
After the latest discussions, I think this PR can be closed? |
Yes, I've closed it. |
It was discovered that EXTENSION has some unexpected implications for
ABI-affecting extensions due to being influenced by warning flags,
so update the rule to allow ABI-affecting extensions to be FEATUREs.