Don't unconditionally define feature test macros in <version>
The macro definitions in <version> should depend on the same preprocessor conditions as the original macros in other headers. Otherwise <version> can define macros that imply the availability of features that are not actually defined. This fix is incomplete, as __cpp_lib_filesystem should depend on whether libstdc++fs.a is supported, and several macros should only be defined when _GLIBCXX_HOSTED is defined. Also, the feature test macros should define their value as type long, but most are type int. * include/bits/c++config (_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP) (_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE): Move definitions here. (_GLIBCXX_HAVE_BUILTIN_LAUNDER): Likewise. Use !__is_identifier instead of __has_builtin. * include/std/type_traits (_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP) (_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE): Remove definitions from here. * include/std/version [!_GLIBCXX_HAS_GTHREADS] (__cpp_lib_shared_timed_mutex, __cpp_lib_scoped_lock) (__cpp_lib_shared_mutex): Don't define when Gthreads not in use. [!_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP] (__cpp_lib_has_unique_object_representations): Don't define when builtin not available. [!_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE] (__cpp_lib_is_aggregate): Likewise. [!_GLIBCXX_HAVE_BUILTIN_LAUNDER] (__cpp_lib_launder): Likewise. * libsupc++/new (_GLIBCXX_HAVE_BUILTIN_LAUNDER): Remove definition from here. From-SVN: r263184
Showing
Please
register
or
sign in
to comment