https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86934

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #0)
> The current <version> header doesn't account for the fact that many features
> are not defined for freestanding builds.
> 
> Also, the --enable-libstdcxx-filesystem-ts configure option means that
> <filesystem> isn't always present, even for hsoted builds (but that should
> change for GCC 9 anyway).

That was PR 86756 and is fixed now.

> I'm not sure how to do this cleanly so that <version> is always consistent
> with the real values in other headers. We could generate <version> from a
> script that processes the headers (separately for freestanding and hosted
> headers) and just extracts the __cpp_lib_* macros and the preprocessor
> conditions they depend on.

Or maybe just a script that generates the file from input like:

filesystem 201703 c++17
launder 201606 c++17 _GLIBCXX_HAVE_BUILTIN_LAUNDER
shared_timed_mutex 201402 c++14 _GLIBCXX_HAS_GTHREADS



> Also, in https://gcc.gnu.org/ml/libstdc++/2018-07/msg00128.html I said:
> 
>   It would be nice if we had tests to check that every macro in
>   <version> matches the other definition of it (i.e. either both are
>   defined to the same value, or neither is defined).

That should be simple, just include <bits/stdc++.h> and <version> and compile
with -Wsystem-headers to check for redefinition warnings.

Reply via email to