Add gcc format-string checking.
This commit is contained in:
@@ -165,6 +165,7 @@ INC += osiWireFormat.h
|
||||
INC += epicsReadline.h
|
||||
INC += epicsMessageQueue.h
|
||||
INC += epicsStdio.h
|
||||
INC += compilerDefs.h
|
||||
|
||||
INC += devLib.h
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "shareLib.h"
|
||||
#include "compilerDefs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -39,11 +40,11 @@ epicsShareExtern char * errlogSevEnumString[];
|
||||
#endif
|
||||
|
||||
epicsShareFunc int errlogPrintf(
|
||||
const char *pformat, ...);
|
||||
const char *pformat, ...) EPICS_PRINTF_STYLE(1,2);
|
||||
epicsShareFunc int errlogVprintf(
|
||||
const char *pformat,va_list pvar);
|
||||
epicsShareFunc int errlogSevPrintf(
|
||||
const errlogSevEnum severity,const char *pformat, ...);
|
||||
const errlogSevEnum severity,const char *pformat, ...) EPICS_PRINTF_STYLE(2,3);
|
||||
epicsShareFunc int errlogSevVprintf(
|
||||
const errlogSevEnum severity,const char *pformat,va_list pvar);
|
||||
epicsShareFunc int epicsShareAPI errlogMessage(
|
||||
@@ -66,7 +67,7 @@ epicsShareFunc void epicsShareAPI errlogFlush(void);
|
||||
|
||||
/*other routines that write to log file*/
|
||||
epicsShareFunc void errPrintf(long status, const char *pFileName,
|
||||
int lineno, const char *pformat, ...);
|
||||
int lineno, const char *pformat, ...) EPICS_PRINTF_STYLE(4,5);
|
||||
|
||||
epicsShareExtern int errVerbose;
|
||||
|
||||
@@ -74,7 +75,7 @@ epicsShareExtern int errVerbose;
|
||||
* the message to appear twice on the console
|
||||
*/
|
||||
epicsShareFunc int errlogPrintfNoConsole(
|
||||
const char *pformat, ...);
|
||||
const char *pformat, ...) EPICS_PRINTF_STYLE(1,2);
|
||||
epicsShareFunc int errlogVprintfNoConsole(
|
||||
const char *pformat,va_list pvar);
|
||||
|
||||
|
||||
@@ -15,13 +15,14 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "shareLib.h"
|
||||
#include "compilerDefs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
epicsShareFunc int epicsShareAPI epicsSnprintf(
|
||||
char *str, size_t size, const char *format, ...);
|
||||
char *str, size_t size, const char *format, ...) EPICS_PRINTF_STYLE(3,4);
|
||||
epicsShareFunc int epicsShareAPI epicsVsnprintf(
|
||||
char *str, size_t size, const char *format, va_list ap);
|
||||
epicsShareFunc FILE * epicsShareAPI epicsTempFile ( void );
|
||||
|
||||
21
src/libCom/osi/os/default/compilerDefs.h
Normal file
21
src/libCom/osi/os/default/compilerDefs.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2003 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
#ifndef _EPICS_COMPILERDEFS_H
|
||||
#define _EPICS_COMPILERDEFS_H
|
||||
|
||||
/*
|
||||
* Compiler-specific definitions
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define EPICS_PRINTF_STYLE(f,a) __attribute__((format(printf,f,a)))
|
||||
#else
|
||||
# define EPICS_PRINTF_STYLE(f,a)
|
||||
#endif
|
||||
|
||||
#endif /* _EPICS_COMPILERDEFS_H */
|
||||
Reference in New Issue
Block a user