I wrote: > The fix below makes this work with GCC and clang; other compilers are not > relevant > for this mode of building GNU clisp. > > The empirically determined replacement for HAVE_C_STATIC_ASSERT is: > static_assert is built-in > - C++ > g++ if __cplusplus >= 201103L && __GNUG__ >= 6 > clang++ if __cplusplus >= 201703L > - C > gcc: if __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 > clang: if __STDC_VERSION__ >= 202000L && __clang_major__ >= 16
The fix works on some platforms, like glibc or Haiku 2024, but is still not working on Haiku as of 2022. This additional patch fixes it there as well. 2024-10-31 Bruno Haible <br...@clisp.org> assert-h: Allow mixed use of gcc/g++ also on Haiku 2022. * m4/assert_h.m4 (gl_ASSERT_H): Don't assume that in C mode, <assert.h> defines static_assert. diff --git a/m4/assert_h.m4 b/m4/assert_h.m4 index 8f772f0a63..02f24db535 100644 --- a/m4/assert_h.m4 +++ b/m4/assert_h.m4 @@ -1,5 +1,5 @@ # assert_h.m4 -# serial 3 +# serial 4 dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -80,8 +80,9 @@ AC_DEFUN([gl_ASSERT_H] #undef/**/__ASSERT_H__ #endif /* 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 + We need it also to be invocable with a single argument. + Haiku 2022 <assert.h> does not define static_assert at all. */ + #if (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus #undef/**/static_assert #define static_assert _Static_assert #endif