]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Revert "[gdb/guile] Use SCM_DEBUG_TYPING_STRICTNESS 0"
authorThiago Jung Bauermann <thiago.bauermann@linaro.org>
Wed, 3 Dec 2025 23:15:13 +0000 (20:15 -0300)
committerThiago Jung Bauermann <thiago.bauermann@linaro.org>
Wed, 10 Dec 2025 03:28:12 +0000 (03:28 +0000)
This reverts commit 852cbc7ffadf9daf173e13ea56caff49d52733af.

It fixed the build with libguile v2.0.9, but now GDB only supports
Guile >= 2.2.

I was able to build GDB using -std=c++20 with both Guile 2.2 and
Guile 3.0 (tested with GCC 14.3) without any error or warning.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/guile/guile-internal.h

index aeef77abbaf5c0c241bda0c0db10600267dfa5d2..c7c8f9b4e8d8906461e1ade72a1dadbb79676d62 100644 (file)
 #include "objfiles.h"
 #include "top.h"
 
-/* For libguile v2.0.9 and SCM_DEBUG_TYPING_STRICTNESS == 1, SCM_UNPACK(x) is
-   defined as:
-
-     ((scm_t_bits) (0? (*(SCM*)0=(x)): x))
-
-   and for v2.0.10 it's defined as:
-
-     ((scm_t_bits) (0? (*(volatile SCM *)0=(x)): x))
-
-   The volatile was added to avoid a clang warning.
-
-   The latter form causes a Werror=volatile with C++20.
-   This was reported upstream (
-   https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65333 ).
-
-   The former form causes a Werror=sequence-point with gcc 7-14.
-
-   Work around these problem by using SCM_DEBUG_TYPING_STRICTNESS == 0.  */
+/* 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 .  */
 #define SCM_DEBUG_TYPING_STRICTNESS 0
+#endif
 #include "libguile.h"
 
 struct block;