summaryrefslogtreecommitdiffstats
path: root/lib/yang_translator.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2023-01-26 14:53:47 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2023-01-27 12:01:20 +0100
commitc84e51870940311bb6ec67d8b192da1ce32cba8f (patch)
tree5d1c214da53ca54b575e0b9e7c66d3c2422b1751 /lib/yang_translator.c
parent*: apply proper format string attributes (diff)
downloadfrr-c84e51870940311bb6ec67d8b192da1ce32cba8f.tar.xz
frr-c84e51870940311bb6ec67d8b192da1ce32cba8f.zip
*: 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/yang_translator.c')
-rw-r--r--lib/yang_translator.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/yang_translator.c b/lib/yang_translator.c
index d562e4d29..67b7f9aa7 100644
--- a/lib/yang_translator.c
+++ b/lib/yang_translator.c
@@ -339,8 +339,12 @@ yang_translate_xpath(const struct yang_translator *translator, int dir,
if (!mapping)
return YANG_TRANSLATE_NOTFOUND;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+ /* processing format strings from mapping node... */
n = sscanf(xpath, mapping->xpath_from_fmt, keys[0], keys[1], keys[2],
keys[3]);
+#pragma GCC diagnostic pop
if (n < 0) {
flog_warn(EC_LIB_YANG_TRANSLATION_ERROR,
"%s: sscanf() failed: %s", __func__,
@@ -348,8 +352,12 @@ yang_translate_xpath(const struct yang_translator *translator, int dir,
return YANG_TRANSLATE_FAILURE;
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+ /* processing format strings from mapping node... */
snprintf(xpath, xpath_len, mapping->xpath_to_fmt, keys[0], keys[1],
keys[2], keys[3]);
+#pragma GCC diagnostic pop
return YANG_TRANSLATE_SUCCESS;
}