configure: enable -Wformat=2
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 23 Aug 2021 18:32:51 +0000 (14:32 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 15 Dec 2021 23:35:26 +0000 (18:35 -0500)
The -Wformat=2 diagnostic flag on GCC enables the -Wformat-nonliteral
-Wformat-security diagnostics, which are useful to catch some format
string mistakes.  -Wformat-security is also enabled by default with
Clang, meaning that there were some warnings only appearing with
Clang.

Try to enabled the -Wformat=2 flag to make things more consistent across
compilers and catch more mistakes.

The only issues are these, in tests/regression/ust/linking:

      CC       demo_builtin-demo.o
    In file included from /usr/include/stdio.h:866,
                     from /home/simark/src/lttng-tools/tests/regression/ust/linking/demo.c:9:
    /usr/include/bits/stdio2.h: In function ‘sprintf’:
    /usr/include/bits/stdio2.h:40:35: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
       40 |                                   __va_arg_pack ());
          |                                   ^~~~~~~~~~~~~

The reason this appears is that this directory uses -Wsystem-headers,
making the compiler show diagnostics in headers considered "system
headers".  Manually silence those warnings by disabling
-Wformat-nonliteral in that specific directory.

Change-Id: I4c7991e76b2f5405f3b3397348adb9134de37d41
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>

No differences found
This page took 0.03607 seconds and 4 git commands to generate.