[PATCH] verify: port to Solaris 10 + gcc 3.4.3 + assert-h

Paul Eggert <[email protected]> Sat, 25 Jul 2026 07:55:04 -0700
Newsgroups gmane.comp.lib.gnulib.bugs
Message-ID <[email protected]>
I ran into this problem when building GNU m4 (Savannah commit
7d5125b78d56dfa08b6bb4205428eb9962ad9244) on Solaris 10 sparc.
It has GCC 3.4.3 (csl-sol210-3_4-branch+sol_rpath),
which lacks _Static_assert.  GNU m4 both uses assert-h and
includes <verify.h>, and without this patch the latter mistakenly
#undefs the _Static_assert that the former defined.
* lib/verify.h (_Static_assert) [_GL_STATIC_ASSERT]: Do not undef.
---
 ChangeLog    | 11 +++++++++++
 lib/verify.h |  5 +++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7ebe576331..3c2c873517 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2026-07-25  Paul Eggert  <[email protected]>
+
+	verify: port to Solaris 10 + gcc 3.4.3 + assert-h
+	I ran into this problem when building GNU m4 (Savannah commit
+	7d5125b78d56dfa08b6bb4205428eb9962ad9244) on Solaris 10 sparc.
+	It has GCC 3.4.3 (csl-sol210-3_4-branch+sol_rpath),
+	which lacks _Static_assert.  GNU m4 both uses assert-h and
+	includes <verify.h>, and without this patch the latter mistakenly
+	#undefs the _Static_assert that the former defined.
+	* lib/verify.h (_Static_assert) [_GL_STATIC_ASSERT]: Do not undef.
+
 2026-07-21  Bruno Haible  <[email protected]>
 
 	getopt-gnu: Clarify NetBSD status.
diff --git a/lib/verify.h b/lib/verify.h
index ad45c39d27..7daa20eb6f 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -46,8 +46,9 @@
 
 /* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other
    system headers, defines a conflicting _Static_assert that is no
-   better than ours; override it.  */
-#ifndef _GL_HAVE__STATIC_ASSERT
+   better than ours; override it unless Gnulib's replacement <assert.h>
+   (included from config.h) already overrode it.  */
+#if ! (defined _GL_HAVE__STATIC_ASSERT || defined _GL_STATIC_ASSERT)
 # include <stddef.h>
 # undef _Static_assert
 #endif
-- 
2.55.0