This is an archive of the discontinued LLVM Phabricator instance.

Document the Clang policies on claiming support for a feature
ClosedPublic

Authored by aaron.ballman on Mar 20 2023, 7:10 AM.

Details

Summary

We do not currently have this written down anywhere, and as a result, we're sometimes inconsistent with how we handle feature test macros and the feature status pages. This is an attempt to document what I understand our existing policies to be instead of defining a new policy.

Note, this is being added to the Clang internals manual because we don't have a separate document for Clang developer policies. At some point, I think we may want a standalone document for that, and this content can be moved there at that time.

Diff Detail

Event Timeline

aaron.ballman created this revision.Mar 20 2023, 7:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 20 2023, 7:10 AM
aaron.ballman requested review of this revision.Mar 20 2023, 7:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 20 2023, 7:10 AM
erichkeane added inline comments.
clang/docs/InternalsManual.rst
3276

Phab won't let me suggest it, but instead of __cpp_decltype (which to my mind, suggested it was a function-style FTM?), I might suggest something like __cpp_lambdas.

3289

you -> we? Rest of the doc is in 3rd person, this is in 2nd?

cor3ntin added inline comments.
clang/docs/InternalsManual.rst
3285

any way to rephrase that, "that cause clamg to reject" maybe?

3292

Is that desirable?
If i have a build system checking for support through feature macros, I'm not sure they do that on a target per target basis.

3294–3299

+1 :)

3300–3306

The status reported by a feature test macro should always be reflected in the
language support page for the coresponding feature

such as claiming partial

(i can't suggest edits, for some reason?)

aaron.ballman marked 5 inline comments as done.Mar 20 2023, 7:59 AM
aaron.ballman added inline comments.
clang/docs/InternalsManual.rst
3285

Sure, we can go with "accept invalid code" instead of "fail to reject invalid".

3289

Reworded to remove the pronoun entirely.

3292

Maybe it's not desirable, I'm happy to hear arguments either way. The reason why I think this is reasonable is because we'll sometimes have a feature that works just fine everywhere EXCEPT a target (like coroutines work everywhere but have known miscompilation issues on 32-bit Windows). It seems somewhat unfortunate to not claim support anywhere because it's not supported on all targets -- some users likely never target 32-bit Windows in the first place.

aaron.ballman marked 2 inline comments as done.

Updating based on review feedback.

(Note: Phab seems to be confused about the changes being at the end of the file -- it claims there's no trailing context for the patch and that's what seems to disable the ability to make suggested edits.)

cor3ntin added inline comments.Mar 20 2023, 9:23 AM
clang/docs/InternalsManual.rst
3285

is the issue the thing that accepts the code? that's what bugs me

aaron.ballman added inline comments.Mar 20 2023, 9:26 AM
clang/docs/InternalsManual.rst
3285

I'm trying to list out two problems separately: the first is when we reject code that we should be accepting, and the second is when we accept code that we should be rejecting. I think I see where your confusion is coming from, how about:

* Are there known issues where we reject valid code that should be accepted?
* Are there known issues where we accept invalid code that should be rejected?
cor3ntin added inline comments.Mar 20 2023, 9:28 AM
clang/docs/InternalsManual.rst
3285

that sounds good to me!

aaron.ballman marked 2 inline comments as done.

Update based on review feedback.

Fixing a typo pointed out off-list (missed an "as").

cor3ntin accepted this revision.Mar 25 2023, 5:30 AM

LGTM. I have some minor reservations about defining feature macros on a per-target basis but at the same time, given the current coroutines on 32 bits windows situation - which has been lingering - I'm not sure i can come up with a more sensible alternative

This revision is now accepted and ready to land.Mar 25 2023, 5:30 AM
erichkeane accepted this revision.Mar 27 2023, 6:27 AM
This revision was landed with ongoing or failed builds.Mar 27 2023, 6:58 AM
This revision was automatically updated to reflect the committed changes.