public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: Fix unconditional definition of __cpp_lib_span in <version> [PR 97869}
@ 2020-11-17 16:13 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2020-11-17 16:13 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 470 bytes --]

The <span> header is empty unless Concepts are supported, but <version>
defines the __cpp_lib_span feature test macro unconditionally. It should
be guarded by the same conditions as in <span>.

libstdc++-v3/ChangeLog:

	PR libstdc++/97869
	* include/precompiled/stdc++.h: Include <coroutine>.
	* include/std/version (__cpp_lib_span): Check __cpp_lib_concepts
	before defining.

Tested powerpc64le-linux. Committed to trunk.

This also needs to be backported to gcc-10.


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1587 bytes --]

commit ecf65330c11544ebf35e198087b4a42be089c620
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Nov 17 15:26:29 2020

    libstdc++: Fix unconditional definition of __cpp_lib_span in <version> [PR 97869}
    
    The <span> header is empty unless Concepts are supported, but <version>
    defines the __cpp_lib_span feature test macro unconditionally. It should
    be guarded by the same conditions as in <span>.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/97869
            * include/precompiled/stdc++.h: Include <coroutine>.
            * include/std/version (__cpp_lib_span): Check __cpp_lib_concepts
            before defining.

diff --git a/libstdc++-v3/include/precompiled/stdc++.h b/libstdc++-v3/include/precompiled/stdc++.h
index 8899c323a281..a418c46288de 100644
--- a/libstdc++-v3/include/precompiled/stdc++.h
+++ b/libstdc++-v3/include/precompiled/stdc++.h
@@ -137,6 +137,9 @@
 #include <bit>
 #include <compare>
 #include <concepts>
+#if __cpp_impl_coroutine
+# include <coroutine>
+#endif
 #include <numbers>
 #include <ranges>
 #include <span>
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index 7f51ef3a6c4f..12455ad93146 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -226,7 +226,9 @@
 # define __cpp_lib_ranges 201911L
 #endif
 #define __cpp_lib_shift 201806L
-#define __cpp_lib_span 202002L
+#if __cpp_lib_concepts
+# define __cpp_lib_span 202002L
+#endif
 #define __cpp_lib_ssize 201902L
 #define __cpp_lib_starts_ends_with 201711L
 # if _GLIBCXX_USE_CXX11_ABI

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-17 16:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17 16:13 [committed] libstdc++: Fix unconditional definition of __cpp_lib_span in <version> [PR 97869} Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).