On IRIX 6.5, with gcc, I'm seeing this compilation error: ../../gltests/test-assert.c: In function `g': ../../gltests/test-assert.c:48: error: too few arguments to function `assert' ../../gltests/test-assert.c: In function `h': ../../gltests/test-assert.c:60: error: too few arguments to function `assert' gmake[2]: *** [Makefile:3543: test-assert.o] Error 1
The cause is that config.h includes <assert.h>, then undefines 'assert', and then a later '#include <assert.h>' is a no-op. This error must have been present since this unit test was added, on 2022-09-13. This patch fixes it. 2023-02-08 Bruno Haible <[email protected]> assert-h: Fix test failure on IRIX 6.5. * m4/assert_h.m4 (gl_ASSERT_H): Ensure that on IRIX, including <assert.h> after <config.h> actually defines the assert macro. diff --git a/m4/assert_h.m4 b/m4/assert_h.m4 index 3801452ef0..d255855d31 100644 --- a/m4/assert_h.m4 +++ b/m4/assert_h.m4 @@ -46,10 +46,13 @@ AC_DEFUN([gl_ASSERT_H], gl_NEXT_HEADERS([assert.h])]) dnl The "zz" puts this toward config.h's end, to avoid potential - dnl collisions with other definitions. #undef assert so that - dnl programs are not tempted to use it without specifically - dnl including assert.h. Break the #undef apart with a comment - dnl so that 'configure' does not comment it out. + dnl collisions with other definitions. + dnl #undef assert so that programs are not tempted to use it without + dnl specifically including assert.h. + dnl #undef __ASSERT_H__ so that on IRIX, when programs later include + dnl <assert.h>, this include actually defines assert. + dnl Break the #undef_s apart with a comment so that 'configure' does + dnl not comment them out. AH_VERBATIM([zzstatic_assert], [#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ && (!defined __cplusplus \ @@ -57,6 +60,9 @@ AC_DEFUN([gl_ASSERT_H], && __GNUG__ < 6 && __clang_major__ < 6))) #include <assert.h> #undef/**/assert + #ifdef __sgi + #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
