Commit 4da1480c authored by Thomas Haller's avatar Thomas Haller

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.
parent 165fe65e
......@@ -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"
......
......@@ -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"
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment