fix: build failure on ppc64el with '-Werror=format-overflow='
Enabling optimizations makes gcc inline bt_plugin_so_shared_lib_handle_create
into bt_plugin_so_create_all_from_static. That call site passes path == NULL,
so gcc notices that the argument to %s will always be NULL. This is
undefined behavior even if glibc will print "(null)".
Passing NULL to this function just means that we are loading the static
plugins, built-in Babeltrace. So there's no path to a shared object file,
in this case explicitly print "(null)".
In file included from ../../../src/lib/logging.h:35,
from plugin-so.c:27:
In function ‘bt_plugin_so_shared_lib_handle_create’,
inlined from ‘bt_plugin_so_create_all_from_static’ at plugin-so.c:1393:11:
../../../src/logging/log.h:811:6: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
811 | _bt_log_write_d(_BT_LOG_SRCLOC_FUNCTION, __FILE__, __LINE__, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
812 | lvl, tag, __VA_ARGS__); \
| ~~~~~~~~~~~~~~~~~~~~~~
../../../src/logging/log.h:897:4: note: in expansion of macro ‘BT_LOG_WRITE’
897 | BT_LOG_WRITE(BT_LOG_INFO, _BT_LOG_TAG, __VA_ARGS__)
| ^~~~~~~~~~~~
plugin-so.c:174:2: note: in expansion of macro ‘BT_LOGI’
174 | BT_LOGI("Creating shared library handle: path=\"%s\"", path);
| ^~~~~~~
plugin-so.c: In function ‘bt_plugin_so_create_all_from_static’:
plugin-so.c:174:50: note: format string is defined here
174 | BT_LOGI("Creating shared library handle: path=\"%s\"", path);
| ^~
In file included from ../../../src/lib/logging.h:35,
from plugin-so.c:27:
In function ‘bt_plugin_so_shared_lib_handle_create’,
inlined from ‘bt_plugin_so_create_all_from_static’ at plugin-so.c:1393:11:
../../../src/logging/log.h:811:6: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
811 | _bt_log_write_d(_BT_LOG_SRCLOC_FUNCTION, __FILE__, __LINE__, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
812 | lvl, tag, __VA_ARGS__); \
| ~~~~~~~~~~~~~~~~~~~~~~
../../../src/logging/log.h:897:4: note: in expansion of macro ‘BT_LOG_WRITE’
897 | BT_LOG_WRITE(BT_LOG_INFO, _BT_LOG_TAG, __VA_ARGS__)
| ^~~~~~~~~~~~
plugin-so.c:217:3: note: in expansion of macro ‘BT_LOGI’
217 | BT_LOGI("Created shared library handle: path=\"%s\", addr=%p",
| ^~~~~~~
plugin-so.c: In function ‘bt_plugin_so_create_all_from_static’:
plugin-so.c:217:50: note: format string is defined here
217 | BT_LOGI("Created shared library handle: path=\"%s\", addr=%p",
| ^~
cc1: all warnings being treated as errors
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: Ia727b37b04cb10f29e705f21c6889035a304a822
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2894
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
This page took 0.025234 seconds and 4 git commands to generate.