module-template framework: avoid compiler warning in some legal cases

the finalize_it: label is required, but not always used, which each
time results in a compiler warning that needs to be worked around.
Now this is fixed once and for all for gcc and clang - the others
will probably not complain in any case. Great solution until something
comes up that makes us need a revision.
This commit is contained in:
Rainer Gerhards 2017-11-22 11:08:34 +01:00
parent 017a06e433
commit a4c7f2ac81
3 changed files with 2 additions and 2 deletions

View File

@ -809,7 +809,6 @@ ENDnewActInst
BEGINparseSelectorAct
CODESTARTparseSelectorAct
iRet = RS_RET_CONFLINE_UNPROCESSED;
goto finalize_it; /* keep compiler happy (else we get "unused label" error) */
CODE_STD_FINALIZERparseSelectorAct
ENDparseSelectorAct

View File

@ -349,7 +349,7 @@ static rsRetVal parseSelectorAct(uchar **pp, void **ppModData, omodStringRequest
CHKiRet(OMSRconstruct(ppOMSR, NumStrReqEntries));
#define CODE_STD_FINALIZERparseSelectorAct \
finalize_it:\
finalize_it: ATTR_UNUSED; /* semi-colon needed according to gcc doc! */\
if(iRet == RS_RET_OK || iRet == RS_RET_OK_WARN || iRet == RS_RET_SUSPENDED) {\
*ppModData = pData;\
*pp = p;\

View File

@ -51,6 +51,7 @@ extern int src_exists;
#endif
#define ATTR_NORETURN __attribute__ ((noreturn))
#define ATTR_UNUSED __attribute__((unused))
#define ATTR_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
/* ############################################################# *