From 508c677f0cb084fc659ae5de4d1da66453c137a5 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 2 May 2022 18:51:02 +0200 Subject: [PATCH] build/meson: avoid compiler warning generating "NM-1.0.gir" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In glib_dep we specify "-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40" which is the dependency we use almost everywhere. With g-ir-scanner this causes compiler warnings: [xxx] Generating NM-1.0.gir with a custom command /src/NetworkManager/build/tmp-introspectnas6f9u5/NM-1.0.c: In function ‘dump_object_type’: /src/NetworkManager/build/tmp-introspectnas6f9u5/NM-1.0.c:252:13: warning: Not available before 2.70 252 | if (G_TYPE_IS_FINAL (type)) | ^~~~~~~~~~~~~~~~~ /src/NetworkManager/build/tmp-introspectnas6f9u5/NM-1.0.c: In function ‘dump_fundamental_type’: /src/NetworkManager/build/tmp-introspectnas6f9u5/NM-1.0.c:370:13: warning: Not available before 2.70 370 | if (G_TYPE_IS_FINAL (type)) | ^~~~~~~~~~~~~~~~~ g-ir-scanner: link: gcc -o /src/NetworkManager/build/tmp-introspectnas6f9u5/NM-1.0 /src/NetworkManager/build/tmp-introspectnas6f9u5/NM-1.0.o -L. -Wl,-rpath,. -Wl,--no-as-needed -L/src/NetworkManager/build/src/libnm-client-impl -Wl,-rpath,/src/NetworkManager/build/src/libnm-client-impl -lnm -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lgmodule-2.0 -ludev -lgirepository-1.0 -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lglib-2.0 Work around that. Meson's gnome.generate_gir() is not very flexibly in allowing to pass extra `--cflags-begin {} --cflags-end` parameters. Hack around by adding a pseudo dependency that resets these defines. See-also: https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/331 See-also: 1234e5583a09 ('build/autotools: avoid compiler warning generating "NM-1.0.gir"') (cherry picked from commit e5d4194673073e6897a2514f326f245b8688bcc2) --- src/libnm-client-impl/meson.build | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libnm-client-impl/meson.build b/src/libnm-client-impl/meson.build index 21a01e0b04..2026f98dc3 100644 --- a/src/libnm-client-impl/meson.build +++ b/src/libnm-client-impl/meson.build @@ -140,6 +140,14 @@ if enable_introspection src_inc, top_inc, ], + dependencies: [ + declare_dependency( + compile_args: [ + '-UGLIB_VERSION_MIN_REQUIRED', + '-UGLIB_VERSION_MAX_ALLOWED', + ], + ), + ], nsversion: nm_gir_version, namespace: 'NM', identifier_prefix: nm_id_prefix,