From c5212ea23c338c4abc6340c66181532e10e78ec0 Mon Sep 17 00:00:00 2001
From: Andrew Johnson
Date: Tue, 30 Aug 2011 17:50:53 -0500
Subject: [PATCH] libCom: epicsVersion.h changes
Make version numbers easier to compare.
---
documentation/RELEASE_NOTES.html | 20 ++++++++++++++++++++
src/libCom/misc/RULES | 3 ++-
src/libCom/misc/makeEpicsVersion.pl | 7 +++++++
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html
index 7aa50e250..9cd899604 100644
--- a/documentation/RELEASE_NOTES.html
+++ b/documentation/RELEASE_NOTES.html
@@ -15,6 +15,26 @@ EPICS Base 3.15.0.x releases are not intended for use in production systems.
Changes between 3.14.x and 3.15.0.x
+
+Changes to epicsVersion.h
+
+
+The two macros EPICS_UPDATE_LEVEL and EPICS_CVS_SNAPSHOT have
+been deleted from the epicsVersion.h file; they were deprecated in R3.14 and can
+be replaced with EPICS_PATCH_LEVEL and EPICS_DEV_SNAPSHOT
+respectively.
+
+
+A new pair of macros has been added to make version number comparisons easier.
+Code that will not work with a version of Base before 3.15.0 can now be
+written like this to prevent it from compiling:
+
+
+#if defined(VERSION_INT) && EPICS_VERSION_INT < VERSION_INT(3,15,0,0)
+# error EPICS Base R3.15.0 or later is required
+#endif
+
+
Added support for iocLogPrefix
diff --git a/src/libCom/misc/RULES b/src/libCom/misc/RULES
index fe180a83f..7cf9254e3 100644
--- a/src/libCom/misc/RULES
+++ b/src/libCom/misc/RULES
@@ -7,6 +7,7 @@
# This is a Makefile fragment, see src/libCom/Makefile.
-$(COMMON_DIR)/epicsVersion.h: $(CONFIG)/CONFIG_BASE_VERSION $(CONFIG)/CONFIG_SITE
+$(COMMON_DIR)/epicsVersion.h: $(CONFIG)/CONFIG_BASE_VERSION \
+ $(CONFIG)/CONFIG_SITE $(LIBCOM)/misc/makeEpicsVersion.pl
$(PERL) $(LIBCOM)/misc/makeEpicsVersion.pl $(CONFIG)/CONFIG_BASE_VERSION $(@D) $(EPICS_SITE_VERSION)
diff --git a/src/libCom/misc/makeEpicsVersion.pl b/src/libCom/misc/makeEpicsVersion.pl
index 62dea3d5e..9678c8fc8 100644
--- a/src/libCom/misc/makeEpicsVersion.pl
+++ b/src/libCom/misc/makeEpicsVersion.pl
@@ -55,6 +55,9 @@ open my $OUT, '>', $epicsVersion
print $OUT <<"END_OUTPUT";
/* Generated epicsVersion.h */
+#ifndef INC_epicsVersion_H
+#define INC_epicsVersion_H
+
#define EPICS_VERSION $ver
#define EPICS_REVISION $rev
#define EPICS_MODIFICATION $mod
@@ -64,10 +67,14 @@ print $OUT <<"END_OUTPUT";
#define EPICS_VERSION_STRING "EPICS $ver_str"
#define epicsReleaseVersion "EPICS R$ver_str $commit_date"
+#define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P))
+#define EPICS_VERSION_INT VERSION_INT($ver, $rev, $mod, $patch)
+
/* The following names are deprecated, use the equivalent name above */
#define EPICS_UPDATE_LEVEL EPICS_PATCH_LEVEL
#define EPICS_CVS_SNAPSHOT EPICS_DEV_SNAPSHOT
+#endif /* INC_epicsVersion_H */
END_OUTPUT
close $OUT;