From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: assert-h: Make static_assert work on Solaris 11.4
Date: Sun, 23 Oct 2022 16:47:12 +0200 [thread overview]
Message-ID: <34013532.ATrlOLLGV9@nimes> (raw)
The GNU sed prerelease testing [1] and the GNU texinfo prerelease testing [2]
have revealed compilation errors on Solaris 11.4, due to the use of
'static_assert'. The <assert.h> of Solaris 11.4 defines it in such a way
that it can only be invoked with 2 arguments. However, since 2022-09-13,
many Gnulib source files use 'static_assert' with 1 argument only.
[1] https://lists.gnu.org/archive/html/sed-devel/2022-10/msg00004.html
[2] https://lists.gnu.org/archive/html/bug-texinfo/2022-10/msg00188.html
This patch fixes it.
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.
diff --git a/m4/assert_h.m4 b/m4/assert_h.m4
index c1306daef4..e892ea2f01 100644
--- a/m4/assert_h.m4
+++ b/m4/assert_h.m4
@@ -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])
])
next reply other threads:[~2022-10-24 2:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-23 14:47 Bruno Haible [this message]
2022-10-25 18:12 ` assert-h: Make static_assert work on Solaris 11.4 Paul Eggert
2022-10-25 18:18 ` Jeffrey Walton
2022-10-25 18:22 ` Paul Eggert
2022-10-25 20:11 ` Bruno Haible
2022-10-25 21:47 ` Paul Eggert
2022-10-26 0:17 ` Bruno Haible
2022-10-25 20:05 ` Bruno Haible
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=34013532.ATrlOLLGV9@nimes \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).