File 0002-build-workaround-compiler-warning-Wnon-null-in-meson.patch of Package glib2

From 86e161675a651f4f3f43155e0d8dac5b93ee17a2 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Wed, 7 Feb 2024 10:53:41 +0100
Subject: [PATCH 2/2] 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 <fcntl.h>
                    #include <sys/types.h>
                    #include <sys/stat.h>
                    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 eac928924..7810ec56b 100644
--- a/meson.build
+++ b/meson.build
@@ -1082,7 +1082,7 @@ if cc.compiles('''#include <fcntl.h>
                   #include <sys/types.h>
                   #include <sys/stat.h>
                   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
-- 
2.39.3 (Apple Git-146)

openSUSE Build Service is sponsored by