From 2559e1a3b76560b66314b24c8e724dfb144f8095 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 7 Jul 2012 13:50:55 -0500 Subject: [PATCH] Clean up build warnings from clang. --- src/ca/client/perl/Cap5.xs | 4 +- src/ioc/db/recGbl.c | 11 ++++++ src/ioc/db/recGbl.h | 55 +++++++++++++--------------- src/ioc/db/test/arrShorthandTest.c | 2 +- src/ioc/db/test/chfPluginTest.c | 2 +- src/ioc/dbtemplate/msi.c | 3 +- src/ioc/dbtemplate/test/dbltExpand.c | 2 +- src/libCom/as/asLibRoutines.c | 4 +- src/libCom/error/errlog.c | 4 +- src/std/filters/test/arrTest.cpp | 4 +- src/std/filters/test/dbndTest.c | 2 +- src/std/filters/test/syncTest.c | 2 +- 12 files changed, 50 insertions(+), 45 deletions(-) diff --git a/src/ca/client/perl/Cap5.xs b/src/ca/client/perl/Cap5.xs index c3e4d0e50..9b6150d9d 100644 --- a/src/ca/client/perl/Cap5.xs +++ b/src/ca/client/perl/Cap5.xs @@ -446,7 +446,7 @@ SV * CA_new(const char *class, const char *name, ...) { SvREADONLY_on(ca_obj); pch->chan_ref = ca_ref; - SvREFCNT_inc(ca_ref); + (void) SvREFCNT_inc(ca_ref); if (items > 2 && SvOK(ST(2))) { @@ -943,7 +943,7 @@ SV * CA_create_subscription(SV *ca_ref, const char *mask_str, SV *sub, ...) { sv_setiv(mon_obj, (IV)event); SvREADONLY_on(mon_obj); - SvREFCNT_inc(mon_ref); + (void) SvREFCNT_inc(mon_ref); return mon_ref; diff --git a/src/ioc/db/recGbl.c b/src/ioc/db/recGbl.c index 80c55eb64..c07e38235 100644 --- a/src/ioc/db/recGbl.c +++ b/src/ioc/db/recGbl.c @@ -213,6 +213,17 @@ unsigned short epicsShareAPI recGblResetAlarms(void *precord) } return val_mask; } + +int recGblSetSevr(void *precord, epicsEnum16 new_stat, epicsEnum16 new_sevr) +{ + struct dbCommon *prec = precord; + if (prec->nsev < new_sevr) { + prec->nsta = new_stat; + prec->nsev = new_sevr; + return TRUE; + } + return FALSE; +} void epicsShareAPI recGblFwdLink(void *precord) { diff --git a/src/ioc/db/recGbl.h b/src/ioc/db/recGbl.h index 888d00977..64db229ed 100644 --- a/src/ioc/db/recGbl.h +++ b/src/ioc/db/recGbl.h @@ -1,10 +1,9 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ /* recGbl.h */ @@ -15,6 +14,7 @@ #ifndef INCrecGblh #define INCrecGblh 1 +#include "epicsTypes.h" #include "shareLib.h" #ifdef __cplusplus @@ -23,13 +23,6 @@ extern "C" { /*************************************************************************/ -#define recGblSetSevr(PREC,NSTA,NSEV) \ -(\ - ((PREC)->nsev<(NSEV))\ - ? ((PREC)->nsta=(NSTA),(PREC)->nsev=(NSEV),TRUE)\ - : FALSE\ -) - /* Structures needed for args */ struct link; @@ -42,31 +35,33 @@ struct dbCommon; /* Hook Routine */ typedef void (*RECGBL_ALARM_HOOK_ROUTINE)(struct dbCommon *prec, - unsigned short prev_sevr, unsigned short prev_stat); + epicsEnum16 prev_sevr, epicsEnum16 prev_stat); extern RECGBL_ALARM_HOOK_ROUTINE recGblAlarmHook; /* Global Record Support Routines */ -epicsShareFunc void epicsShareAPI recGblDbaddrError( - long status, const struct dbAddr *paddr, const char *pcaller_name); -epicsShareFunc void epicsShareAPI recGblRecordError( - long status, void *precord, const char *pcaller_name); -epicsShareFunc void epicsShareAPI recGblRecSupError( - long status, const struct dbAddr *paddr, const char *pcaller_name, const char *psupport_name); -epicsShareFunc void epicsShareAPI recGblGetGraphicDouble( - const struct dbAddr *paddr, struct dbr_grDouble *pgd); -epicsShareFunc void epicsShareAPI recGblGetControlDouble( +epicsShareFunc void recGblDbaddrError(long status, const struct dbAddr *paddr, + const char *pcaller_name); +epicsShareFunc void recGblRecordError(long status, void *precord, + const char *pcaller_name); +epicsShareFunc void recGblRecSupError(long status, const struct dbAddr *paddr, + const char *pcaller_name, const char *psupport_name); +epicsShareFunc void recGblGetGraphicDouble(const struct dbAddr *paddr, + struct dbr_grDouble *pgd); +epicsShareFunc void recGblGetControlDouble( const struct dbAddr *paddr, struct dbr_ctrlDouble *pcd); -epicsShareFunc void epicsShareAPI recGblGetAlarmDouble( - const struct dbAddr *paddr, struct dbr_alDouble *pad); -epicsShareFunc void epicsShareAPI recGblGetPrec( - const struct dbAddr *paddr, long *pprecision); -epicsShareFunc int epicsShareAPI recGblInitConstantLink( - struct link *plink,short dbftype,void *pdest); -epicsShareFunc unsigned short epicsShareAPI recGblResetAlarms(void *precord); -epicsShareFunc void epicsShareAPI recGblFwdLink(void *precord); -epicsShareFunc void epicsShareAPI recGblGetTimeStamp(void *precord); -epicsShareFunc void epicsShareAPI recGblTSELwasModified(struct link *plink); +epicsShareFunc void recGblGetAlarmDouble(const struct dbAddr *paddr, + struct dbr_alDouble *pad); +epicsShareFunc void recGblGetPrec(const struct dbAddr *paddr, + long *pprecision); +epicsShareFunc int recGblInitConstantLink(struct link *plink, + short dbftype, void *pdest); +epicsShareFunc unsigned short recGblResetAlarms(void *precord); +epicsShareFunc int recGblSetSevr(void *precord, epicsEnum16 new_stat, + epicsEnum16 new_sevr); +epicsShareFunc void recGblFwdLink(void *precord); +epicsShareFunc void recGblGetTimeStamp(void *precord); +epicsShareFunc void recGblTSELwasModified(struct link *plink); #ifdef __cplusplus } diff --git a/src/ioc/db/test/arrShorthandTest.c b/src/ioc/db/test/arrShorthandTest.c index 77c47afe4..79f061310 100644 --- a/src/ioc/db/test/arrShorthandTest.c +++ b/src/ioc/db/test/arrShorthandTest.c @@ -73,7 +73,7 @@ static int checkValues(epicsUInt32 s, epicsUInt32 i, epicsUInt32 e) { static void testHead (char* title) { testDiag("--------------------------------------------------------"); - testDiag(title); + testDiag("%s", title); testDiag("--------------------------------------------------------"); } diff --git a/src/ioc/db/test/chfPluginTest.c b/src/ioc/db/test/chfPluginTest.c index d1ce76948..fdb5bc84f 100644 --- a/src/ioc/db/test/chfPluginTest.c +++ b/src/ioc/db/test/chfPluginTest.c @@ -467,7 +467,7 @@ static int checkValues(myStruct *my, static void testHead (char* title) { testDiag("--------------------------------------------------------"); - testDiag(title); + testDiag("%s", title); testDiag("--------------------------------------------------------"); } diff --git a/src/ioc/dbtemplate/msi.c b/src/ioc/dbtemplate/msi.c index b2733199b..55eb70af7 100644 --- a/src/ioc/dbtemplate/msi.c +++ b/src/ioc/dbtemplate/msi.c @@ -826,7 +826,8 @@ static void catMacroReplacements(subInfo *psubInfo,const char *value) newsize = psubInfo->curLength + len + 1; newbuf = calloc(1,newsize); if(!newbuf) { - fprintf(stderr,"calloc failed for size %Zu\n",newsize); + fprintf(stderr,"calloc failed for size %lu\n", + (unsigned long) newsize); exit(1); } if(psubInfo->macroReplacements) { diff --git a/src/ioc/dbtemplate/test/dbltExpand.c b/src/ioc/dbtemplate/test/dbltExpand.c index 6326d288e..4fda7e30e 100644 --- a/src/ioc/dbtemplate/test/dbltExpand.c +++ b/src/ioc/dbtemplate/test/dbltExpand.c @@ -70,7 +70,7 @@ int dbLoadRecords(const char *file, const char *macros) } macExpandString(macHandle, input_buffer, output_buffer, BUFFER_SIZE-1); - printf(output_buffer); + printf("%s", output_buffer); if (macHandle) macDeleteHandle(macHandle); diff --git a/src/libCom/as/asLibRoutines.c b/src/libCom/as/asLibRoutines.c index 8c07a82ba..83f6629e6 100644 --- a/src/libCom/as/asLibRoutines.c +++ b/src/libCom/as/asLibRoutines.c @@ -607,7 +607,7 @@ int epicsShareAPI asDumpFP( fprintf(fp," %s",asLevelName[pasgclient->level]); else fprintf(fp," Illegal Level %d",pasgclient->level); - if(pasgclient->access>=0 && pasgclient->access<=2) + if(pasgclient->access<=2) fprintf(fp," %s %s", asAccessName[pasgclient->access], asTrapOption[pasgclient->trapMask]); @@ -812,7 +812,7 @@ int epicsShareAPI asDumpMemFP(FILE *fp,const char *asgname, fprintf(fp," %s",asLevelName[pasgclient->level]); else fprintf(fp," Illegal Level %d",pasgclient->level); - if(pasgclient->access>=0 && pasgclient->access<=2) + if(pasgclient->access<=2) fprintf(fp," %s %s", asAccessName[pasgclient->access], asTrapOption[pasgclient->trapMask]); diff --git a/src/libCom/error/errlog.c b/src/libCom/error/errlog.c index c5834057b..c8ec6ce64 100644 --- a/src/libCom/error/errlog.c +++ b/src/libCom/error/errlog.c @@ -266,10 +266,8 @@ epicsShareFunc int errlogSevVprintf( epicsShareFunc char * epicsShareAPI errlogGetSevEnumString( const errlogSevEnum severity) { - static char unknown[] = "unknown"; - errlogInit(0); - if (severity < 0 || severity > 3) return unknown; + if (severity > 3) return "unknown"; return errlogSevEnumString[severity]; } diff --git a/src/std/filters/test/arrTest.cpp b/src/std/filters/test/arrTest.cpp index c66dfa9c0..48a34d368 100644 --- a/src/std/filters/test/arrTest.cpp +++ b/src/std/filters/test/arrTest.cpp @@ -112,9 +112,9 @@ static void createAndOpen(const char *chan, const char *json, const char *type, static void testHead (const char *title, const char *typ = "") { const char *line = "------------------------------------------------------------------------------"; - testDiag(line); + testDiag("%s", line); testDiag(title, typ); - testDiag(line); + testDiag("%s", line); } #define TEST1(Size, Offset, Incr, Text) \ diff --git a/src/std/filters/test/dbndTest.c b/src/std/filters/test/dbndTest.c index d9786e110..05f9f1627 100644 --- a/src/std/filters/test/dbndTest.c +++ b/src/std/filters/test/dbndTest.c @@ -95,7 +95,7 @@ static void mustPassTwice(dbChannel *pch, db_field_log *pfl2, char* m, double d, static void testHead (char* title) { testDiag("--------------------------------------------------------"); - testDiag(title); + testDiag("%s", title); testDiag("--------------------------------------------------------"); } diff --git a/src/std/filters/test/syncTest.c b/src/std/filters/test/syncTest.c index 87e1630ec..125aab45d 100644 --- a/src/std/filters/test/syncTest.c +++ b/src/std/filters/test/syncTest.c @@ -60,7 +60,7 @@ static void fl_setup(dbChannel *chan, db_field_log *pfl, long val) { static void testHead (char* title) { testDiag("--------------------------------------------------------"); - testDiag(title); + testDiag("%s", title); testDiag("--------------------------------------------------------"); }