From 4da1480cfd50fcc44ddc934db56a02f696e1bc52 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 16 Jan 2018 16:01:49 +0100 Subject: [PATCH] version: rename macro NM_VERSION_CUR_STABLE to NM_API_VERSION NM_API_VERSION is a better name. It's not the current stable version, but the version number of the API which the current NM_VERSION provides. In practice, NM_API_VERSION is either identical to NM_VERSION (in case of a release) or NM_VERSION is a development version leading up the the upcoming NM_API_VERSION. For example, with the new name the check #if NM_VERSION != NM_API_VERSION # warning this is an development version #endif makes more sense. --- libnm-core/nm-version.h | 8 ++++---- libnm-util/nm-version.h | 8 ++++---- shared/nm-version-macros.h.in | 16 +++++++++++++--- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/libnm-core/nm-version.h b/libnm-core/nm-version.h index 37d8ea729b..0412bc8e94 100644 --- a/libnm-core/nm-version.h +++ b/libnm-core/nm-version.h @@ -29,17 +29,17 @@ #if !defined (NM_VERSION_MIN_REQUIRED) || (NM_VERSION_MIN_REQUIRED == 0) # undef NM_VERSION_MIN_REQUIRED -# define NM_VERSION_MIN_REQUIRED (NM_VERSION_CUR_STABLE) +# 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_VERSION_CUR_STABLE) +# define NM_VERSION_MAX_ALLOWED (NM_API_VERSION) #endif /* sanity checks */ -#if NM_VERSION_MIN_REQUIRED > NM_VERSION_CUR_STABLE -#error "NM_VERSION_MIN_REQUIRED must be <= NM_VERSION_CUR_STABLE" +#if NM_VERSION_MIN_REQUIRED > NM_API_VERSION +#error "NM_VERSION_MIN_REQUIRED must be <= NM_API_VERSION" #endif #if NM_VERSION_MAX_ALLOWED < NM_VERSION_MIN_REQUIRED #error "NM_VERSION_MAX_ALLOWED must be >= NM_VERSION_MIN_REQUIRED" diff --git a/libnm-util/nm-version.h b/libnm-util/nm-version.h index 5f3bd022a1..f56c3944dd 100644 --- a/libnm-util/nm-version.h +++ b/libnm-util/nm-version.h @@ -29,17 +29,17 @@ #if !defined (NM_VERSION_MIN_REQUIRED) || (NM_VERSION_MIN_REQUIRED == 0) # undef NM_VERSION_MIN_REQUIRED -# define NM_VERSION_MIN_REQUIRED (NM_VERSION_CUR_STABLE) +# 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_VERSION_CUR_STABLE) +# define NM_VERSION_MAX_ALLOWED (NM_API_VERSION) #endif /* sanity checks */ -#if NM_VERSION_MIN_REQUIRED > NM_VERSION_CUR_STABLE -#error "NM_VERSION_MIN_REQUIRED must be <= NM_VERSION_CUR_STABLE" +#if NM_VERSION_MIN_REQUIRED > NM_API_VERSION +#error "NM_VERSION_MIN_REQUIRED must be <= NM_API_VERSION" #endif #if NM_VERSION_MAX_ALLOWED < NM_VERSION_MIN_REQUIRED #error "NM_VERSION_MAX_ALLOWED must be >= NM_VERSION_MIN_REQUIRED" diff --git a/shared/nm-version-macros.h.in b/shared/nm-version-macros.h.in index 40104f5f35..8d07fc82ba 100644 --- a/shared/nm-version-macros.h.in +++ b/shared/nm-version-macros.h.in @@ -74,13 +74,23 @@ #define NM_VERSION_1_10 (NM_ENCODE_VERSION (1, 10, 0)) #define NM_VERSION_1_12 (NM_ENCODE_VERSION (1, 12, 0)) -#define NM_VERSION_CUR_STABLE \ +/* For releases, NM_API_VERSION is equal to NM_VERSION. + * + * For development builds, NM_API_VERSION is the next + * stable API after NM_VERSION. When you run a development + * version, you are already using the future API, even if + * it is not yet release. Hence, the currently used API + * version is the future one. */ +#define NM_API_VERSION \ (((NM_MINOR_VERSION % 2) == 1) \ ? NM_ENCODE_VERSION (NM_MAJOR_VERSION, NM_MINOR_VERSION + 1, 0 ) \ : NM_ENCODE_VERSION (NM_MAJOR_VERSION, NM_MINOR_VERSION , ((NM_MICRO_VERSION + 1) / 2) * 2)) -/* deprecated define. */ -#define NM_VERSION_NEXT_STABLE NM_VERSION_CUR_STABLE +/* deprecated. */ +#define NM_VERSION_CUR_STABLE NM_API_VERSION + +/* deprecated. */ +#define NM_VERSION_NEXT_STABLE NM_API_VERSION #define NM_VERSION NM_ENCODE_VERSION (NM_MAJOR_VERSION, NM_MINOR_VERSION, NM_MICRO_VERSION)