configure: enable -Wsuggest-attribute=format
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 16 Mar 2020 22:38:45 +0000 (18:38 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 18 Mar 2020 16:50:35 +0000 (12:50 -0400)
commit8b305066676fc7aa433e8eb668f9de8802008025
treeee959157cf88d3ab572150cddf2f79ab1909dbbc
parent28ba44ad9ca14153e96c94a9100423ea224c1af3
configure: enable -Wsuggest-attribute=format

The -Wsuggest-attribute=format warning makes the compiler suggest places
where __attribute__((format(...))) would likely be useful.  This patch
turns it on and adds such attributes everywhere my compiler (GCC 9)
suggested to add them.

In cases where we re-use the same format string multiple times, like:

    const char *const msg = "Hello %d\n";

    BT_LOGE(msg, some_value);
    BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_MESSAGE_ITERATOR("modname", msg, some_value);

... my compiler (gcc (Arch Linux 9.2.1+20200130-2) 9.2.1 20200130)
complains that the format string is not a literal, even though the `msg`
variable is const and assigned a literal.  I've replaced these with a
macro.

Change-Id: I40dd2e70649ec2b651e0109097c217ca9557ad69
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3232
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
configure.ac
include/babeltrace2/babeltrace.h
include/babeltrace2/error-reporting.h
src/argpar/argpar.c
src/bindings/python/bt2/bt2/native_bt.i
src/bindings/python/bt2/bt2/native_bt_autodisc.i.h
src/bindings/python/bt2/bt2/native_bt_component_class.i.h
src/common/common.h
src/lib/error.h
src/logging/log.c
src/plugins/common/param-validation/param-validation.h
This page took 0.025996 seconds and 4 git commands to generate.