summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2017-10-20 18:02:19 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2017-10-20 18:02:19 +0000
commit65853df112401300135efd650db5dc0ead05a56d (patch)
tree52ac69dd374b7eaaa3a9115c5083d58842332b1f
parent4f0935fa35dc87ca9105ed6b6a595d2673e240d9 (diff)
downloadgcc-65853df112401300135efd650db5dc0ead05a56d.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253952 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/c_global/cstddef4
-rw-r--r--libstdc++-v3/testsuite/18_support/byte/requirements.cc6
3 files changed, 14 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index ba43a4b3708..179361d9223 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2017-10-20 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/c_global/cstddef: Define __cpp_lib_byte feature-test macro.
+ * testsuite/18_support/byte/requirements.cc: Check macro.
+
2017-10-19 Jonathan Wakely <jwakely@redhat.com>
* testsuite/experimental/filesystem/iterators/
diff --git a/libstdc++-v3/include/c_global/cstddef b/libstdc++-v3/include/c_global/cstddef
index 09754ee45da..11d268b7f81 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 4cb05df0405..74c8b64d6ce 100644
--- a/libstdc++-v3/testsuite/18_support/byte/requirements.cc
+++ b/libstdc++-v3/testsuite/18_support/byte/requirements.cc
@@ -20,6 +20,12 @@
#include <cstddef>
+#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) );