Tests fail to build on BSDs (due to POSIX violation)
Regressed by 0421f787 due to -D_POSIX_C_SOURCE=200112L
in meson.build. POSIX.1-2018 (compared with POSIX.1-2004) changed "The SA_RESETHAND, SA_RESTART, SA_SIGINFO, SA_NOCLDWAIT, and SA_NODEFER constants are moved from the XSI option to the Base.", so it requires -D_XOPEN_SOURCE=600
(keep POSIX version but enable XSI) or -D_POSIX_C_SOURCE=200809L
(upgrade to POSIX.1-2008 or later). However, none of BSDs support SA_NODEFER
in -D_POSIX_C_SOURCE=200809L
(without XSI) yet.
Linux cheats POSIX via -D_GNU_SOURCE
. To mimic on BSDs just do not pass -D_POSIX_C_SOURCE=<...>
as extensions are enabled by default. BSDs have cheat knobs like -D__BSD_VISIBLE
or -D_NETBSD_SOURCE
but it's pointless to use them project-wide (as opposed to per-file).
$ meson setup /tmp/dav1d_build
$ meson compile -C /tmp/dav1d_build
[...]
FAILED: tests/checkasm.p/checkasm_checkasm.c.o
cc -Itests/checkasm.p -Itests -Itests -I. -I../dav1d -Iinclude/dav1d -Iinclude/dav1d -Iinclude -Iinclude -fcolor-diagnostics -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c99 -O3 -D_POSIX_C_SOURCE=200112L -fvisibility=hidden -Wundef -Werror=vla -Wno-missing-field-initializers -Wno-unused-parameter -Wstrict-prototypes -Werror=missing-prototypes -Wshorten-64-to-32 -fomit-frame-pointer -ffast-math -pthread -mstack-alignment=64 -mstackrealign -MD -MQ tests/checkasm.p/checkasm_checkasm.c.o -MF tests/checkasm.p/checkasm_checkasm.c.o.d -o tests/checkasm.p/checkasm_checkasm.c.o -c tests/checkasm/checkasm.c
tests/checkasm/checkasm.c:618:21: error: use of undeclared identifier 'SA_NODEFER'
.sa_flags = SA_NODEFER,
^
1 error generated.