EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: EPICS Base 3.15 release notes epicsVersion.h macro snippet issues
From: Michael Davidsaver via Tech-talk <[email protected]>
To: "J. Lewis Muir" <[email protected]>
Cc: EPICS Tech-Talk <[email protected]>
Date: Mon, 1 Apr 2019 12:55:28 -0700
Hi Lewis,

You're right about the example.  Would you like to submit a correction?
(via launchpad, github, or email a patch)

https://github.com/epics-base/epics-base/blob/3.15/documentation/RELEASE_NOTES.html

What I've done before is equivalent to:

>   #ifndef VERSION_INT
>   #  define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P))
>   #  define EPICS_VERSION_INT  VERSION_INT(EPICS_VERSION, EPICS_REVISION, EPICS_MODIFICATION, EPICS_PATCH_LEVEL)
>   #endif
>   #if EPICS_VERSION_INT < VERSION_INT(3,15,0,0)
>   #  error EPICS Base R3.15.0 or later is required
>   #endif


On 4/1/19 12:35 PM, J. Lewis Muir via Tech-talk wrote:
> Hello, all.
> 
> At
> 
>   https://epics.anl.gov/base/R3-15/6-docs/RELEASE_NOTES.html
> 
> under
> 
>   Changes made between 3.14.x and 3.15.0.1
> 
> in the
> 
>   Changes to epicsVersion.h
> 
> section, it says
> 
>   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
> 
> That has two problems, at least on macOS Mojave with Clang 10.0.1:
> 
> 1. The function-like macro VERSION_INT can't portably be used later on
>    in the same expression as the check for whether it's defined when
>    it's not defined.
> 
>    For example, when compiling foo.c with the above preprocessor snippet
>    against EPICS Base 3.14.12.8, Clang errors out with:
> 
>      ../foo.c:37:49: error: function-like macro 'VERSION_INT' is not defined
>      #if defined(VERSION_INT) && EPICS_VERSION_INT < VERSION_INT(3,15,0,0)
>                                                      ^
>      1 error generated.
> 
>    A portable fix would be to check whether VERSION_INT is defined on
>    its own:
> 
>      #if defined(VERSION_INT)
>      #  if EPICS_VERSION_INT < VERSION_INT(3,15,0,0)
>      #    error EPICS Base R3.15.0 or later is required
>      #  endif
>      #endif
> 
> 2. The logic of the macro snippet is wrong.  For example, when compiling
>    against EPICS Base 3.14.x, the error (i.e., "EPICS Base R3.15.0
>    or later is required") is *not* generated.  This is because the
>    VERSION_INT function-like macro is not defined in EPICS Base 3.14.x.
> 
> Regards,
> 
> Lewis
> 


Replies:
Re: EPICS Base 3.15 release notes epicsVersion.h macro snippet issues J. Lewis Muir via Tech-talk
References:
EPICS Base 3.15 release notes epicsVersion.h macro snippet issues J. Lewis Muir via Tech-talk

Navigate by Date:
Prev: EPICS Base 3.15 release notes epicsVersion.h macro snippet issues J. Lewis Muir via Tech-talk
Next: Support for Emerson Unidrive SP? Lionberger, Carl A. via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: EPICS Base 3.15 release notes epicsVersion.h macro snippet issues J. Lewis Muir via Tech-talk
Next: Re: EPICS Base 3.15 release notes epicsVersion.h macro snippet issues J. Lewis Muir via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
ANJ, 02 Apr 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·