]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix some missing/incorrect feature test macros
authorJonathan Wakely <jwakely@redhat.com>
Thu, 23 Apr 2020 15:56:01 +0000 (16:56 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 23 Apr 2020 17:54:18 +0000 (18:54 +0100)
Backport from mainline
2019-10-30  Jonathan Wakely  <jwakely@redhat.com>

* include/std/bit (__cpp_lib_bitops): Define.
* include/std/version (__cpp_lib_constexpr): Remove.
(__cpp_lib_bitops): Define.
* testsuite/26_numerics/bit/header.cc: New test.
* testsuite/26_numerics/bit/header-2.cc: New test.

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/bit
libstdc++-v3/include/std/version
libstdc++-v3/testsuite/26_numerics/bit/header-2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/bit/header.cc [new file with mode: 0644]

index a5d92e5ae2160710888605c770ba0395dad20cd1..fe2040a20c2b7ff1098ea68fe758016b73a214fb 100644 (file)
@@ -1,5 +1,13 @@
 2020-04-23  Jonathan Wakely  <jwakely@redhat.com>
 
+       Backport from mainline
+       2019-10-30  Jonathan Wakely  <jwakely@redhat.com>
+
+       * include/std/bit (__cpp_lib_bitops): Define.
+       * include/std/version (__cpp_lib_bitops): Define.
+       * testsuite/26_numerics/bit/header.cc: New test.
+       * testsuite/26_numerics/bit/header-2.cc: New test.
+
        Backport from mainline
        2020-02-19  Jonathan Wakely  <jwakely@redhat.com>
 
index c753e39b64a1c005b35e51049fa00d1f9fe4adda..7d5e575722c4fbd33c8286bc3e6d39da7f727304 100644 (file)
@@ -250,6 +250,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cplusplus > 201703L
 
+#define __cpp_lib_bitops 201907L
+
   template<typename _Tp, typename _Up, bool = is_integral_v<_Tp>>
     struct _If_is_unsigned_integer_type { };
 
index 39b49371370a28438c0c9e65caf3e6932b8ad0ae..a61fe086240891171bb2879acb401eaf61fe03f5 100644 (file)
 # define __cpp_lib_has_unique_object_representations 201606
 #endif
 #define __cpp_lib_hypot 201603
-#define __cpp_lib_invoke 201411
+#define __cpp_lib_invoke 201411L
 #ifdef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE
 # define __cpp_lib_is_aggregate 201703
 #endif
 #if __cplusplus > 201703L
 // c++2a
 #define __cpp_lib_bind_front 201907L
+#define __cpp_lib_bitops 201907L
 #define __cpp_lib_bounded_array_traits 201902L
 #if __cpp_impl_destroying_delete
 # define __cpp_lib_destroying_delete 201806L
diff --git a/libstdc++-v3/testsuite/26_numerics/bit/header-2.cc b/libstdc++-v3/testsuite/26_numerics/bit/header-2.cc
new file mode 100644 (file)
index 0000000..f67a1cd
--- /dev/null
@@ -0,0 +1,27 @@
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <version>
+
+#ifndef __cpp_lib_bitops
+# error "Feature test macro for bitops is missing in <version>"
+#elif __cpp_lib_bitops < 201907L
+# error "Feature test macro for bitops has wrong value in <version>"
+#endif
diff --git a/libstdc++-v3/testsuite/26_numerics/bit/header.cc b/libstdc++-v3/testsuite/26_numerics/bit/header.cc
new file mode 100644 (file)
index 0000000..824ee00
--- /dev/null
@@ -0,0 +1,27 @@
+// Copyright (C) 2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <bit>
+
+#ifndef __cpp_lib_bitops
+# error "Feature test macro for bitops is missing in <bit>"
+#elif __cpp_lib_bitops < 201907L
+# error "Feature test macro for bitops has wrong value in <bit>"
+#endif