Skip to content

Commit 70d2960

Browse files
authored
Merge d9dd6cb into 5eff380
2 parents 5eff380 + d9dd6cb commit 70d2960

File tree

9 files changed

+42
-19
lines changed

9 files changed

+42
-19
lines changed

.github/workflows/ci-scripts-build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,15 @@ jobs:
133133

134134
- os: windows-2019
135135
cmp: vs2019
136-
configuration: default
136+
configuration: debug
137137
name: "Win2019 MSC-19"
138+
extra: "CMD_CXXFLAGS=-analysis"
138139

139140
- os: windows-2019
140141
cmp: vs2019
141-
configuration: static
142+
configuration: static-debug
142143
name: "Win2019 MSC-19, static"
144+
extra: "CMD_CXXFLAGS=-analysis"
143145

144146
- os: windows-2019
145147
cmp: vs2019

modules/database/src/ioc/db/recGbl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ DBCORE_API void recGblInheritSevr(int msMode, void *precord, epicsEnum16 stat,
7575
epicsEnum16 sevr);
7676
DBCORE_API int recGblSetSevrMsg(void *precord, epicsEnum16 new_stat,
7777
epicsEnum16 new_sevr,
78-
const char *msg, ...) EPICS_PRINTF_STYLE(4,5);
78+
EPICS_PRINTF_FMT(const char *msg), ...) EPICS_PRINTF_STYLE(4,5);
7979
DBCORE_API int recGblSetSevrVMsg(void *precord, epicsEnum16 new_stat,
8080
epicsEnum16 new_sevr,
8181
const char *msg, va_list args);

modules/database/src/ioc/dbStatic/dbStaticPvt.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ char *dbRecordName(DBENTRY *pdbentry);
3939
char *dbGetStringNum(DBENTRY *pdbentry);
4040
long dbPutStringNum(DBENTRY *pdbentry,const char *pstring);
4141

42-
void dbMsgPrint(DBENTRY *pdbentry, const char *fmt, ...) EPICS_PRINTF_STYLE(2,3);
42+
void dbMsgPrint(
43+
DBENTRY *pdbentry, EPICS_PRINTF_FMT(const char *fmt), ...
44+
) EPICS_PRINTF_STYLE(2,3);
4345

4446
void dbPutStringSuggest(DBENTRY *pdbentry, const char *pstring);
4547

modules/libcom/src/error/errlog.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ LIBCOM_API extern int errVerbose;
9797
* that the output is sent to the errlog task. Unless configured not to, the output
9898
* will appear on the console as well.
9999
*/
100-
LIBCOM_API int errlogPrintf(const char *pformat, ...)
100+
LIBCOM_API int errlogPrintf(EPICS_PRINTF_FMT(const char *pformat), ...)
101101
EPICS_PRINTF_STYLE(1,2);
102102

103103
/**
@@ -118,7 +118,8 @@ LIBCOM_API int errlogVprintf(const char *pformat, va_list pvar);
118118
* \return int Consult printf documentation in C standard library
119119
*/
120120
LIBCOM_API int errlogSevPrintf(const errlogSevEnum severity,
121-
const char *pformat, ...) EPICS_PRINTF_STYLE(2,3);
121+
EPICS_PRINTF_FMT(const char *pformat), ...
122+
) EPICS_PRINTF_STYLE(2,3);
122123

123124
/**
124125
* This function is like ::errlogVprintf except that it adds the severity to the beginning
@@ -239,11 +240,14 @@ LIBCOM_API void errlogFlush(void);
239240
* The remaining arguments are just like the arguments to the C printf routine.
240241
* ::errVerbose determines if the filename and line number are shown.
241242
*/
242-
LIBCOM_API void errPrintf(long status, const char *pFileName, int lineno,
243-
const char *pformat, ...) EPICS_PRINTF_STYLE(4,5);
244-
245-
LIBCOM_API int errlogPrintfNoConsole(const char *pformat, ...)
246-
EPICS_PRINTF_STYLE(1,2);
243+
LIBCOM_API void errPrintf(
244+
long status, const char *pFileName, int lineno,
245+
EPICS_PRINTF_FMT(const char *pformat), ...
246+
) EPICS_PRINTF_STYLE(4,5);
247+
248+
LIBCOM_API int errlogPrintfNoConsole(
249+
EPICS_PRINTF_FMT(const char *pformat), ...
250+
) EPICS_PRINTF_STYLE(1,2);
247251
LIBCOM_API int errlogVprintfNoConsole(const char *pformat,va_list pvar);
248252

249253
/**

modules/libcom/src/misc/cantProceed.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ extern "C" {
4343
* \param errorMessage A printf-style error message describing the error.
4444
* \param ... Any parameters required for the error message.
4545
*/
46-
LIBCOM_API void cantProceed(const char *errorMessage, ...)
47-
EPICS_PRINTF_STYLE(1,2);
46+
LIBCOM_API void cantProceed(
47+
EPICS_PRINTF_FMT(const char *errorMessage), ...
48+
) EPICS_PRINTF_STYLE(1,2);
4849

4950
/** \name Memory Allocation Functions
5051
* These versions of calloc() and malloc() never fail, they suspend the

modules/libcom/src/misc/epicsUnitTest.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ LIBCOM_API void testPlan(int tests);
174174
* \param ... Any parameters required for the format string.
175175
* \return The value of \p pass.
176176
*/
177-
LIBCOM_API int testOk(int pass, const char *fmt, ...)
177+
LIBCOM_API int testOk(int pass, EPICS_PRINTF_FMT(const char *fmt), ...)
178178
EPICS_PRINTF_STYLE(2, 3);
179179
/** \brief Test result using expression as description
180180
* \param cond Expression to be evaluated and displayed.
@@ -192,13 +192,13 @@ LIBCOM_API int testOkV(int pass, const char *fmt, va_list pvar);
192192
* \param fmt A printf-style format string describing the test.
193193
* \param ... Any parameters required for the format string.
194194
*/
195-
LIBCOM_API void testPass(const char *fmt, ...)
195+
LIBCOM_API void testPass(EPICS_PRINTF_FMT(const char *fmt), ...)
196196
EPICS_PRINTF_STYLE(1, 2);
197197
/** \brief Failing test result with printf-style description.
198198
* \param fmt A printf-style format string describing the test.
199199
* \param ... Any parameters required for the format string.
200200
*/
201-
LIBCOM_API void testFail(const char *fmt, ...)
201+
LIBCOM_API void testFail(EPICS_PRINTF_FMT(const char *fmt), ...)
202202
EPICS_PRINTF_STYLE(1, 2);
203203
/** @} */
204204

@@ -223,15 +223,15 @@ LIBCOM_API void testTodoEnd(void);
223223
* \param fmt A printf-style format string giving the reason for stopping.
224224
* \param ... Any parameters required for the format string.
225225
*/
226-
LIBCOM_API void testAbort(const char *fmt, ...)
226+
LIBCOM_API void testAbort(EPICS_PRINTF_FMT(const char *fmt), ...)
227227
EPICS_PRINTF_STYLE(1, 2);
228228
/** @} */
229229

230230
/** \brief Output additional diagnostics
231231
* \param fmt A printf-style format string containing diagnostic information.
232232
* \param ... Any parameters required for the format string.
233233
*/
234-
LIBCOM_API int testDiag(const char *fmt, ...)
234+
LIBCOM_API int testDiag(EPICS_PRINTF_FMT(const char *fmt), ...)
235235
EPICS_PRINTF_STYLE(1, 2);
236236
/** \brief Mark the end of testing.
237237
*/

modules/libcom/src/osi/compiler/msvc/compilerSpecific.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,11 @@
4444

4545
#endif /* __cplusplus */
4646

47+
/*
48+
* Enable format-string checking if compiler supports it (if msvc is 2012 or newer)
49+
*/
50+
#if _MSC_VER >= 1700
51+
# define EPICS_PRINTF_FMT(a) _Printf_format_string_ a
52+
#endif
4753

4854
#endif /* ifndef compilerSpecific_h */

modules/libcom/src/osi/compilerDependencies.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,11 @@
6161
#endif
6262
#endif
6363

64+
#ifndef EPICS_PRINTF_FMT
65+
/*
66+
* No format-string checking annotation
67+
*/
68+
# define EPICS_PRINTF_FMT(a) a
69+
#endif
70+
6471
#endif /* ifndef compilerDependencies_h */

modules/libcom/src/osi/epicsStdio.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ extern "C" {
130130
* output has been truncated if the return value is `size` or more.
131131
*/
132132
LIBCOM_API int epicsStdCall epicsSnprintf(
133-
char *str, size_t size, const char *format, ...) EPICS_PRINTF_STYLE(3,4);
133+
char *str, size_t size, EPICS_PRINTF_FMT(const char *format), ...
134+
) EPICS_PRINTF_STYLE(3,4);
134135
/**
135136
* \brief epicsVsnprintf() is meant to have the same semantics as the C99
136137
* function vsnprintf()

0 commit comments

Comments
 (0)