From f849163e827290329564377e009e763cb134beaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Tue, 23 Dec 2025 16:09:39 +0100 Subject: [PATCH] nm-version: allow to define NM_VERSION_MAX_ALLOWED alone Previously, if NM_VERSION_MIN_REQUIRED was not defined, it defaulted to NM_VERSION. As a consequence, if NM_VERSION_MAX_ALLOWED was defined we got a compilation error because MAX_ALLOWED < MIN_REQUIRED. MAX_ALLOWED is used to get compilation warnings if you unintentionally use a libnm's symbol introduced in a newer version. MIN_REQUIRED is used to get rid of warnings about symbol deprecations. Libnm users may want to use MAX_ALLOWED alone, because using a too new symbol would fail to compile with older libnm. But they might want to get deprecation warnings as soon as possible, so they want to leave MIN_REQUIRED empty. --- src/libnm-core-public/nm-version.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libnm-core-public/nm-version.h b/src/libnm-core-public/nm-version.h index bc3d70749f..f99851194b 100644 --- a/src/libnm-core-public/nm-version.h +++ b/src/libnm-core-public/nm-version.h @@ -12,16 +12,16 @@ /* Deprecation / Availability macros */ -#if !defined(NM_VERSION_MIN_REQUIRED) || (NM_VERSION_MIN_REQUIRED == 0) -#undef NM_VERSION_MIN_REQUIRED -#define NM_VERSION_MIN_REQUIRED (NM_API_VERSION) -#endif - #if !defined(NM_VERSION_MAX_ALLOWED) || (NM_VERSION_MAX_ALLOWED == 0) #undef NM_VERSION_MAX_ALLOWED #define NM_VERSION_MAX_ALLOWED (NM_API_VERSION) #endif +#if !defined(NM_VERSION_MIN_REQUIRED) || (NM_VERSION_MIN_REQUIRED == 0) +#undef NM_VERSION_MIN_REQUIRED +#define NM_VERSION_MIN_REQUIRED (NM_VERSION_MAX_ALLOWED) +#endif + /* sanity checks */ #if NM_VERSION_MIN_REQUIRED > NM_API_VERSION #error "NM_VERSION_MIN_REQUIRED must be <= NM_API_VERSION"