File 0001-build-workaround-compiler-warning-Wunused-variable-i.patch of Package glib2

From 3d1bc5e3d825c229d57cdeddca4e987d0b47b2fe Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Wed, 7 Feb 2024 10:53:41 +0100
Subject: [PATCH 1/2] build: workaround compiler warning -Wunused-variable in
 meson detection

Otherwise, `CFLAGS='-Wall -Werror' meson build` fails detection with:

  Running compile:
  ...
  Command line: `cc /data/src/glib/build/meson-private/tmplkxa94er/testfile.c -o /data/src/glib/build/meson-private/tmplkxa94er/output.exe -Werror -Wall -D_FILE_OFFSET_BITS=64 -O0 -std=gnu99` -> 1
  stderr:
  /data/src/glib/build/meson-private/tmplkxa94er/testfile.c: In function 'main':
  /data/src/glib/build/meson-private/tmplkxa94er/testfile.c:3:24: error: unused variable 'codeset' [-Werror=unused-variable]
      3 |                  char *codeset = nl_langinfo (CODESET);
        |                        ^~~~~~~
  cc1: all warnings being treated as errors
  -----------
  Checking if "nl_langinfo and CODESET" : links: NO
---
 meson.build | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meson.build b/meson.build
index 47b382b72..eac928924 100644
--- a/meson.build
+++ b/meson.build
@@ -1274,6 +1274,7 @@ endif
 if cc.links('''#include <langinfo.h>
                int main (int argc, char ** argv) {
                  char *codeset = nl_langinfo (CODESET);
+                 (void) codeset;
                  return 0;
                }''', name : 'nl_langinfo and CODESET')
   glib_conf.set('HAVE_LANGINFO_CODESET', 1)
@@ -1367,6 +1368,7 @@ endif
 if cc.links('''#include <langinfo.h>
                int main (int argc, char ** argv) {
                  char *codeset = nl_langinfo (_NL_TIME_CODESET);
+                 (void) codeset;
                  return 0;
                }''', name : 'nl_langinfo and _NL_TIME_CODESET')
   glib_conf.set('HAVE_LANGINFO_TIME_CODESET', 1)
@@ -1434,6 +1436,7 @@ if cc.compiles('''#include <sys/types.h>
                   #include <inttypes.h>
                   void some_func (void) {
                     uintmax_t i = (uintmax_t) -1;
+                    (void) i;
                   }''', name : 'uintmax_t in inttypes.h')
   glib_conf.set('HAVE_INTTYPES_H_WITH_UINTMAX', 1)
   found_uintmax_t = true
@@ -1446,6 +1449,7 @@ if cc.compiles('''#include <sys/types.h>
                   #include <stdint.h>
                   void some_func (void) {
                     uintmax_t i = (uintmax_t) -1;
+                    (void) i;
                   }''', name : 'uintmax_t in stdint.h')
   glib_conf.set('HAVE_STDINT_H_WITH_UINTMAX', 1)
   found_uintmax_t = true
-- 
2.39.3 (Apple Git-146)

openSUSE Build Service is sponsored by