2.74.4: missing errno.h inclusion in gthreadprivate.h?
hello
while cross compiling 2.74.4 for i686 I got:
FAILED: glib/libglib-2.0.so.0.7400.4.p/gbitlock.c.o
gcc -m32 -Iglib/libglib-2.0.so.0.7400.4.p -Iglib -I../glib -I. -I.. -I/opt/stow.d/versions/pcre2-10.42/usr/include -I/opt/stow.d/versions/python3-3.10.8-4glib-DND/usr/python3/include -I/usr/Xorg/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu99 -O2 -g -D_GNU_SOURCE -fno-strict-aliasing -DG_DISABLE_CAST_CHECKS -Wduplicated-branches -Wimplicit-fallthrough -Wmisleading-indentation -Wunused -Wno-unused-parameter -Wno-cast-function-type -Wno-pedantic -Wno-format-zero-length -Wno-variadic-macros -Werror=format=2 -Werror=init-self -Werror=missing-include-dirs -Werror=pointer-arith -Werror=unused-result -Wstrict-prototypes -Wno-bad-function-cast -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pointer-sign -m32 -fPIC -pthread '-DG_LOG_DOMAIN="GLib"' -DGLIB_COMPILATION -fvisibility=hidden -MD -MQ glib/libglib-2.0.so.0.7400.4.p/gbitlock.c.o -MF glib/libglib-2.0.so.0.7400.4.p/gbitlock.c.o.d -o glib/libglib-2.0.so.0.7400.4.p/gbitlock.c.o -c ../glib/gbitlock.c
In file included from ../glib/gbitlock.c:34:
../glib/gbitlock.c: In function 'g_futex_wait':
../glib/gthreadprivate.h:68:20: error: 'errno' undeclared (first use in this function)
68 | if (res < 0 && errno == ENOSYS) \
| ^~~~~
[...]
It seems to me that gthreadprivate.h
is missing inclusion of errno.h
Indeed, this:
diff -c glib/gthreadprivate.h.INCLUDE_ERRNO glib/gthreadprivate.h
*** glib/gthreadprivate.h.INCLUDE_ERRNO Thu Dec 22 12:52:43 2022
--- glib/gthreadprivate.h Thu Dec 22 12:52:43 2022
***************
*** 41,46 ****
--- 41,47 ----
/* system thread implementation (gthread-posix.c, gthread-win32.c) */
#if defined(HAVE_FUTEX) || defined(HAVE_FUTEX_TIME64)
+ #include <errno.h>
#include <linux/futex.h>
#include <sys/syscall.h>
#include <unistd.h>
fixes the build for me.
I also noticed that gthreadprivate.h
in 2.75.1 does include errno.h
and, accordingly, building 2.75.1 (everything else unchanged) does complete successfully without the need for any tweak.
ciao
-gabriele