File opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch of Package gdb.38112
From ae87a62843b5f01be392addf150cc844e42950f8 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Thu, 13 Mar 2025 15:09:52 +0100
Subject: [PATCH 23/28] opcodes: fix -std=gnu23 compatibility wrt static_assert
static_assert is declared in C23 so we can't reuse that identifier:
* Define our own static_assert conditionally;
* Rename "static assert" hacks to _N as we do already in some places
to avoid a conflict.
ChangeLog:
PR ld/32372
* i386-gen.c (static_assert): Define conditionally.
* mips-formats.h (MAPPED_INT): Rename identifier.
(MAPPED_REG): Rename identifier.
(OPTIONAL_MAPPED_REG): Rename identifier.
* s390-opc.c (static_assert): Define conditionally.
(cherry picked from commit 8ebe62f3f0d)
(cherry pick dropped: opcodes/i386-gen.c)
(cherry pick dropped: opcodes/mips-formats.h)
---
opcodes/s390-opc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c
index b46f5d1705a..bd10777b52d 100644
--- a/opcodes/s390-opc.c
+++ b/opcodes/s390-opc.c
@@ -36,7 +36,9 @@
/* Build-time checks are preferrable over runtime ones. Use this construct
in preference where possible. */
+#ifndef static_assert
#define static_assert(e) ((void)sizeof (struct { int _:1 - 2 * !(e); }))
+#endif
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
--
2.43.0