[libcxx] r285382 - Add __libcpp_version file and __libcpp_library_version function.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 31 14:23:40 PDT 2016


On Mon, Oct 31, 2016 at 2:01 PM, Joerg Sonnenberger via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> On Mon, Oct 31, 2016 at 01:25:19PM -0700, Richard Smith wrote:
> > We could alternatively control the language features based only on the
> > selected language mode, and only use version detection to power a warning
> > for the (currently fairly common, but becoming less so) case where the
> > selected runtime library isn't new enough to implement the requested
> > features. That would cause a bunch of scenarios to break when upgrading
> to
> > clang 4.0, but at least the fix would be pretty clear.
>
> Let's split this slightly. Ultimately, we need to have codegen flags to
> control individual features that require support from the ABI
> implementation or even just from the STL implementation. I can think of
> three different ways to provide the default values:
> (1) Language mode selection
> (2) Driver logic based on the target
> (3) Source controls like #pragma

The third option would serve mostly the same purpose as feature
> detection based on some magic __version file, but it also would allow
> non-libc++ implementations or -nostdinc use cases to get the same
> behavior.


We need to make this decision in source files without #includes, and the
decision may affect entities we implicitly declare at the start of the
program, so I'm not entirely convinced that it's feasible to base the
default on the contents of the source code we actually process.

[With the previous strategy, for non-libc++, non-libstdc++ implementations,
you would be able to use the -f flags to explicitly specify what your
standard library supports (and it's probably reasonable to assume that it
fully supports the language specified by -std, by default); for -nostdinc,
you could use -stdlib=libc++-4.0 to explicitly specify the version.]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161031/1185f264/attachment.html>


More information about the cfe-commits mailing list