From 253e8d21509d7685ce9d515061305cdf604cc005 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 20 Oct 2017 19:02:19 +0100 Subject: [PATCH] Define __cpp_lib_byte feature-test macro * include/c_global/cstddef: Define __cpp_lib_byte feature-test macro. * testsuite/18_support/byte/requirements.cc: Check macro. From-SVN: r253952 --- libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/include/c_global/cstddef | 4 +++- libstdc++-v3/testsuite/18_support/byte/requirements.cc | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ba43a4b..179361d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2017-10-20 Jonathan Wakely + + * include/c_global/cstddef: Define __cpp_lib_byte feature-test macro. + * testsuite/18_support/byte/requirements.cc: Check macro. + 2017-10-19 Jonathan Wakely * testsuite/experimental/filesystem/iterators/ diff --git a/libstdc++-v3/include/c_global/cstddef b/libstdc++-v3/include/c_global/cstddef index 09754ee..11d268b 100644 --- a/libstdc++-v3/include/c_global/cstddef +++ b/libstdc++-v3/include/c_global/cstddef @@ -57,9 +57,11 @@ namespace std } #endif -#if __cplusplus > 201402L +#if __cplusplus >= 201703L namespace std { +#define __cpp_lib_byte 201603 + /// std::byte enum class byte : unsigned char {}; diff --git a/libstdc++-v3/testsuite/18_support/byte/requirements.cc b/libstdc++-v3/testsuite/18_support/byte/requirements.cc index 4cb05df..74c8b64 100644 --- a/libstdc++-v3/testsuite/18_support/byte/requirements.cc +++ b/libstdc++-v3/testsuite/18_support/byte/requirements.cc @@ -20,6 +20,12 @@ #include +#ifndef __cpp_lib_byte +# error "Feature-test macro for byte missing" +#elif __cpp_lib_byte != 201603 +# error "Feature-test macro for byte has wrong value" +#endif + static_assert( sizeof(std::byte) == sizeof(unsigned char) ); static_assert( alignof(std::byte) == alignof(unsigned char) ); -- 2.7.4