diff mbox series

PR libstdc++/79433 no #error for including headers with wrong -std

Message ID 20170907141838.GC4582@redhat.com
State New
Headers show
Series PR libstdc++/79433 no #error for including headers with wrong -std | expand

Commit Message

Jonathan Wakely Sept. 7, 2017, 2:18 p.m. UTC
As discussed in PR 79433, the recommended way to test for new features
such as std::optional has problems. The current version of SD-6 at
https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
says to simply check __has_include(optional). This test will be true
even when using -std=c++98, but actually including the header gives an
error. This works OK for ahead-of-time autoconf-style checks, but not
for preprocessor-based checks directly in the source code.

The latest draft of SD-6 (to be published soon) changes the
recommendation to use __has_include, then include the header and also
check for a feature-test macro e.g.

#ifdef __has_include
# if __has_include(optional)
#  include <optional>
#  if __cpp_lib_optional >= 201606
#   define HAVE_STD_OPTIONAL
#  endif
# endif
#endif

For this to work we need to make including <optional> always valid
(even in C++{98,03,11,14} modes) instead of failing with #error. When
included pre-C++17 the header should be empty, and specifically not
define the __cpp_lib_optional macro.

This implements that change. The <shared_mutex> header is also
affected for C++14, as that defines std::shared_timed_mutex in C++14
mode, and adds std::shared_mutex in C++17 mode.

With this change nothing else includes c++17_warning.h so we can
remove it.

In a follow-up patch I plan to do the same for the <experimental/*>
headers. The TS documents already give a macro for every header, and
LibFundTS suggests testing both __has_include and a macro, see ¶3 at
https://rawgit.com/cplusplus/fundamentals-ts/v2/fundamentals-ts.html#general.feature.test

I'm not touching any of the headers added for C++11 (<forward_list>
etc.) because I think any user code that is relying on __has_include
will be using a std::lib with full C++11 support anyway.

Does anybody object to this change? Is getting a #error still useful,
given the existence of __has_include and __cpp_lib macros?
commit 34cc5bcef2b37ab0a6795c49346acecea3776dac
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Sep 6 21:20:04 2017 +0100

    PR libstdc++/79433 no #error for including headers with wrong -std
    
            PR libstdc++/79433
            * doc/xml/manual/status_cxx2017.xml: Update feature-test macros.
            * doc/html/*: Regenerate.
            * include/Makefile.am: Remove <bits/c++17_warning.h>.
            * include/Makefile.in: Regenerate.
            * include/bits/c++17_warning.h: Remove.
            * include/bits/string_view.tcc: Do not include <bits/c++17_warning.h>
            for pre-C++17 modes.
            * include/std/any: Likewise.
            (__cpp_lib_any): Define.
            * include/std/mutex (__cpp_lib_scoped_lock): Adjust value as per new
            SD-6 draft.
            * include/std/numeric (__cpp_lib_gcd_lcm): Define as per new SD-6
            draft.
            * include/std/optional: Do not include <bits/c++17_warning.h>.
            (__cpp_lib_optional): Define.
            * include/std/shared_mutex: Do not include <bits/c++14_warning.h>.
            * include/std/string_view: Do not include <bits/c++17_warning.h>.
            (__cpp_lib_string_view): Define.
            * include/std/variant: Do not include <bits/c++17_warning.h>.
            (__cpp_lib_variant): Define.
            * testsuite/20_util/optional/cons/value_neg.cc: Adjust dg-error line
            numbers.
            * testsuite/26_numerics/gcd/1.cc: Test for __cpp_lib_gcd_lcm.
            * testsuite/26_numerics/gcd/gcd_neg.cc: Adjust dg-error line
            numbers.
            * testsuite/26_numerics/lcm/1.cc: Test for __cpp_lib_gcd_lcm.
            * testsuite/26_numerics/lcm/lcm_neg.cc: Adjust dg-error line
            numbers.
            * testsuite/30_threads/scoped_lock/requirements/typedefs.cc: Adjust
            expected value of __cpp_lib_scoped_lock.

Comments

Ville Voutilainen Sept. 7, 2017, 2:44 p.m. UTC | #1
On 7 September 2017 at 17:18, Jonathan Wakely <jwakely@redhat.com> wrote:
> Does anybody object to this change? Is getting a #error still useful,
> given the existence of __has_include and __cpp_lib macros?

I wholeheartedly agree with this change. And I should point out that
vast amounts of optional's implementation
are my handiwork, and that I consider myself the maintainer of
optional, even though I don't
officially have such status. ;)
Jonathan Wakely Sept. 12, 2017, 2:07 p.m. UTC | #2
On 07/09/17 15:18 +0100, Jonathan Wakely wrote:
>As discussed in PR 79433, the recommended way to test for new features
>such as std::optional has problems. The current version of SD-6 at
>https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
>says to simply check __has_include(optional). This test will be true
>even when using -std=c++98, but actually including the header gives an
>error. This works OK for ahead-of-time autoconf-style checks, but not
>for preprocessor-based checks directly in the source code.
>
>The latest draft of SD-6 (to be published soon) changes the
>recommendation to use __has_include, then include the header and also
>check for a feature-test macro e.g.
>
>#ifdef __has_include
># if __has_include(optional)
>#  include <optional>
>#  if __cpp_lib_optional >= 201606
>#   define HAVE_STD_OPTIONAL
>#  endif
># endif
>#endif
>
>For this to work we need to make including <optional> always valid
>(even in C++{98,03,11,14} modes) instead of failing with #error. When
>included pre-C++17 the header should be empty, and specifically not
>define the __cpp_lib_optional macro.
>
>This implements that change. The <shared_mutex> header is also
>affected for C++14, as that defines std::shared_timed_mutex in C++14
>mode, and adds std::shared_mutex in C++17 mode.
>
>With this change nothing else includes c++17_warning.h so we can
>remove it.

I've committed that change to trunk now.

>In a follow-up patch I plan to do the same for the <experimental/*>
>headers. The TS documents already give a macro for every header, and
>LibFundTS suggests testing both __has_include and a macro, see ¶3 at
>https://rawgit.com/cplusplus/fundamentals-ts/v2/fundamentals-ts.html#general.feature.test

And here's the follow-up for the TS headers, also committed to trunk.
commit 5563d1e2214a32e3fe07a56fa49ad5a75b20c8ba
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Sep 7 18:20:25 2017 +0100

    PR libstdc++/79433 no #error for including TS headers with wrong -std
    
            PR libstdc++/79433
            * include/Makefile.am: Remove <bits/c++14_warning.h>.
            * include/Makefile.in: Regenerate.
            * include/bits/c++14_warning.h: Remove.
            * include/experimental/algorithm: Do not include <c++14_warning.h>.
            * include/experimental/any: Likewise.
            * include/experimental/array: Likewise.
            * include/experimental/bits/erase_if.h: Likewise.
            * include/experimental/bits/lfts_config.h: Likewise.
            * include/experimental/bits/shared_ptr.h: Likewise.
            * include/experimental/bits/string_view.tcc: Likewise.
            * include/experimental/chrono: Likewise.
            * include/experimental/deque: Likewise.
            * include/experimental/filesystem: Do not include <c++0x_warning.h>.
            * include/experimental/forward_list: Do not include <c++14_warning.h>.
            * include/experimental/functional: Likewise.
            * include/experimental/iterator: Likewise.
            * include/experimental/list: Likewise.
            * include/experimental/map: Likewise.
            * include/experimental/memory: Likewise.
            * include/experimental/numeric: Likewise.
            * include/experimental/optional: Likewise.
            * include/experimental/propagate_const: Likewise.
            * include/experimental/ratio: Likewise.
            * include/experimental/regex: Likewise.
            * include/experimental/set: Likewise.
            * include/experimental/string: Likewise.
            * include/experimental/string_view: Likewise.
            * include/experimental/system_error: Likewise.
            * include/experimental/tuple: Likewise.
            * include/experimental/type_traits: Likewise.
            * include/experimental/unordered_map: Likewise.
            * include/experimental/unordered_set: Likewise.
            * include/experimental/vector: Likewise.
            * testsuite/experimental/any/misc/any_cast_neg.cc: Adjust dg-error
            line number.
            * testsuite/experimental/array/neg.cc: Likewise.
            * testsuite/experimental/propagate_const/assignment/move_neg.cc:
            Likewise.
            * testsuite/experimental/propagate_const/cons/move_neg.cc: Likewise.
            * testsuite/experimental/propagate_const/requirements2.cc: Likewise.
            * testsuite/experimental/propagate_const/requirements3.cc: Likewise.
            * testsuite/experimental/propagate_const/requirements4.cc: Likewise.
            * testsuite/experimental/propagate_const/requirements5.cc: Likewise.

diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 6395f1e6ae0..87a41f59027 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -95,7 +95,6 @@ bits_headers = \
 	${bits_srcdir}/basic_string.tcc \
 	${bits_srcdir}/boost_concept_check.h \
 	${bits_srcdir}/c++0x_warning.h \
-	${bits_srcdir}/c++14_warning.h \
 	${bits_srcdir}/char_traits.h \
 	${bits_srcdir}/codecvt.h \
 	${bits_srcdir}/concept_check.h \
diff --git a/libstdc++-v3/include/bits/c++14_warning.h b/libstdc++-v3/include/bits/c++14_warning.h
deleted file mode 100644
index 5ead9c6b122..00000000000
--- a/libstdc++-v3/include/bits/c++14_warning.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (C) 2013-2017 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/c++14_warning.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{iosfwd}
- */
-
-#ifndef _CXX14_WARNING_H
-#define _CXX14_WARNING_H 1
-
-#if __cplusplus <= 201103L
-#error This file requires compiler and library support \
-for the ISO C++ 2014 standard. This support must be enabled \
-with the -std=c++14 or -std=gnu++14 compiler options.
-#endif
-
-#endif
diff --git a/libstdc++-v3/include/experimental/algorithm b/libstdc++-v3/include/experimental/algorithm
index 15391b1e9f2..4c3ff0c8459 100644
--- a/libstdc++-v3/include/experimental/algorithm
+++ b/libstdc++-v3/include/experimental/algorithm
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <algorithm>
 #include <experimental/bits/lfts_config.h>
diff --git a/libstdc++-v3/include/experimental/any b/libstdc++-v3/include/experimental/any
index 984306dfce8..cdf7db33d5b 100644
--- a/libstdc++-v3/include/experimental/any
+++ b/libstdc++-v3/include/experimental/any
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <typeinfo>
 #include <new>
diff --git a/libstdc++-v3/include/experimental/array b/libstdc++-v3/include/experimental/array
index 9d758f7d149..2ceef5d3cfc 100644
--- a/libstdc++-v3/include/experimental/array
+++ b/libstdc++-v3/include/experimental/array
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <array>
 #include <experimental/type_traits>
diff --git a/libstdc++-v3/include/experimental/bits/erase_if.h b/libstdc++-v3/include/experimental/bits/erase_if.h
index cc89ffad900..8ba59fafc2d 100644
--- a/libstdc++-v3/include/experimental/bits/erase_if.h
+++ b/libstdc++-v3/include/experimental/bits/erase_if.h
@@ -32,9 +32,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 #include <experimental/bits/lfts_config.h>
 
 namespace std
diff --git a/libstdc++-v3/include/experimental/bits/lfts_config.h b/libstdc++-v3/include/experimental/bits/lfts_config.h
index 3b832706da0..58cabea2162 100644
--- a/libstdc++-v3/include/experimental/bits/lfts_config.h
+++ b/libstdc++-v3/include/experimental/bits/lfts_config.h
@@ -27,9 +27,7 @@
  *  Do not attempt to use it directly.
  */
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 #include <bits/c++config.h>
 
 #if _GLIBCXX_INLINE_VERSION
diff --git a/libstdc++-v3/include/experimental/bits/shared_ptr.h b/libstdc++-v3/include/experimental/bits/shared_ptr.h
index ef391eb641f..8f21ad8b4e5 100644
--- a/libstdc++-v3/include/experimental/bits/shared_ptr.h
+++ b/libstdc++-v3/include/experimental/bits/shared_ptr.h
@@ -32,9 +32,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <memory>
 #include <experimental/type_traits>
diff --git a/libstdc++-v3/include/experimental/bits/string_view.tcc b/libstdc++-v3/include/experimental/bits/string_view.tcc
index 450a43c7876..3a2279cac26 100644
--- a/libstdc++-v3/include/experimental/bits/string_view.tcc
+++ b/libstdc++-v3/include/experimental/bits/string_view.tcc
@@ -36,9 +36,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/experimental/chrono b/libstdc++-v3/include/experimental/chrono
index 71e36d2d86d..ad9ac8879e3 100644
--- a/libstdc++-v3/include/experimental/chrono
+++ b/libstdc++-v3/include/experimental/chrono
@@ -35,9 +35,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <chrono>
 #include <experimental/bits/lfts_config.h>
diff --git a/libstdc++-v3/include/experimental/deque b/libstdc++-v3/include/experimental/deque
index 0180a750883..33cf49eed6e 100644
--- a/libstdc++-v3/include/experimental/deque
+++ b/libstdc++-v3/include/experimental/deque
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <deque>
 #include <algorithm>
diff --git a/libstdc++-v3/include/experimental/filesystem b/libstdc++-v3/include/experimental/filesystem
index 7953c802cd3..f0b19dd2910 100644
--- a/libstdc++-v3/include/experimental/filesystem
+++ b/libstdc++-v3/include/experimental/filesystem
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus < 201103L
-# include <bits/c++0x_warning.h>
-#else
+#if __cplusplus >= 201103L
 
 #include <experimental/bits/fs_fwd.h>
 #include <experimental/bits/fs_path.h>
diff --git a/libstdc++-v3/include/experimental/forward_list b/libstdc++-v3/include/experimental/forward_list
index 5109cb57ade..36638d6226d 100644
--- a/libstdc++-v3/include/experimental/forward_list
+++ b/libstdc++-v3/include/experimental/forward_list
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <forward_list>
 #include <experimental/memory_resource>
diff --git a/libstdc++-v3/include/experimental/functional b/libstdc++-v3/include/experimental/functional
index 3327399b4d4..0cac5cf40fd 100644
--- a/libstdc++-v3/include/experimental/functional
+++ b/libstdc++-v3/include/experimental/functional
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <functional>
 #include <tuple>
diff --git a/libstdc++-v3/include/experimental/iterator b/libstdc++-v3/include/experimental/iterator
index 553009c92b0..78ef387aa10 100644
--- a/libstdc++-v3/include/experimental/iterator
+++ b/libstdc++-v3/include/experimental/iterator
@@ -35,9 +35,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <iterator>
 #include <iosfwd>
diff --git a/libstdc++-v3/include/experimental/list b/libstdc++-v3/include/experimental/list
index 94663ad030a..f429b3d3ce8 100644
--- a/libstdc++-v3/include/experimental/list
+++ b/libstdc++-v3/include/experimental/list
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <list>
 #include <experimental/memory_resource>
diff --git a/libstdc++-v3/include/experimental/map b/libstdc++-v3/include/experimental/map
index 85055967fa5..2c816b7687e 100644
--- a/libstdc++-v3/include/experimental/map
+++ b/libstdc++-v3/include/experimental/map
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <map>
 #include <experimental/bits/erase_if.h>
diff --git a/libstdc++-v3/include/experimental/memory b/libstdc++-v3/include/experimental/memory
index 33a154bf50c..83c3b101c09 100644
--- a/libstdc++-v3/include/experimental/memory
+++ b/libstdc++-v3/include/experimental/memory
@@ -35,9 +35,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <memory>
 #include <type_traits>
diff --git a/libstdc++-v3/include/experimental/numeric b/libstdc++-v3/include/experimental/numeric
index 33e7b55ef90..c8597fce06d 100644
--- a/libstdc++-v3/include/experimental/numeric
+++ b/libstdc++-v3/include/experimental/numeric
@@ -35,9 +35,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <numeric>
 #include <experimental/type_traits>
diff --git a/libstdc++-v3/include/experimental/optional b/libstdc++-v3/include/experimental/optional
index d4c58a600bf..c405bc07d05 100644
--- a/libstdc++-v3/include/experimental/optional
+++ b/libstdc++-v3/include/experimental/optional
@@ -41,9 +41,7 @@
  * between different GCC releases </STRONG> for these features.
  */
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <utility>
 #include <type_traits>
diff --git a/libstdc++-v3/include/experimental/propagate_const b/libstdc++-v3/include/experimental/propagate_const
index 639f21a979e..7cc80cec427 100644
--- a/libstdc++-v3/include/experimental/propagate_const
+++ b/libstdc++-v3/include/experimental/propagate_const
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <type_traits>
 #include <bits/functional_hash.h>
diff --git a/libstdc++-v3/include/experimental/ratio b/libstdc++-v3/include/experimental/ratio
index bc2d0f267b2..179933c8a42 100644
--- a/libstdc++-v3/include/experimental/ratio
+++ b/libstdc++-v3/include/experimental/ratio
@@ -35,9 +35,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <ratio>
 #include <experimental/bits/lfts_config.h>
diff --git a/libstdc++-v3/include/experimental/regex b/libstdc++-v3/include/experimental/regex
index bfcaf6b85c3..15fb1084ad7 100644
--- a/libstdc++-v3/include/experimental/regex
+++ b/libstdc++-v3/include/experimental/regex
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <regex>
 #include <experimental/string>
diff --git a/libstdc++-v3/include/experimental/set b/libstdc++-v3/include/experimental/set
index fba136c90c5..9437966f245 100644
--- a/libstdc++-v3/include/experimental/set
+++ b/libstdc++-v3/include/experimental/set
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <set>
 #include <experimental/bits/erase_if.h>
diff --git a/libstdc++-v3/include/experimental/string b/libstdc++-v3/include/experimental/string
index 893013b1869..d35f108725c 100644
--- a/libstdc++-v3/include/experimental/string
+++ b/libstdc++-v3/include/experimental/string
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <string>
 #include <algorithm>
diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view
index 2e8e7cda62d..f05f152302a 100644
--- a/libstdc++-v3/include/experimental/string_view
+++ b/libstdc++-v3/include/experimental/string_view
@@ -35,9 +35,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <string>
 #include <limits>
diff --git a/libstdc++-v3/include/experimental/system_error b/libstdc++-v3/include/experimental/system_error
index 2bad7503b2f..a694f57c9ca 100644
--- a/libstdc++-v3/include/experimental/system_error
+++ b/libstdc++-v3/include/experimental/system_error
@@ -35,9 +35,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <system_error>
 #include <experimental/bits/lfts_config.h>
diff --git a/libstdc++-v3/include/experimental/tuple b/libstdc++-v3/include/experimental/tuple
index a12fa0a3327..324dc47e795 100644
--- a/libstdc++-v3/include/experimental/tuple
+++ b/libstdc++-v3/include/experimental/tuple
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <tuple>
 #include <bits/invoke.h>
diff --git a/libstdc++-v3/include/experimental/type_traits b/libstdc++-v3/include/experimental/type_traits
index 3885c168e31..f9a5c1dfb0e 100644
--- a/libstdc++-v3/include/experimental/type_traits
+++ b/libstdc++-v3/include/experimental/type_traits
@@ -35,9 +35,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <type_traits>
 #include <experimental/bits/lfts_config.h>
diff --git a/libstdc++-v3/include/experimental/unordered_map b/libstdc++-v3/include/experimental/unordered_map
index cddd5b3d78c..daefb399baf 100644
--- a/libstdc++-v3/include/experimental/unordered_map
+++ b/libstdc++-v3/include/experimental/unordered_map
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <unordered_map>
 #include <experimental/bits/erase_if.h>
diff --git a/libstdc++-v3/include/experimental/unordered_set b/libstdc++-v3/include/experimental/unordered_set
index 816327f9ba7..961aff9037f 100644
--- a/libstdc++-v3/include/experimental/unordered_set
+++ b/libstdc++-v3/include/experimental/unordered_set
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <unordered_set>
 #include <experimental/bits/erase_if.h>
diff --git a/libstdc++-v3/include/experimental/vector b/libstdc++-v3/include/experimental/vector
index e77dd2e4771..48c75fa5310 100644
--- a/libstdc++-v3/include/experimental/vector
+++ b/libstdc++-v3/include/experimental/vector
@@ -31,9 +31,7 @@
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <vector>
 #include <algorithm>
diff --git a/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc b/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc
index 697b0f03e2b..81eda331fc8 100644
--- a/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc
+++ b/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc
@@ -25,5 +25,5 @@ void test01()
   using std::experimental::any_cast;
 
   const any y(1);
-  any_cast<int&>(y); // { dg-error "qualifiers" "" { target { *-*-* } } 359 }
+  any_cast<int&>(y); // { dg-error "qualifiers" "" { target { *-*-* } } 357 }
 }
diff --git a/libstdc++-v3/testsuite/experimental/array/neg.cc b/libstdc++-v3/testsuite/experimental/array/neg.cc
index 3963287f257..e531678122a 100644
--- a/libstdc++-v3/testsuite/experimental/array/neg.cc
+++ b/libstdc++-v3/testsuite/experimental/array/neg.cc
@@ -24,5 +24,5 @@ int main()
 {
   int dummy;
   auto bad = std::experimental::make_array(std::ref(dummy));
-  // { dg-error "explicit target type" "" { target *-*-* } 78 }
+  // { dg-error "explicit target type" "" { target *-*-* } 76 }
 }
diff --git a/libstdc++-v3/testsuite/experimental/propagate_const/assignment/move_neg.cc b/libstdc++-v3/testsuite/experimental/propagate_const/assignment/move_neg.cc
index 040e30b81a2..a0cc0e9f434 100644
--- a/libstdc++-v3/testsuite/experimental/propagate_const/assignment/move_neg.cc
+++ b/libstdc++-v3/testsuite/experimental/propagate_const/assignment/move_neg.cc
@@ -25,7 +25,7 @@
 using std::experimental::propagate_const;
 using std::unique_ptr;
 
-// { dg-error "no type" "" { target *-*-* } 162 }
+// { dg-error "no type" "" { target *-*-* } 160 }
 
 int main()
 {
diff --git a/libstdc++-v3/testsuite/experimental/propagate_const/cons/move_neg.cc b/libstdc++-v3/testsuite/experimental/propagate_const/cons/move_neg.cc
index 743658f5f9e..ac71a29cf56 100644
--- a/libstdc++-v3/testsuite/experimental/propagate_const/cons/move_neg.cc
+++ b/libstdc++-v3/testsuite/experimental/propagate_const/cons/move_neg.cc
@@ -25,10 +25,10 @@
 using std::experimental::propagate_const;
 using std::unique_ptr;
 
-// { dg-error "no type" "" { target *-*-* } 120 }
-// { dg-error "no type" "" { target *-*-* } 127 }
-// { dg-error "no type" "" { target *-*-* } 136 }
-// { dg-error "no type" "" { target *-*-* } 145 }
+// { dg-error "no type" "" { target *-*-* } 118 }
+// { dg-error "no type" "" { target *-*-* } 125 }
+// { dg-error "no type" "" { target *-*-* } 134 }
+// { dg-error "no type" "" { target *-*-* } 143 }
 
 int main()
 {
diff --git a/libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc b/libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc
index 6f8fef80aca..626805ecd46 100644
--- a/libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc
+++ b/libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc
@@ -21,9 +21,9 @@
 
 using std::experimental::propagate_const;
 
-// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 107 }
-// { dg-error "not a pointer-to-object type" "" { target *-*-* } 68 }
-// { dg-error "forming pointer to reference type" "" { target *-*-* } 189 }
-// { dg-error "forming pointer to reference type" "" { target *-*-* } 215 }
+// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 105 }
+// { dg-error "not a pointer-to-object type" "" { target *-*-* } 66 }
+// { dg-error "forming pointer to reference type" "" { target *-*-* } 187 }
+// { dg-error "forming pointer to reference type" "" { target *-*-* } 213 }
 
 propagate_const<void*> test1;
diff --git a/libstdc++-v3/testsuite/experimental/propagate_const/requirements3.cc b/libstdc++-v3/testsuite/experimental/propagate_const/requirements3.cc
index 0498b0bafa4..74ed5d35c4e 100644
--- a/libstdc++-v3/testsuite/experimental/propagate_const/requirements3.cc
+++ b/libstdc++-v3/testsuite/experimental/propagate_const/requirements3.cc
@@ -21,6 +21,6 @@
 
 using std::experimental::propagate_const;
 
-// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 107 }
+// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 105 }
 
 propagate_const<void (*)()> test1;
diff --git a/libstdc++-v3/testsuite/experimental/propagate_const/requirements4.cc b/libstdc++-v3/testsuite/experimental/propagate_const/requirements4.cc
index d662af82fee..4182c0862f3 100644
--- a/libstdc++-v3/testsuite/experimental/propagate_const/requirements4.cc
+++ b/libstdc++-v3/testsuite/experimental/propagate_const/requirements4.cc
@@ -21,8 +21,8 @@
 
 using std::experimental::propagate_const;
 
-// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 107 }
-// { dg-error "invalid type" "" { target *-*-* } 68 }
-// { dg-error "uninitialized reference member" "" { target *-*-* } 114 }
+// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 105 }
+// { dg-error "invalid type" "" { target *-*-* } 66 }
+// { dg-error "uninitialized reference member" "" { target *-*-* } 112 }
 
 propagate_const<int&> test1; // { dg-error "use of deleted function" }
diff --git a/libstdc++-v3/testsuite/experimental/propagate_const/requirements5.cc b/libstdc++-v3/testsuite/experimental/propagate_const/requirements5.cc
index adf0809858a..07a4c69c147 100644
--- a/libstdc++-v3/testsuite/experimental/propagate_const/requirements5.cc
+++ b/libstdc++-v3/testsuite/experimental/propagate_const/requirements5.cc
@@ -21,6 +21,6 @@
 
 using std::experimental::propagate_const;
 
-// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 107 }
+// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 105 }
 
 propagate_const<int[1]> test1;
diff mbox series

Patch

diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml
index 85e193daffa..fd66ac503a8 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml
@@ -98,7 +98,9 @@  Feature-testing recommendations for C++</link>.
 	</link>
       </entry>
       <entry align="center"> 7 </entry>
-      <entry> <code>__has_include(&lt;variant&gt;)</code> </entry>
+      <entry> <code>__has_include(&lt;variant&gt;)</code>,
+              <code>__cpp_lib_variant >= 201603</code>
+      </entry>
     </row>
 
     <row>
@@ -109,7 +111,9 @@  Feature-testing recommendations for C++</link>.
 	</link>
       </entry>
       <entry align="center"> 7 </entry>
-      <entry> <code>__has_include(&lt;optional&gt;)</code> </entry>
+      <entry> <code>__has_include(&lt;optional&gt;)</code>,
+              <code>__cpp_lib_optional >= 201603</code>
+      </entry>
     </row>
 
     <row>
@@ -120,7 +124,9 @@  Feature-testing recommendations for C++</link>.
 	</link>
       </entry>
       <entry align="center"> 7 </entry>
-      <entry> <code>__has_include(&lt;any&gt;)</code> </entry>
+      <entry> <code>__has_include(&lt;any&gt;)</code>,
+              <code>__cpp_lib_any >= 201603</code>
+      </entry>
     </row>
 
     <row>
@@ -131,7 +137,9 @@  Feature-testing recommendations for C++</link>.
 	</link>
       </entry>
       <entry align="center"> 7 </entry>
-      <entry> <code>__has_include(&lt;string_view&gt;)</code> </entry>
+      <entry> <code>__has_include(&lt;string_view&gt;)</code>,
+              <code>__cpp_lib_string_view >= 201603</code>
+      </entry>
     </row>
 
     <row>
@@ -143,7 +151,9 @@  Feature-testing recommendations for C++</link>.
 	</link>
       </entry>
       <entry align="center"> No </entry>
-      <entry> <code>__has_include(&lt;memory_resource&gt;)</code> </entry>
+      <entry> <code>__has_include(&lt;memory_resource&gt;)</code>,
+              <code>__cpp_lib_memory_resource >= 201603</code>
+      </entry>
     </row>
 
     <row>
@@ -616,7 +626,9 @@  Feature-testing recommendations for C++</link>.
       </entry>
       <entry align="center"> No </entry>
       <entry><code> __has_include(&lt;execution&gt;) </code>,
-	     <code> __cpp_lib_parallel_algorithm >= 201603 </code></entry>
+	     <code> __cpp_lib_execution >= 201603 </code>,
+	     <code> __cpp_lib_parallel_algorithm >= 201603 </code>
+      </entry>
     </row>
 
     <row>
@@ -638,9 +650,7 @@  Feature-testing recommendations for C++</link>.
 	</link>
       </entry>
       <entry align="center"> 7 </entry>
-      <entry><code> __cpp_lib_gcd >= 201606 </code>,
-	     <code> __cpp_lib_lcm >= 201606 </code>
-      </entry>
+      <entry><code> __cpp_lib_gcd_lcm >= 201606 </code></entry>
     </row>
 
     <row>
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index a6517365827..6395f1e6ae0 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -96,7 +96,6 @@  bits_headers = \
 	${bits_srcdir}/boost_concept_check.h \
 	${bits_srcdir}/c++0x_warning.h \
 	${bits_srcdir}/c++14_warning.h \
-	${bits_srcdir}/c++17_warning.h \
 	${bits_srcdir}/char_traits.h \
 	${bits_srcdir}/codecvt.h \
 	${bits_srcdir}/concept_check.h \
diff --git a/libstdc++-v3/include/bits/c++17_warning.h b/libstdc++-v3/include/bits/c++17_warning.h
deleted file mode 100644
index 759fdc92250..00000000000
--- a/libstdc++-v3/include/bits/c++17_warning.h
+++ /dev/null
@@ -1,37 +0,0 @@ 
-// Copyright (C) 2016-2017 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// <http://www.gnu.org/licenses/>.
-
-/** @file bits/c++17_warning.h
- *  This is an internal header file, included by other library headers.
- *  Do not attempt to use it directly. @headername{iosfwd}
- */
-
-#ifndef _CXX17_WARNING_H
-#define _CXX17_WARNING_H 1
-
-#if __cplusplus <= 201402L
-#error This file requires compiler and library support \
-for the ISO C++ 2017 standard. This support must be enabled \
-with the -std=c++17 or -std=gnu++17 compiler options.
-#endif
-
-#endif
diff --git a/libstdc++-v3/include/bits/string_view.tcc b/libstdc++-v3/include/bits/string_view.tcc
index f4bd50fd4a0..ddd5496f1b6 100644
--- a/libstdc++-v3/include/bits/string_view.tcc
+++ b/libstdc++-v3/include/bits/string_view.tcc
@@ -36,9 +36,7 @@ 
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201402L
-# include <bits/c++17_warning.h>
-#else
+#if __cplusplus >= 201703L
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any
index 1e84302f0c0..eef510535d7 100644
--- a/libstdc++-v3/include/std/any
+++ b/libstdc++-v3/include/std/any
@@ -31,9 +31,7 @@ 
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201402L
-# include <bits/c++17_warning.h>
-#else
+#if __cplusplus >= 201703L
 
 #include <typeinfo>
 #include <new>
@@ -68,6 +66,8 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
   }
 
+#define __cpp_lib_any 201603
+
   /**
    *  @brief A type-safe container of any type.
    * 
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index fadb9f60481..8c692a88ffd 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -556,8 +556,8 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
         }
     }
 
-#if __cplusplus > 201402L
-#define __cpp_lib_scoped_lock 201707
+#if __cplusplus >= 201703L
+#define __cpp_lib_scoped_lock 201703
   /** @brief A scoped lock type for multiple lockable objects.
    *
    * A scoped_lock controls mutex ownership within a scope, releasing
diff --git a/libstdc++-v3/include/std/numeric b/libstdc++-v3/include/std/numeric
index 17d629db81d..2b804199c7e 100644
--- a/libstdc++-v3/include/std/numeric
+++ b/libstdc++-v3/include/std/numeric
@@ -121,7 +121,11 @@  namespace __detail
 
 #if __cplusplus > 201402L
 
+#define __cpp_lib_gcd_lcm 201606
+// These were used in drafts of SD-6:
 #define __cpp_lib_gcd 201606
+#define __cpp_lib_lcm 201606
+
   /// Greatest common divisor
   template<typename _Mn, typename _Nn>
     constexpr common_type_t<_Mn, _Nn>
@@ -134,7 +138,6 @@  namespace __detail
       return __detail::__gcd(__m, __n);
     }
 
-#define __cpp_lib_lcm 201606
   /// Least common multiple
   template<typename _Mn, typename _Nn>
     constexpr common_type_t<_Mn, _Nn>
diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional
index c697c1682a6..2743ef963b4 100644
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -29,9 +29,9 @@ 
 #ifndef _GLIBCXX_OPTIONAL
 #define _GLIBCXX_OPTIONAL 1
 
-#if __cplusplus <= 201402L
-# include <bits/c++17_warning.h>
-#else
+#pragma GCC system_header
+
+#if __cplusplus >= 201703L
 
 #include <utility>
 #include <type_traits>
@@ -51,6 +51,8 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *  @{
    */
 
+#define __cpp_lib_optional 201603
+
   template<typename _Tp>
     class optional;
 
diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex
index ff116c0e30d..295fdc7118c 100644
--- a/libstdc++-v3/include/std/shared_mutex
+++ b/libstdc++-v3/include/std/shared_mutex
@@ -31,9 +31,7 @@ 
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201103L
-# include <bits/c++14_warning.h>
-#else
+#if __cplusplus >= 201402L
 
 #include <bits/c++config.h>
 #include <condition_variable>
@@ -51,7 +49,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
 #ifdef _GLIBCXX_HAS_GTHREADS
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
 #define __cpp_lib_shared_mutex 201505
   class shared_mutex;
 #endif
diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view
index 88a7686618c..bdbbbb9fbec 100644
--- a/libstdc++-v3/include/std/string_view
+++ b/libstdc++-v3/include/std/string_view
@@ -35,9 +35,7 @@ 
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201402L
-# include <bits/c++17_warning.h>
-#else
+#if __cplusplus >= 201703L
 
 #include <limits>
 #include <iosfwd>
@@ -49,6 +47,8 @@  namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
+#define __cpp_lib_string_view 201603
+
   /**
    *  @class basic_string_view <string_view>
    *  @brief  A non-owning reference to a string.
diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index d0c22e35d0f..ee2571b7857 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -31,9 +31,7 @@ 
 
 #pragma GCC system_header
 
-#if __cplusplus <= 201402L
-# include <bits/c++17_warning.h>
-#else
+#if __cplusplus >= 201703L
 
 #include <type_traits>
 #include <utility>
@@ -70,6 +68,8 @@  namespace __variant
 } // namespace __variant
 } // namespace __detail
 
+#define __cpp_lib_variant 201603
+
   template<typename... _Types> class tuple;
   template<typename... _Types> class variant;
   template <typename> struct hash;
diff --git a/libstdc++-v3/testsuite/20_util/optional/cons/value_neg.cc b/libstdc++-v3/testsuite/20_util/optional/cons/value_neg.cc
index 524e302fec1..98964eadbde 100644
--- a/libstdc++-v3/testsuite/20_util/optional/cons/value_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/optional/cons/value_neg.cc
@@ -37,8 +37,8 @@  int main()
     std::optional<std::unique_ptr<int>> oup2 = new int;  // { dg-error "conversion" }
     struct U { explicit U(std::in_place_t); };
     std::optional<U> ou(std::in_place); // { dg-error "no matching" }
-    // { dg-error "no type" "" { target { *-*-* } } 493 }
-    // { dg-error "no type" "" { target { *-*-* } } 503 }
-    // { dg-error "no type" "" { target { *-*-* } } 560 }
+    // { dg-error "no type" "" { target { *-*-* } } 495 }
+    // { dg-error "no type" "" { target { *-*-* } } 505 }
+    // { dg-error "no type" "" { target { *-*-* } } 562 }
   }
 }
diff --git a/libstdc++-v3/testsuite/26_numerics/gcd/1.cc b/libstdc++-v3/testsuite/26_numerics/gcd/1.cc
index 17e97a7e0ae..0f0b7b85b4e 100644
--- a/libstdc++-v3/testsuite/26_numerics/gcd/1.cc
+++ b/libstdc++-v3/testsuite/26_numerics/gcd/1.cc
@@ -20,9 +20,9 @@ 
 
 #include <numeric>
 
-#ifndef __cpp_lib_gcd
+#ifndef __cpp_lib_gcd_lcm
 # error "Feature-test macro for gcd missing"
-#elif __cpp_lib_gcd != 201606
+#elif __cpp_lib_gcd_lcm != 201606
 # error "Feature-test macro for gcd has wrong value"
 #endif
 
diff --git a/libstdc++-v3/testsuite/26_numerics/gcd/gcd_neg.cc b/libstdc++-v3/testsuite/26_numerics/gcd/gcd_neg.cc
index 8c3494d7041..d88f145d754 100644
--- a/libstdc++-v3/testsuite/26_numerics/gcd/gcd_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/gcd/gcd_neg.cc
@@ -31,9 +31,9 @@  test01()
   std::gcd(0.1, 0.1);   // { dg-error "from here" }
 }
 
-// { dg-error "integers" "" { target *-*-* } 130 }
-// { dg-error "integers" "" { target *-*-* } 131 }
-// { dg-error "not bools" "" { target *-*-* } 132 }
-// { dg-error "not bools" "" { target *-*-* } 133 }
+// { dg-error "integers" "" { target *-*-* } 134 }
+// { dg-error "integers" "" { target *-*-* } 135 }
+// { dg-error "not bools" "" { target *-*-* } 136 }
+// { dg-error "not bools" "" { target *-*-* } 137 }
 // { dg-prune-output "deleted function" }
 // { dg-prune-output "invalid operands" }
diff --git a/libstdc++-v3/testsuite/26_numerics/lcm/1.cc b/libstdc++-v3/testsuite/26_numerics/lcm/1.cc
index 81cb91437ba..367f0a3e0e3 100644
--- a/libstdc++-v3/testsuite/26_numerics/lcm/1.cc
+++ b/libstdc++-v3/testsuite/26_numerics/lcm/1.cc
@@ -20,9 +20,9 @@ 
 
 #include <numeric>
 
-#ifndef __cpp_lib_lcm
+#ifndef __cpp_lib_gcd_lcm
 # error "Feature-test macro for lcm missing"
-#elif __cpp_lib_lcm != 201606
+#elif __cpp_lib_gcd_lcm != 201606
 # error "Feature-test macro for lcm has wrong value"
 #endif
 
diff --git a/libstdc++-v3/testsuite/26_numerics/lcm/lcm_neg.cc b/libstdc++-v3/testsuite/26_numerics/lcm/lcm_neg.cc
index abcac4f18c1..7a908a4568f 100644
--- a/libstdc++-v3/testsuite/26_numerics/lcm/lcm_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/lcm/lcm_neg.cc
@@ -31,9 +31,9 @@  test01()
   std::lcm(0.1, 0.1);   // { dg-error "from here" }
 }
 
-// { dg-error "integers" "" { target *-*-* } 143 }
-// { dg-error "integers" "" { target *-*-* } 144 }
-// { dg-error "not bools" "" { target *-*-* } 145 }
-// { dg-error "not bools" "" { target *-*-* } 146 }
+// { dg-error "integers" "" { target *-*-* } 146 }
+// { dg-error "integers" "" { target *-*-* } 147 }
+// { dg-error "not bools" "" { target *-*-* } 148 }
+// { dg-error "not bools" "" { target *-*-* } 149 }
 // { dg-prune-output "deleted function" }
 // { dg-prune-output "invalid operands" }
diff --git a/libstdc++-v3/testsuite/30_threads/scoped_lock/requirements/typedefs.cc b/libstdc++-v3/testsuite/30_threads/scoped_lock/requirements/typedefs.cc
index 0a8903ebaab..b8a09042094 100644
--- a/libstdc++-v3/testsuite/30_threads/scoped_lock/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/30_threads/scoped_lock/requirements/typedefs.cc
@@ -27,7 +27,7 @@ 
 
 #ifndef __cpp_lib_scoped_lock
 # error "Feature-test macro for scoped_lock missing"
-#elif __cpp_lib_scoped_lock != 201707
+#elif __cpp_lib_scoped_lock != 201703
 # error "Feature-test macro for scoped_lock has wrong value"
 #endif