]> Savannah Git Hosting - gnulib.git/commitdiff
assert-h: Make static_assert work on Solaris 11.4.
authorBruno Haible <bruno@clisp.org>
Sun, 23 Oct 2022 14:43:06 +0000 (16:43 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 23 Oct 2022 14:43:06 +0000 (16:43 +0200)
* m4/assert_h.m4 (gl_ASSERT_H): After including <assert.h>, on Solaris,
redefine static_assert.

ChangeLog
m4/assert_h.m4

index 76a56c78f285fd51a781936de3b74ff2db324cf0..6f4bea5c1cd40e3c46b916e4af68f492c15b76ca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-10-23  Bruno Haible  <bruno@clisp.org>
+
+       assert-h: Make static_assert work on Solaris 11.4.
+       * m4/assert_h.m4 (gl_ASSERT_H): After including <assert.h>, on Solaris,
+       redefine static_assert.
+
 2022-10-16  Bruno Haible  <bruno@clisp.org>
 
        getdelim: Work around buggy implementation on macOS 10.13.
index c1306daef4f233d9ee63e5a0ca04fc344eed3c36..e892ea2f01be0ab3b4d938b4e390b9cd6d88d5f2 100644 (file)
@@ -57,5 +57,11 @@ AC_DEFUN([gl_ASSERT_H],
              && __GNUG__ < 6 && __clang_major__ < 6)))
  #include <assert.h>
  #undef/**/assert
+ /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments.
+    We need it also to be invocable with a single argument.  */
+ #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus
+  #undef static_assert
+  #define static_assert _Static_assert
+ #endif
 #endif])
 ])