Hi Pádraig,

> Testing https://www.pixelbeat.org/co/coreutils-ss.tar.xz on solaris 11 
> (cfarm216.cfarm.net)
> I get a build failure (with gcc 14) due to an already known issue on solaris 
> where it
> defines a two param static_assert() macro.
> 
>    CC       lib/libcoreutils_a-xfts.o
> ./lib/dirent.h:100:36: error: macro "static_assert" requires 2 arguments, but 
> only 1 given
> /usr/include/assert.h:25:9: note: macro "static_assert" defined here
>        | #if (__STDC_VERSION__ - 0 >= 201112L) && !defined(__cplusplus)
>     25 | #define static_assert(a, b) _Static_assert(a, b)
>        |         ^~~~~~~~~~~~~
>        | #endif
> 
> Note gcc 14 is on this system and causes the conflict avoidance to be 
> bypassed.
> Also the static_assert keyword is supported and so HAVE_C_STATIC_ASSERT is 
> defined,
> with would otherwise cause the conflict avoidance to be bypassed.
> I.e. the conflict avoidance used in m4/assert_h.m4 (from commit 0814a293a4).
> If I unconditionally use the conflict avoidance with this then coreutils 
> compiles fine:
> 
> diff --git a/m4/assert_h.m4 b/m4/assert_h.m4
> index 91f446e7f6..5692be028e 100644
> --- a/m4/assert_h.m4
> +++ b/m4/assert_h.m4
> @@ -61,7 +61,7 @@ AC_DEFUN([gl_ASSERT_H],
>     dnl Break the #undef_s apart with a comment so that 'configure' does
>     dnl not comment them out.
>     AH_VERBATIM([zzstatic_assert],
> -[#if (!(defined __clang__ \
> +[#if (1 || !(defined __clang__ \
> 
> I'm not sure how to best address this though given all the other conditions
> around the conflict avoidance logic.

Thanks for the report and for narrowing down the problem.

I could reproduce the issue on that machine, and committed the fix below.


2025-01-14  Bruno Haible  <br...@clisp.org>

        assert-h: Fix compilation error with gcc >= 13 on Solaris 11.
        Reported by Pádraig Brady <p...@draigbrady.com> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2025-01/msg00120.html>.
        * m4/assert_h.m4 (gl_ASSERT_H): Don't assume that on Solaris with gcc or
        clang, static_assert works: /usr/include/assert.h is in the way.

diff --git a/m4/assert_h.m4 b/m4/assert_h.m4
index 91f446e7f6..e77524caff 100644
--- a/m4/assert_h.m4
+++ b/m4/assert_h.m4
@@ -1,5 +1,5 @@
 # assert_h.m4
-# serial 4
+# serial 5
 dnl Copyright (C) 2011-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -64,11 +64,13 @@ AC_DEFUN([gl_ASSERT_H]
 [#if (!(defined __clang__ \
        ? (defined __cplusplus \
           ? __cplusplus >= 201703L \
-          : __STDC_VERSION__ >= 202000L && __clang_major__ >= 16) \
+          : __STDC_VERSION__ >= 202000L && __clang_major__ >= 16 \
+            && !defined __sun) \
        : (defined __GNUC__ \
           ? (defined __cplusplus \
              ? __cplusplus >= 201103L && __GNUG__ >= 6 \
-             : __STDC_VERSION__ >= 202000L && __GNUC__ >= 13) \
+             : __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \
+               && !defined __sun) \
           : defined HAVE_C_STATIC_ASSERT)) \
      && !defined assert \
      && (!defined __cplusplus \




Reply via email to