From 1a190b9038ca6d01c6e92887cfad8d3bb45f1823 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 6 Feb 2017 18:58:44 +0100 Subject: shared: fix -Wtype-limits warning in nm_glib_check_version() macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix it by converting the macro to an inline function. It's anyway nicer. $ make src/src_libNetworkManagerBase_la-main-utils.lo CC src/src_libNetworkManagerBase_la-main-utils.lo In file included from ./shared/nm-utils/nm-macros-internal.h:29:0, from ./shared/nm-default.h:178, from src/main-utils.c:22: src/main-utils.c: In function ‘nm_main_utils_setup_signals’: ./shared/nm-utils/nm-glib.h:144:36: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits] && glib_micro_version >= (micro)))) ^ src/main-utils.c:82:6: note: in expansion of macro ‘nm_glib_check_version’ if (nm_glib_check_version (2, 36, 0)) { ^~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Makefile:12312: recipe for target 'src/src_libNetworkManagerBase_la-main-utils.lo' failed --- shared/nm-utils/nm-glib.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'shared') diff --git a/shared/nm-utils/nm-glib.h b/shared/nm-utils/nm-glib.h index 824a08ca0d..03251ca058 100644 --- a/shared/nm-utils/nm-glib.h +++ b/shared/nm-utils/nm-glib.h @@ -134,14 +134,17 @@ __g_type_ensure (GType type) /* Rumtime check for glib version. First do a compile time check which * (if satisfied) shortcuts the runtime check. */ -#define nm_glib_check_version(major, minor, micro) \ - ( GLIB_CHECK_VERSION ((major), (minor), (micro)) \ - || ( ( glib_major_version > (major)) \ - || ( glib_major_version == (major) \ - && glib_minor_version > (minor)) \ - || ( glib_major_version == (major) \ - && glib_minor_version == (minor) \ - && glib_micro_version >= (micro)))) +inline static gboolean +nm_glib_check_version (guint major, guint minor, guint micro) +{ + return GLIB_CHECK_VERSION (major, minor, micro) + || ( ( glib_major_version > major) + || ( glib_major_version == major + && glib_minor_version > minor) + || ( glib_major_version == major + && glib_minor_version == minor + && glib_micro_version < micro)); +} /* g_test_skip() is only available since glib 2.38. Add a compatibility wrapper. */ inline static void -- cgit v1.2.1