Page MenuHomePhabricator

[CMake] Remove CLANG_DEFAULT_STD_C/CLANG_DEFAULT_STD_CXX
ClosedPublic

Authored by MaskRay on Sep 6 2022, 1:29 PM.

Details

Summary

When Clang is used as a cross compiler, it should respect the target
platform default. Defaulting to a configure-time CLANG_DEFAULT_STD_C/CLANG_DEFAULT_STD_CXX
does not make much sense.

When Clang is used as a single-platform compiler, we should use Clang
configuration file (https://discourse.llvm.org/t/configuration-files/42529
https://clang.llvm.org/docs/UsersManual.html#configuration-files).

The Gentoo needs from D34365 has been satisfied by a configuration file.

Diff Detail

Event Timeline

MaskRay created this revision.Sep 6 2022, 1:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 6 2022, 1:29 PM
Herald added a subscriber: StephenFan. · View Herald Transcript
MaskRay requested review of this revision.Sep 6 2022, 1:29 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptSep 6 2022, 1:29 PM

So the basic idea here is that the default can be specified by a configuration file and thus we don't need any configure-time variable for it? But then why do we need other configuration macros like default stdlib or default linker? Mostly trying to understand what the rule of thumb is for when something should be a configure macro and when something should be left to a configuration file instead.

thesamesam added a comment.EditedSep 13 2022, 2:48 PM

So the basic idea here is that the default can be specified by a configuration file and thus we don't need any configure-time variable for it? But then why do we need other configuration macros like default stdlib or default linker? Mostly trying to understand what the rule of thumb is for when something should be a configure macro and when something should be left to a configuration file instead.

Also, until https://reviews.llvm.org/D109621 or similar is resolved, I don't feel like the actual need mentioned in the original change above is addressed. Forcing distributions to use a prefixed Clang binary feels like a workaround for this deficiency?

My objection based on config support is no longer relevant, as it's been solved.

mgorny added inline comments.Oct 14 2022, 10:40 AM
clang/test/Preprocessor/lang-std.cpp
1

I suppose you want to remove the lit.cfg.py counterpart of this as well.

MaskRay updated this revision to Diff 467840.Oct 14 2022, 10:57 AM
MaskRay marked an inline comment as done.
MaskRay edited the summary of this revision. (Show Details)

remove lit feature default_std_cxx

I think some other CLANG_DEFAULT_* probably should go away as well,
but we can start with STD_C STD_CXX (where there is little value for Clang to provide the configure-time customization) first.

mgorny accepted this revision.Oct 14 2022, 11:26 PM

Thanks for doing this. For the record, Gentoo didn't need to use this for a long time now, so there's no backwards compatibility concern here.

This revision is now accepted and ready to land.Oct 14 2022, 11:26 PM
This revision was landed with ongoing or failed builds.Oct 16 2022, 1:15 PM
This revision was automatically updated to reflect the committed changes.
tambre added a subscriber: tambre.Wed, Jan 25, 1:03 AM

A Clang 16 release note for this would be nice. I didn't immediately notice and got a bit broken by this change. 🙂

aaron.ballman added a reviewer: Restricted Project.Wed, Jan 25, 4:50 AM

A Clang 16 release note for this would be nice. I didn't immediately notice and got a bit broken by this change. 🙂

+1 to the request, also adding clang vendors now for early warning despite this already being landed.