From 89e85717c95567211e81ff1e0cf8fd961ca7c117 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 7 Feb 2024 10:53:41 +0100 Subject: [PATCH] build: workaround compiler warning -Wnon-null in meson detection Otherwise, `CFLAGS='-Wall -Werror' meson build` fails detection with: Running compile: Working directory: /data/src/glib/build/meson-private/tmpmw16de74 Code: #include #include #include void some_func (void) { open(0, O_DIRECTORY, 0); } ----------- Command line: `cc /data/src/glib/build/meson-private/tmpmw16de74/testfile.c -o /data/src/glib/build/meson-private/tmpmw16de74/output.obj -c -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1 stderr: /data/src/glib/build/meson-private/tmpmw16de74/testfile.c: In function 'some_func': /data/src/glib/build/meson-private/tmpmw16de74/testfile.c:5:21: error: argument 1 null where non-null expected [-Werror=nonnull] 5 | open(0, O_DIRECTORY, 0); | ^~~~ In file included from /usr/include/features.h:503, from /usr/include/fcntl.h:25, from /data/src/glib/build/meson-private/tmpmw16de74/testfile.c:1: /usr/include/fcntl.h:212:12: note: in a call to function 'open' declared 'nonnull' 212 | extern int __REDIRECT (open, (const char *__file, int __oflag, ...), open64) | ^~~~~~~~~~ cc1: all warnings being treated as errors ----------- Checking if "open() option O_DIRECTORY" compiles: NO --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 2a116b49e..ca0461fa8 100644 --- a/meson.build +++ b/meson.build @@ -1119,7 +1119,7 @@ if cc.compiles('''#include #include #include void some_func (void) { - open(0, O_DIRECTORY, 0); + open(".", O_DIRECTORY, 0); }''', name : 'open() option O_DIRECTORY') glib_conf.set('HAVE_OPEN_O_DIRECTORY', 1) endif