From 1595ed8860fae2448e38fe04aed90d5a046df6a5 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 13 Jun 2023 13:23:36 -0700 Subject: [PATCH] quieting clang-tidy, non-functional changes Changes to syntax which should not effect generated code --- modules/libcom/src/as/asLibRoutines.c | 1 - .../libcom/src/cxxTemplates/epicsSingletonMutex.cpp | 4 ++-- modules/libcom/src/ellLib/ellLib.c | 10 ---------- modules/libcom/src/error/errSymLib.c | 1 - modules/libcom/src/fdmgr/fdManager.cpp | 1 - modules/libcom/src/fdmgr/fdmgr.cpp | 4 ++-- modules/libcom/src/freeList/freeListLib.c | 1 - modules/libcom/src/gpHash/gpHashLib.c | 2 -- modules/libcom/src/log/iocLogServer.c | 2 -- modules/libcom/src/log/logClient.c | 2 +- modules/libcom/src/macLib/macCore.c | 7 ++----- modules/libcom/src/misc/aToIPAddr.c | 5 +---- modules/libcom/src/osi/devLibVME.c | 2 +- modules/libcom/src/osi/epicsThread.cpp | 10 ++-------- modules/libcom/src/osi/epicsTime.cpp | 5 +++-- modules/libcom/src/osi/os/Linux/osdThreadExtra.c | 2 +- modules/libcom/src/osi/osiSock.c | 2 +- modules/libcom/src/timer/epicsTimer.cpp | 2 +- 18 files changed, 17 insertions(+), 46 deletions(-) diff --git a/modules/libcom/src/as/asLibRoutines.c b/modules/libcom/src/as/asLibRoutines.c index cb00ca6c7..8ffb85fd7 100644 --- a/modules/libcom/src/as/asLibRoutines.c +++ b/modules/libcom/src/as/asLibRoutines.c @@ -359,7 +359,6 @@ void epicsStdCall asPutMemberPvt(ASMEMBERPVT asMemberPvt,void *userPvt) if(!asActive) return; if(!pasgmember) return; pasgmember->userPvt = userPvt; - return; } long epicsStdCall asAddClient(ASCLIENTPVT *pasClientPvt,ASMEMBERPVT asMemberPvt, diff --git a/modules/libcom/src/cxxTemplates/epicsSingletonMutex.cpp b/modules/libcom/src/cxxTemplates/epicsSingletonMutex.cpp index 6988cefe7..33f945ae2 100644 --- a/modules/libcom/src/cxxTemplates/epicsSingletonMutex.cpp +++ b/modules/libcom/src/cxxTemplates/epicsSingletonMutex.cpp @@ -25,8 +25,8 @@ namespace { -static epicsThreadOnceId epicsSigletonOnceFlag ( EPICS_THREAD_ONCE_INIT ); -static epicsMutex * pEPICSSigletonMutex = 0; +epicsThreadOnceId epicsSigletonOnceFlag ( EPICS_THREAD_ONCE_INIT ); +epicsMutex * pEPICSSigletonMutex = 0; extern "C" void SingletonMutexOnce ( void * /* pParm */ ) { diff --git a/modules/libcom/src/ellLib/ellLib.c b/modules/libcom/src/ellLib/ellLib.c index c0e257747..3f7e25ca4 100644 --- a/modules/libcom/src/ellLib/ellLib.c +++ b/modules/libcom/src/ellLib/ellLib.c @@ -34,8 +34,6 @@ void ellAdd (ELLLIST *pList, ELLNODE *pNode) pList->node.previous = pNode; pList->count++; - - return; } /**************************************************************************** * @@ -65,8 +63,6 @@ void ellConcat (ELLLIST *pDstList, ELLLIST *pAddList) pAddList->count = 0; pAddList->node.next = NULL; pAddList->node.previous = NULL; - - return; } /**************************************************************************** * @@ -86,8 +82,6 @@ void ellDelete (ELLLIST *pList, ELLNODE *pNode) pNode->previous->next = pNode->next; pList->count--; - - return; } /**************************************************************************** * @@ -136,8 +130,6 @@ void ellExtract (ELLLIST *pSrcList, ELLNODE *pStartNode, ELLNODE *pEndNode, ELLL } pSrcList->count -= count; pDstList->count += count; - - return; } /**************************************************************************** * @@ -194,8 +186,6 @@ void ellInsert (ELLLIST *plist, ELLNODE *pPrev, ELLNODE *pNode) pNode->next->previous = pNode; plist->count++; - - return; } /**************************************************************************** * diff --git a/modules/libcom/src/error/errSymLib.c b/modules/libcom/src/error/errSymLib.c index 14fa21904..f3162cf66 100644 --- a/modules/libcom/src/error/errSymLib.c +++ b/modules/libcom/src/error/errSymLib.c @@ -260,7 +260,6 @@ void errSymTestPrint(long errNum) if ( message[0] == '\0' ) return; printf("module %hu number %hu message=\"%s\"\n", modnum, errnum, message); - return; } /**************************************************************** diff --git a/modules/libcom/src/fdmgr/fdManager.cpp b/modules/libcom/src/fdmgr/fdManager.cpp index 225fd7985..8a9ed788f 100644 --- a/modules/libcom/src/fdmgr/fdManager.cpp +++ b/modules/libcom/src/fdmgr/fdManager.cpp @@ -206,7 +206,6 @@ LIBCOM_API void fdManager::process (double delay) this->pTimerQueue->process(epicsTime::getCurrent()); } this->processInProg = false; - return; } // diff --git a/modules/libcom/src/fdmgr/fdmgr.cpp b/modules/libcom/src/fdmgr/fdmgr.cpp index 5deadeae5..a49b29310 100644 --- a/modules/libcom/src/fdmgr/fdmgr.cpp +++ b/modules/libcom/src/fdmgr/fdmgr.cpp @@ -39,8 +39,8 @@ public: // class noFunctionSpecified {}; - LIBCOM_API fdRegForOldFdmgr (const SOCKET fdIn, const fdRegType type, - const bool onceOnly, fdManager &manager, pCallBackFDMgr pFunc, void *pParam); + LIBCOM_API fdRegForOldFdmgr (SOCKET fdIn, fdRegType type, + bool onceOnly, fdManager &manager, pCallBackFDMgr pFunc, void *pParam); LIBCOM_API ~fdRegForOldFdmgr (); private: diff --git a/modules/libcom/src/freeList/freeListLib.c b/modules/libcom/src/freeList/freeListLib.c index ad0321b26..10df95115 100644 --- a/modules/libcom/src/freeList/freeListLib.c +++ b/modules/libcom/src/freeList/freeListLib.c @@ -83,7 +83,6 @@ LIBCOM_API void epicsStdCall pfl->lock = epicsMutexMustCreate(); *ppvt = (void *)pfl; VALGRIND_CREATE_MEMPOOL(pfl, REDZONE, 0); - return; } LIBCOM_API void * epicsStdCall freeListCalloc(void *pvt) diff --git a/modules/libcom/src/gpHash/gpHashLib.c b/modules/libcom/src/gpHash/gpHashLib.c index b8902bbb3..3ed7de4f1 100644 --- a/modules/libcom/src/gpHash/gpHashLib.c +++ b/modules/libcom/src/gpHash/gpHashLib.c @@ -56,7 +56,6 @@ void epicsStdCall gphInitPvt(gphPvt **ppvt, int size) pgphPvt->paplist = callocMustSucceed(size, sizeof(ELLLIST *), "gphInitPvt"); pgphPvt->lock = epicsMutexMustCreate(); *ppvt = pgphPvt; - return; } GPHENTRY * epicsStdCall gphFindParse(gphPvt *pgphPvt, const char *name, size_t len, void *pvtid) @@ -171,7 +170,6 @@ void epicsStdCall gphDelete(gphPvt *pgphPvt, const char *name, void *pvtid) } epicsMutexUnlock(pgphPvt->lock); - return; } void epicsStdCall gphFreeMem(gphPvt *pgphPvt) diff --git a/modules/libcom/src/log/iocLogServer.c b/modules/libcom/src/log/iocLogServer.c index 674175aac..81288d481 100644 --- a/modules/libcom/src/log/iocLogServer.c +++ b/modules/libcom/src/log/iocLogServer.c @@ -711,8 +711,6 @@ static void freeLogClient(struct iocLogClient *pclient) epicsSocketDestroy ( pclient->insock ); free (pclient); - - return; } diff --git a/modules/libcom/src/log/logClient.c b/modules/libcom/src/log/logClient.c index 89c79a316..7840211fd 100644 --- a/modules/libcom/src/log/logClient.c +++ b/modules/libcom/src/log/logClient.c @@ -559,7 +559,7 @@ void epicsStdCall iocLogPrefix(const char * prefix) if (logClientPrefix) { /* No error message if the new prefix is identical to the old one */ - if (strcmp(logClientPrefix, prefix)) + if (strcmp(logClientPrefix, prefix)!=0) printf (ERL_WARNING " iocLogPrefix: The prefix was already set to " "\"%s\" and can't be changed.\n", logClientPrefix); return; diff --git a/modules/libcom/src/macLib/macCore.c b/modules/libcom/src/macLib/macCore.c index ee511d6ab..95cc441e9 100644 --- a/modules/libcom/src/macLib/macCore.c +++ b/modules/libcom/src/macLib/macCore.c @@ -72,7 +72,7 @@ static void trans ( MAC_HANDLE *handle, MAC_ENTRY *entry, int level, static void refer ( MAC_HANDLE *handle, MAC_ENTRY *entry, int level, const char **rawval, char **value, char *valend ); -static void cpy2val( const char *src, char **value, char *valend ); +static void cpy2val( const char *src, char **value, const char *valend ); static char *Strdup( const char *string ); @@ -763,8 +763,6 @@ static void trans( MAC_HANDLE *handle, MAC_ENTRY *entry, int level, still there to be seen) */ *rawval = ( *r == '\0' ) ? r - 1 : r; *value = v; - - return; } /* @@ -925,14 +923,13 @@ cleanup: *rawval = r; *value = v; - return; } /* * Copy a string, honoring the 'end of destination string' pointer * Returns with **value pointing to the '\0' terminator */ -static void cpy2val(const char *src, char **value, char *valend) +static void cpy2val(const char *src, char **value, const char *valend) { char *v = *value; while ((v < valend) && (*v = *src++)) { v++; } diff --git a/modules/libcom/src/misc/aToIPAddr.c b/modules/libcom/src/misc/aToIPAddr.c index 4bb2353f7..628884af5 100644 --- a/modules/libcom/src/misc/aToIPAddr.c +++ b/modules/libcom/src/misc/aToIPAddr.c @@ -15,13 +15,10 @@ #include #include +#include "dbDefs.h" #include "epicsTypes.h" #include "osiSock.h" -#ifndef NELEMENTS -#define NELEMENTS(A) (sizeof(A)/sizeof(A[0])) -#endif /*NELEMENTS*/ - /* * addrArrayToUL () */ diff --git a/modules/libcom/src/osi/devLibVME.c b/modules/libcom/src/osi/devLibVME.c index e4d8bd244..0d503b4e1 100644 --- a/modules/libcom/src/osi/devLibVME.c +++ b/modules/libcom/src/osi/devLibVME.c @@ -503,7 +503,7 @@ long devUnregisterAddress( return S_dev_addressNotFound; } - if (strcmp(pOwnerName,pRange->pOwnerName)) { + if (strcmp(pOwnerName,pRange->pOwnerName)!=0) { s = S_dev_addressOverlap; errPrintf ( s, diff --git a/modules/libcom/src/osi/epicsThread.cpp b/modules/libcom/src/osi/epicsThread.cpp index 20b7fed7f..b67c8bf29 100644 --- a/modules/libcom/src/osi/epicsThread.cpp +++ b/modules/libcom/src/osi/epicsThread.cpp @@ -275,18 +275,12 @@ void epicsThread::setPriority (unsigned int priority) throw () bool epicsThread::priorityIsEqual (const epicsThread &otherThread) const throw () { - if ( epicsThreadIsEqual (this->id, otherThread.id) ) { - return true; - } - return false; + return epicsThreadIsEqual (this->id, otherThread.id)!=0; } bool epicsThread::isSuspended () const throw () { - if ( epicsThreadIsSuspended (this->id) ) { - return true; - } - return false; + return epicsThreadIsSuspended (this->id)!=0; } bool epicsThread::operator == (const epicsThread &rhs) const throw () diff --git a/modules/libcom/src/osi/epicsTime.cpp b/modules/libcom/src/osi/epicsTime.cpp index 9d00acec2..43442225e 100644 --- a/modules/libcom/src/osi/epicsTime.cpp +++ b/modules/libcom/src/osi/epicsTime.cpp @@ -44,8 +44,9 @@ void epicsTime::throwError(int code) } -epicsTime::epicsTime ( const epicsTimeStamp & replace ) { - ts = replace; +epicsTime::epicsTime ( const epicsTimeStamp & replace ) + :ts(replace) +{ if(ts.nsec >= nSecPerSec) throw std::logic_error("epicsTimeStamp has overflow in nano-seconds field"); } diff --git a/modules/libcom/src/osi/os/Linux/osdThreadExtra.c b/modules/libcom/src/osi/os/Linux/osdThreadExtra.c index 879e2b97b..813846bc2 100644 --- a/modules/libcom/src/osi/os/Linux/osdThreadExtra.c +++ b/modules/libcom/src/osi/os/Linux/osdThreadExtra.c @@ -58,7 +58,7 @@ static void thread_hook(epicsThreadId pthreadInfo) /* Set the name of the thread's process. Limited to 16 characters. */ char comm[16]; - if (strcmp(pthreadInfo->name, "_main_")) { + if (strcmp(pthreadInfo->name, "_main_") != 0) { snprintf(comm, sizeof(comm), "%s", pthreadInfo->name); prctl(PR_SET_NAME, comm, 0l, 0l, 0l); } diff --git a/modules/libcom/src/osi/osiSock.c b/modules/libcom/src/osi/osiSock.c index e92103aca..4e686749e 100644 --- a/modules/libcom/src/osi/osiSock.c +++ b/modules/libcom/src/osi/osiSock.c @@ -25,7 +25,7 @@ #define nDigitsDottedIP 4u #define chunkSize 8u -#define makeMask(NBITS) ( ( 1u << ( (unsigned) NBITS) ) - 1u ) +#define makeMask(NBITS) ( ( 1u << ( (unsigned) (NBITS)) ) - 1u ) /* * sockAddrAreIdentical() diff --git a/modules/libcom/src/timer/epicsTimer.cpp b/modules/libcom/src/timer/epicsTimer.cpp index 5ebed5a43..2bea637d1 100644 --- a/modules/libcom/src/timer/epicsTimer.cpp +++ b/modules/libcom/src/timer/epicsTimer.cpp @@ -210,7 +210,7 @@ extern "C" epicsTimerQueueId epicsStdCall epicsSingleton < timerQueueActiveMgr > :: reference ref = timerQueueMgrEPICS.getReference (); epicsTimerQueueActiveForC & tmr = - ref->allocate ( ref, okToShare ? true : false, threadPriority ); + ref->allocate ( ref, okToShare != 0, threadPriority ); return &tmr; } catch ( ... ) {