Fix:
lib/replace/tests/testsuite.c:387:6: error:
'snprintf' will always be truncated; specified size is 3,
but format string expands to at least 5 [-Werror,-Wformat-truncation]
387 | if (snprintf(tmp, 3, "foo%d", 9) != 4) {
| ^
As this is an explicit test of snprintf's truncation behaviour
the warning can be safely suppressed.
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Anoop C S <anoopcs@samba.org>
conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Werror -Wno-error=deprecated-declarations', testflags=True)
conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=tautological-compare', testflags=True)
conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=cast-align', testflags=True)
- conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=format-truncation', testflags=True)
conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=cast-qual', testflags=True)
conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=format-nonliteral', testflags=True)
return true;
}
+/* This test explicitly triggers truncation, so we need to
+ * suppress the warning
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-truncation"
static int test_snprintf(void)
{
char tmp[10];
printf("success: snprintf\n");
return true;
}
+#pragma GCC diagnostic pop
static int test_vasprintf(void)
{