Add -Werror=implicit-function-declaration to AM_CFLAGS
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Wed, 8 May 2019 17:50:51 +0000 (13:50 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 9 May 2019 15:17:57 +0000 (11:17 -0400)
commitf9ddd0995e0b879f9b592e398d37bd1273a0ccb7
tree5672a1a2ec0eb367c0a3ad17db95fee540442d0e
parent6d0771255bd74f9a73dec58d337df72b1cd3b612
Add -Werror=implicit-function-declaration to AM_CFLAGS

Implicit declaration of function is most likely always a bad thing.

Implicit declaration of function is particularly problematic with
Babeltrace 2 because of its plugin system. Currently, when building a
plugin shared object, the compiler issues a warning when it encounters
an implicit declaration but will create the .so just fine but with the
implicit function marked as undefined, as expected by the standard prior
 to C99.

When trying to load a Babeltrace plugin with an undefined symbol, glib's
`g_module_open()` fails and Babeltrace then considers that this .so is
not a valid Babeltrace plugin.

A failure to load a plugin is not a error because we want Babeltrace to
be able to list/use every plugins in a given directory by looking at
every .so file. So we can't simply return an error in those cases.

Since Babeltrace marks plugins with undefined symbols as invalid they
can't be used in a graph.

This problem is caused when a typo in a function name finds its way into
the code and a warning message is ignored. It can also happen when the
code uses a function of more recent library than what is currently
installed on the system.

So, to ensure this never happens, we promote the
`-Wimplicit-function-declaration` warning to the rank of compilation
error.

This is diagnostic has been supported by GCC since v4.8 and Clang since
v4 at least so we believe it's safe to enable it by default.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ia43b4f8c85b6a6cb7557f084a2bed07e7ec043dc
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1278
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
configure.ac
This page took 0.024732 seconds and 4 git commands to generate.