configure: enable -Wsuggest-attribute=format
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 20 Aug 2021 19:19:42 +0000 (15:19 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 9 Dec 2021 19:49:05 +0000 (14:49 -0500)
Enable this warning, which suggests adding format attributes to some
functions, to help with format string validation.  Fix the warnings it
generates by using the new ATTR_FORMAT_PRINTF macro.

There is only one spot we can't fix, that is in modprobe.c.  The
compiler suggests we add an attribute to the kmod_set_log_fn
declaration, which we can't do, since it's not our code:

    /home/simark/src/lttng-tools/src/bin/lttng-sessiond/modprobe.c: In function ‘setup_kmod_ctx’:
    /home/simark/src/lttng-tools/src/bin/lttng-sessiond/modprobe.c:286:31: error: argument 2 of ‘kmod_set_log_fn’ might be a candidate for a format attribute [-Werror=suggest-attribute=format]
      286 |         kmod_set_log_fn(*ctx, log_kmod, NULL);
          |                               ^~~~~~~~

I don't see any other choice but to explicitly ignore that spot.

Introduce some macros to abstract how to ignore specific diagnostics.
This is useful since not all compilers support the same diagnostic
flags.  For example, telling clang to ignore -Wsuggest-attribute=format
would give an error.

Change-Id: I71278d7e2cdc66d4bbc59bd966469d0b427e963d
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.026602 seconds and 4 git commands to generate.