configure: remove -Wno-format-nonliteral
authorSimon Marchi <simon.marchi@efficios.com>
Sun, 15 Mar 2020 20:12:52 +0000 (16:12 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 11 Apr 2020 23:15:17 +0000 (19:15 -0400)
commit900eef7317d3e8b350a93fb8782639845c62c2bd
treec917dd6ba2c33cd7eabf208cb68467b375801d9b
parent25a74feac6681e831f748723353a46ce48155dda
configure: remove -Wno-format-nonliteral

This patch removes all the offending instances of -Wformat-nonliteral
and removes -Wno-format-nonliteral from the warning flags we enable.

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

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

    if (something) {
        pass(msg, value);
    } else {
        fail(msg, 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.

In other places, we manually manipulate and craft format strings, to
I've just disabled the warning there.

The generated SWIG wrapper for the error appending functions cause some
warnings like this:

    bt2/native_bt.c: In function ‘_wrap_current_thread_error_append_cause_from_component__varargs__’:
    bt2/native_bt.c:7839:3: error: format not a string literal, argument types not checked [-Werror=format-nonliteral]
     7839 |   result = (bt_current_thread_error_append_cause_status)bt_current_thread_error_append_cause_from_component(arg1,(char const *)arg2,arg3,(char const *)arg4,ar
    g5);
          |   ^~~~~~

Since we don't actually need these functions from the Python bindings,
I've made SWIG not generate a wrapper for them.

Change-Id: Ic6834dc44abce7be8e113e9cbf3f33a3f09809e2
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3233
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
configure.ac
src/autodisc/autodisc.c
src/bindings/python/bt2/bt2/native_bt.i
src/bindings/python/bt2/bt2/native_bt_component_class.i.h
src/common/common.c
src/lib/lib-logging.c
src/plugins/text/details/write.c
src/string-format/format-error.c
tests/param-validation/test_param_validation.c
tests/utils/tap/tap.c
This page took 0.02675 seconds and 4 git commands to generate.