From 1f2edb69d214c25f75e97bc07c3d3a2f2a103639 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 25 Aug 2023 09:58:35 +0200 Subject: [PATCH] silence -Wformat-security for printfRecord we know what we are doing... right? --- modules/database/src/std/rec/printfRecord.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/database/src/std/rec/printfRecord.c b/modules/database/src/std/rec/printfRecord.c index cf5e4d0c9..0552ff7bb 100644 --- a/modules/database/src/std/rec/printfRecord.c +++ b/modules/database/src/std/rec/printfRecord.c @@ -57,6 +57,14 @@ else \ flags |= F_BADLNK +#ifdef __GNUC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wformat-security" +/* Intentionally passing non-const format string to epicsSnprintf() below. + * Older GCC does not allow pragma GCC within function body. + */ +#endif + static void doPrintf(printfRecord *prec) { const char *pfmt = prec->fmt; @@ -314,6 +322,9 @@ static void doPrintf(printfRecord *prec) prec->len = pval - prec->val; } +#ifdef __GNUC__ +# pragma GCC diagnostic pop +#endif static long init_record(struct dbCommon *pcommon, int pass) {