Lasse Collin wrote:
> I looked at the root cause. In the Gnulib-generated assert.h in both
> gnu99 and gnu11 modes, these look correct:
> 
>     _GL_HAVE__STATIC_ASSERT is defined.
>     _GL_HAVE__STATIC_ASSERT1 is not defined.
> 
> In gnu11 mode, Gnulib-generated assert.h overrides _Static_assert here:
> 
> # elif !defined _GL_HAVE__STATIC_ASSERT1 && !defined _Static_assert
> #  if !defined _MSC_VER || defined __clang__
> #   define _Static_assert(...) \
>       _GL_STATIC_ASSERT (__VA_ARGS__, "static assertion failed", -)
> 
> However, in gnu99 mode, no overriding happens because <sys/cdefs.h>
> from glibc 2.31 has already defined _Static_assert (the old glibc lacks
> the check for __clang_major__):
> 
> #if (!defined _Static_assert && !defined __cplusplus \
>      && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
>      && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__))
> # define _Static_assert(expr, diagnostic) \
>     extern int (*__Static_assert_function (void)) \
>       [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
> #endif

Thanks for this analysis!

> I attached patches. The first one adds a comment related to this issue.
> The second patch fixes the groff build (even if ac_cv_prog_cc_c11=no
> isn't removed). I didn't do other testing.

Thanks for the patches. I have applied them:
  - the first one with a slight comment change,
  - the second one with an added '&& !defined __cplusplus', because
    the glibc/misc/sys/cdefs.h condition also contains '&& !defined __cplusplus'
    and such things generally work differently in C++ mode than in C mode.

Bruno




Reply via email to