diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2023-01-26 14:53:47 +0100 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2023-01-27 12:01:20 +0100 |
| commit | c84e51870940311bb6ec67d8b192da1ce32cba8f (patch) | |
| tree | 5d1c214da53ca54b575e0b9e7c66d3c2422b1751 /lib/printf/vfprintf.c | |
| parent | 0f9de11a11644b77cc60d6ff6ac4519d2e5c29e1 (diff) | |
*: no-warn pragmas for non-const format strings
We do use non-constant/literal format strings in a few places for more
or less valid reasons; put `ignored "-Wformat-nonliteral"` around those
so we can have the warning enabled for everywhere else.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/printf/vfprintf.c')
| -rw-r--r-- | lib/printf/vfprintf.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/printf/vfprintf.c b/lib/printf/vfprintf.c index 49fa2b718f..cc886834fa 100644 --- a/lib/printf/vfprintf.c +++ b/lib/printf/vfprintf.c @@ -504,14 +504,20 @@ reswitch: switch (ch) { fmt[4] = ch; fmt[5] = '\0'; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" snprintf(buf, sizeof(buf), fmt, prec, arg); +#pragma GCC diagnostic pop } else { double arg = GETARG(double); char fmt[5] = "%.*"; fmt[3] = ch; fmt[4] = '\0'; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" snprintf(buf, sizeof(buf), fmt, prec, arg); +#pragma GCC diagnostic pop } cp = buf; /* for proper padding */ |
