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)
commit411b31544f22b773b4aad6cdb81faa81dc05e641
treea38290930650e92905816a8b0bbea057714ab0c7
parent4ff750609549a99f6b318ce600c42c90d4f2e480
configure: enable -Wformat=2

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>
configure.ac
src/bin/lttng/commands/list.cpp
src/common/macros.h
src/common/utils.cpp
src/common/utils.h
src/lib/lttng-ctl/lttng-ctl-health.cpp
tests/regression/ust/linking/Makefile.am
tests/unit/test_payload.cpp
This page took 0.026301 seconds and 4 git commands to generate.