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  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: EPICS Base version 3.15.0.1 released
From: Dirk Zimoch <[email protected]>
To: Andrew Johnson <[email protected]>
Cc: EPICS tech-talk <[email protected]>
Date: Tue, 14 Aug 2012 16:02:25 +0200
Hi all,

I get some compiler warnings when compiling 3.15.0.1. This is a collection of warnings from several different compilers. Not all compilers show all warnings.


epicsTempFile.o: In function `epicsTempName':
/afs/psi.ch/group/8431/dirk/cvs/base-3.15.0.1/src/libCom/O.SL6-x86_64/../../../src/libCom/osi/os/posix/epicsTempFile.cpp:23: warning: the use of `tmpnam' is dangerous, better use `mkstemp'

man tmpnam says:
Although tmpnam(3) generates names that are difficult to guess, it is nevertheless possible that between the time that tmpnam(3) returns a pathname, and the time that the program opens it, another program might create that pathname using open(2), or create it as a symbolic link. This can lead to security holes. To avoid such possibilities, use the open(2) O_EXCL flag to open the pathname. Or better yet, use mkstemp(3) or tmp-
       file(3).

BUGS
       Never use this function. Use mkstemp(3) or tmpfile(3) instead.


The function epicsTempName() is used only twice, both times directly followed by open(): in flex.c and in truncateFile.c. I suggest to modify this code to use epicsTempFile() instead (if possible) and to drop epicsTempName().

=============================================================

../../../../../../src/ca/legacy/pcas/io/bsdSocket/casDGIntfIO.cc: In member function ‘virtual bufSizeT casDGIntfIO::osSendBufferSize() const’: ../../../../../../src/ca/legacy/pcas/io/bsdSocket/casDGIntfIO.cc:515: warning: comparison between signed and unsigned integer expressions

../../../../../../src/ca/legacy/pcas/io/bsdSocket/casStreamIO.cc: In constructor ‘casStreamIO::casStreamIO(caServerI&, clientBufMemoryManager&, const ioArgsToNewStreamIO&)’: ../../../../../../src/ca/legacy/pcas/io/bsdSocket/casStreamIO.cc:107: warning: comparison between signed and unsigned integer expressions

In both cases, an int variable (as required by getsockopt) is compared to an unsigned int constant (the macros MAX_UDP_SEND and MAX_TCP)

A simple cast helps:
    if ( size <= (int) MAX_UDP_SEND ) {
and
	if ( size <= (int) MAX_TCP ) {

=============================================================

../../../src/ioc/db/dbBkpt.c: In function ‘dbp’:
../../../src/ioc/db/dbBkpt.c:821: warning: ‘precord’ may be used uninitialized in this function

precord cannot really be used uninitialized here, but initializing it to NULL removes the warning.

=============================================================

../../../src/libCom/error/errlog.c: In function 'errlogPrintf':
../../../src/libCom/error/errlog.c:109: warning: 'nchar' may be used uninitialized in this function

Here some compilers are not clever enough to see that this cannot happen. Initializing nchar to 0 helps.

=============================================================

../../../../../../src/ca/legacy/pcas/generic/casDGClient.cc: In member function 'caStatus casDGClient::searchFailResponse(const caHdrLargeArray*)': ../../../../../../src/ca/legacy/pcas/generic/casDGClient.cc:351:7: warning: variable 'status' set but not used [-Wunused-but-set-variable]

The return value of this->out.copyInHeader() is stored in status but not used. The function always succeeds (is this correct?). As it is now, the status variable can be removed.

=============================================================

../../../src/libCom/osi/os/vxWorks/osdFindSymbol.c: In function `epicsLoadLibrary': ../../../src/libCom/osi/os/vxWorks/osdFindSymbol.c:48: warning: implicit declaration of function `close'

vxWorks declares close() in ioLib.h

=============================================================

../../../src/libCom/osi/os/default/epicsReadline.c: In function `epicsReadlineBegin': ../../../src/libCom/osi/os/default/epicsReadline.c:215: warning: assignment makes integer from pointer without a cast

../../../src/libCom/osi/os/default/epicsReadline.c: In function `epicsReadline': ../../../src/libCom/osi/os/default/epicsReadline.c:240: warning: passing arg 1 of `ledRead' makes pointer from integer without a cast

../../../src/libCom/osi/os/default/epicsReadline.c: In function `epicsReadlineEnd': ../../../src/libCom/osi/os/default/epicsReadline.c:266: warning: passing arg 1 of `ledClose' makes pointer from integer without a cast

The data type of ledId has changed. In vxWorks 5 it is int, in vxWorks 6 it is LED_ID (a typedef for struct led *). The return value of ledOpen in case of a failure is (LED_ID)ERROR.

epicsReadline.c can be changed to use LED_ID instead of int for ledId.

To make LED_ID available for earlier vxWorks versions create a macro:
(_WRS_VXWORKS_MAJOR is not defined in vxWorks 5 or earlier).

#ifndef _WRS_VXWORKS_MAJOR
#define LED_ID int
#endif

=============================================================

../../../src/ioc/db/dbNotify.c: In function `dbNotifyDump':
../../../src/ioc/db/dbNotify.c:609: warning: `lockStatus' might be used uninitialized in this function

The vxWorks 5 compiler does not recognize that this cannot happen. Anyway, initializing lockStatus to epicsMutexLockError helps.

=============================================================

../../../src/libCom/osi/os/vxWorks/veclist.c: In function 'veclist':
../../../src/libCom/osi/os/vxWorks/veclist.c:95: warning: 'symFindByValue' is deprecated (declared at /afs/psi.ch/project/vxworks/WindRiverGPP3.7/vxworks-6.7/target/h/symLib.h:119)

In vxWorks 6, symFindByValue is deprecated. use symByValueFind() instead.


Dirk








References:
EPICS Base version 3.15.0.1 released Andrew Johnson

Navigate by Date:
Prev: Re: OPC with binary out records Carsten Winkler
Next: Re: EPICS Base version 3.15.0.1 released Tim Mooney
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: EPICS Base version 3.15.0.1 released Dirk Zimoch
Next: Matlab choices S. Stein
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·