From: Paul Eggert <eggert@cs.ucla.edu>
To: Bruno Haible <bruno@clisp.org>, bug-gnulib@gnu.org
Subject: Re: assert-h: Make static_assert work on Solaris 11.4
Date: Tue, 25 Oct 2022 11:12:22 -0700 [thread overview]
Message-ID: <c89e144a-667c-f3fb-a1fa-a4be421d7966@cs.ucla.edu> (raw)
In-Reply-To: <34013532.ATrlOLLGV9@nimes>
On 2022-10-23 07:47, Bruno Haible wrote:
> #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])
Will this approach work if code does something like the following? I
worry that the later <assert.h> includes would collide with config.h's
definition of static_assert.
#include <config.h>
#define NDEBUG 1
#include <assert.h>
#define NDEBUG 0
#include <assert.h>
static_assert (true);
Come to think of it, the latest C23 draft is a little squirrelly here,
as its section 7.2 says that <assert.h> defines a static_assert macro.
This must be a typo because it never goes no to say anything about what
the macro does, and static_assert is a keyword in C23.
Also, while we're on the topic, why does the latest C23 draft require
that when NDEBUG is defined, the assert macro is defined via "#define
assert(...) ((void)0)" rather than as "#define assert(ignore)
((void)0)"? What's the point of requiring the ellipsis?
next prev parent reply other threads:[~2022-10-25 18:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-23 14:47 assert-h: Make static_assert work on Solaris 11.4 Bruno Haible
2022-10-25 18:12 ` Paul Eggert [this message]
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=c89e144a-667c-f3fb-a1fa-a4be421d7966@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=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).