aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/guile/guile-internal.h8
-rw-r--r--gdbsupport/default-init-alloc.h4
2 files changed, 9 insertions, 3 deletions
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
index 8d83b8b..1057b83 100644
--- a/gdb/guile/guile-internal.h
+++ b/gdb/guile/guile-internal.h
@@ -30,7 +30,13 @@
#include "objfiles.h"
#include "top.h"
-#if __cplusplus >= 202002L
+/* GCC introduced C++20 support in GCC 8, using -std=c++2a (the name of the
+ C++20 standard before publishing) and __cplusplus 201709L. In GCC 10,
+ -std=c++20 was added, but __cplusplus stayed at 201709L, and was only
+ changed to the standard 202002L in GCC 11. Consequently, some C++20
+ features and restrictions need to be tested against the non-standard
+ 201709L, otherwise the build with GCC 10 and -std=c++20 will break. */
+#if __cplusplus >= 201709L
/* Work around Werror=volatile in SCM_UNPACK for
SCM_DEBUG_TYPING_STRICTNESS == 1. Reported upstream:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65333 . */
diff --git a/gdbsupport/default-init-alloc.h b/gdbsupport/default-init-alloc.h
index e84110f..1cb1dcf 100644
--- a/gdbsupport/default-init-alloc.h
+++ b/gdbsupport/default-init-alloc.h
@@ -18,7 +18,7 @@
#ifndef GDBSUPPORT_DEFAULT_INIT_ALLOC_H
#define GDBSUPPORT_DEFAULT_INIT_ALLOC_H
-#if __cplusplus >= 202002L
+#if __has_include(<memory_resource>)
#include <memory_resource>
#endif
@@ -35,7 +35,7 @@ namespace gdb {
template<typename T,
typename A
-#if __cplusplus >= 202002L
+#ifdef __cpp_lib_polymorphic_allocator
= std::pmr::polymorphic_allocator<T>
#else
= std::allocator<T>