bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PROPOSED 2/2] assert-h: prefer to ‘verify’


From: Paul Eggert
Subject: Re: [PROPOSED 2/2] assert-h: prefer to ‘verify’
Date: Wed, 28 Dec 2022 14:41:32 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 9/14/22 04:35, Bruno Haible wrote:
-#  define _Static_assert(...) \
-     _GL_VERIFY (__VA_ARGS__, "static assertion failed", -)
+#  define _Static_assert(R, ...) \
+     _GL_VERIFY ((R), "static assertion failed", -)

Unfortunately this doesn't conform to strict C99, which requires the updated _Static_assert to be called with at least two arguments. I discovered this while compiling bleeding-edge gzip on AIX and on Solaris. I worked around the problem by installing the attached patch, though since I don't use MSVC I'm not sure I got the new #if exactly right.

Also, does MSVC require the "(R)" to be parenthesized? I also noticed what would ordinarily be unnecessary parentheses later on, in the MSVC-specific '#   define _GL_SA1(a1) static_assert ((a1), "static assertion failed")'. Ordinarily I like to leave those parentheses out but if MSVC needs them obviously we should keep them.

Attachment: 0001-assert-h-port-static_assert-to-strict-C99.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]