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: EPICS Base 3.15 release notes epicsVersion.h macro snippet issues
From: "J. Lewis Muir via Tech-talk" <[email protected]>
To: EPICS Tech-Talk <[email protected]>
Date: Mon, 1 Apr 2019 14:35:20 -0500
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 Michael Davidsaver via Tech-talk

Navigate by Date:
Prev: EPICS Controls Engineering Job Opportunity - Full-Time, Direct Role Alexander Gorinsky via Tech-talk
Next: Re: EPICS Base 3.15 release notes epicsVersion.h macro snippet issues Michael Davidsaver 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 Controls Engineering Job Opportunity - Full-Time, Direct Role Alexander Gorinsky via Tech-talk
Next: Re: EPICS Base 3.15 release notes epicsVersion.h macro snippet issues Michael Davidsaver 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, 01 Apr 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·