Subject: bug#66289: localeinfo.c:33:39: error: macro "static_assert" requires 2 arguments, but only 1 given

From: Dennis Clarke <[email-masked]>
Date: Sat, 30 Sep 2023 23:30:51 -0400

I was trying to build GNU grep on a NetBSD 9.3 machine when I saw this
nasty bit of business :

.
.
.
/usr/pkg/gcc10/bin/gcc -DHAVE_CONFIG_H -I. -I..   -D_LARGEFILE64_SOURCE 
-D_XOPEN_SOURCE=600   -Wno-cast-qual -Wno-conversion -Wno-float-equal 
-Wno-sign-compare -Wno-undef -Wno-unused-function -Wno-unused-parameter 
-Wno-float-conversion -Wimplicit-fallthrough -Wno-pedantic 
-Wno-sign-conversion -Wno-type-limits -Wno-unsuffixed-float-constants 
-std=iso9899:1999 -m64 -g -O0 -fno-builtin -fno-fast-math -mhard-float 
-mno-app-regs -mflat -msoft-quad-float -mno-unaligned-doubles 
-mno-faster-structs -mcpu=ultrasparc -mtune=ultrasparc -mno-vis 
-mno-vis2 -mno-vis3 -mno-vis4 -mno-vis4b -mno-cbcond -mno-fmaf 
-mno-fsmuld -mno-popc -mno-subxc -mcmodel=medany -mmemory-model=tso 
-fPIC -Wl,-rpath=/opt/bw/lib,--enable-new-dtags -Wl,-rpath=/usr/pkg/lib 
-MT libgreputils_a-localeinfo.o -MD -MP -MF 
.deps/libgreputils_a-localeinfo.Tpo -c -o libgreputils_a-localeinfo.o 
`test -f 'localeinfo.c' || echo './'`localeinfo.c
localeinfo.c:33:39: error: macro "static_assert" requires 2 arguments, 
but only 1 given
    33 | static_assert (MB_LEN_MAX <= SCHAR_MAX);
       |                                       ^
In file included from ./assert.h:26,
                  from ../config.h:2920,
                  from localeinfo.c:22:
/usr/include/assert.h:112: note: macro "static_assert" defined here
   112 | #define static_assert(x, y) __CTASSERT(x)
       |
localeinfo.c:33:1: warning: data definition has no type or storage class
    33 | static_assert (MB_LEN_MAX <= SCHAR_MAX);
       | ^~~~~~~~~~~~~
localeinfo.c:33:1: warning: type defaults to ‘int’ in declaration of 
‘static_assert’ [-Wimplicit-int]
localeinfo.c:125:38: error: macro "static_assert" requires 2 arguments, 
but only 1 given
   125 |                <= CASE_FOLDED_BUFSIZE);
       |                                      ^
In file included from ./assert.h:26,
                  from ../config.h:2920,
                  from localeinfo.c:22:
/usr/include/assert.h:112: note: macro "static_assert" defined here
   112 | #define static_assert(x, y) __CTASSERT(x)
       |
localeinfo.c:124:1: warning: data definition has no type or storage class
   124 | static_assert (1 + 1 + sizeof lonesome_lower / sizeof 
*lonesome_lower
       | ^~~~~~~~~~~~~
localeinfo.c:124:1: warning: type defaults to ‘int’ in declaration of 
‘static_assert’ [-Wimplicit-int]
gmake[3]: *** [Makefile:3107: libgreputils_a-localeinfo.o] Error 1
gmake[3]: Leaving directory 
'/opt/bw/build/grep-3.11_netbsd_9.3_sparcv9.001/lib'
gmake[2]: *** [Makefile:2549: all] Error 2
gmake[2]: Leaving directory 
'/opt/bw/build/grep-3.11_netbsd_9.3_sparcv9.001/lib'
gmake[1]: *** [Makefile:1844: all-recursive] Error 1
gmake[1]: Leaving directory '/opt/bw/build/grep-3.11_netbsd_9.3_sparcv9.001'
gmake: *** [Makefile:1785: all] Error 2

Seems odd given :

/usr/include/assert.h:112: note: macro "static_assert" defined here
   112 | #define static_assert(x, y) __CTASSERT(x)
       |

Maybe I need some prerequisite somewhere ?

--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken