Experimental Physics and Industrial Control System
Subject: |
[Bug 1666924] Re: remove all uses of XXXSUPFUN typedefs |
From: |
mdavidsaver via Core-talk <[email protected]> |
To: |
[email protected] |
Date: |
Thu, 16 May 2019 21:57:42 -0000 |
It looks like we missed the init() function, which seems like it should
be "long (*init)(void);". Can we fix w/o a compatibility break?
> struct typed_rset {
> long number; /* number of support routines */
> long (*report)(void *precord);
> long (*init)();
--
You received this bug notification because you are a member of EPICS
Core Developers, which is subscribed to EPICS Base.
Matching subscriptions: epics-core-list-subscription
https://bugs.launchpad.net/bugs/1666924
Title:
remove all uses of XXXSUPFUN typedefs
Status in EPICS Base:
Fix Released
Bug description:
The OO-like function tables defined in recSup.h, devSup.h, and
drvSup.h disable type checking by using the typedefs RECSUPFUN,
DEVSUPFUN, and DRVSUPFUN, respectively, which declare the methods as
having "any number and type of arguments". For instance, this is in
devSup.h:
typedef long (*DRVSUPFUN) (); /* ptr to driver support function*/
typedef struct drvet { /* driver entry table */
long number; /*number of support routines*/
DRVSUPFUN report; /*print report*/
DRVSUPFUN init; /*init support*/
}drvet;
Supports have to uses casts to XXXSUPFUN when they fill a xxxet
structure.
I think listing the well-known reasons why this is bad would be
redundant. As an illustration, see the bug recently uncovered by
Carsten Winkler (http://www.aps.anl.gov/epics/tech-
talk/2017/msg00347.php).
I propose to change the definition of these structs so that all the
methods get their proper type.
There remains the question how to handle the (implicit) subtype
polymorphism for things like dbCommon. I propose to handle this by
forcing support definitions to explicitly cast the argument (e.g.
dbCommon *precord) to the appropriate subtype; this adds one line of
code to each support function e.g.
long process(dbCommon *pdbCommon)
{
aoRecord *prec = (aoRecord *)pdbCommon;
...use prec from here onward...
}
To manage notifications about this bug go to:
https://bugs.launchpad.net/epics-base/+bug/1666924/+subscriptions
- Navigate by Date:
- Prev:
Jenkins build is back to normal : 3.15-pvDatabase-win64s #249 APS Jenkins via Core-talk
- Next:
Jenkins build is back to stable : epics-pva2pva-linux32 #113 APS Jenkins via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
<2019>
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Jenkins build is back to normal : 3.15-pvDatabase-win64s #249 APS Jenkins via Core-talk
- Next:
[Bug 1666924] Re: remove all uses of XXXSUPFUN typedefs Andrew Johnson via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
<2019>
2020
2021
2022
2023
2024