[gnome-software] meson: make two compiler warnings fatal
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] meson: make two compiler warnings fatal
- Date: Mon, 18 Nov 2019 17:30:48 +0000 (UTC)
commit 4115298657a592e827c686ea3a7803103771ff8d
Author: Will Thompson <will willthompson co uk>
Date: Fri Nov 15 15:13:24 2019 +0000
meson: make two compiler warnings fatal
I wasted the best part of an hour this morning because I didn't notice
the following warnings (from Endless's branch):
../plugins/eos-blacklist/gs-plugin-eos-blacklist.c: In function 'gs_plugin_setup':
../plugins/eos-blacklist/gs-plugin-eos-blacklist.c:193:36: warning: implicit declaration of function
'flatpak_installation_get_default_locales'; did you mean 'flatpak_installation_get_default_languages'?
[-Wimplicit-function-declaration]
priv->flatpak_default_locales = flatpak_installation_get_default_locales (priv->installation,
&local_error);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flatpak_installation_get_default_languages
../plugins/eos-blacklist/gs-plugin-eos-blacklist.c:193:36: warning: nested extern declaration of
'flatpak_installation_get_default_locales' [-Wnested-externs]
../plugins/eos-blacklist/gs-plugin-eos-blacklist.c:193:34: warning: assignment to 'char **' from
'int' makes pointer from integer without a cast [-Wint-conversion]
priv->flatpak_default_locales = flatpak_installation_get_default_locales (priv->installation,
&local_error);
My Flatpak headers were older than my Flatpak shared library, which did
define the 'flatpak_installation_get_default_locales' symbol. The
default return type, int, is narrower than a pointer on x86_64 so the
pointer was truncated and this would crash at runtime.
Of course, I could have passed `-Dwerror=true` to Meson but I believe
that implicit-function-declaration and nested-externs should always be
fatal, regardless of that setting.
Another option would be to add 'werror=true' to default_options, but I
think this is bad practice: a new compiler version could cause perfectly
good code to stop compiling.
meson.build | 2 ++
1 file changed, 2 insertions(+)
---
diff --git a/meson.build b/meson.build
index bae72315..3a506b6a 100644
--- a/meson.build
+++ b/meson.build
@@ -34,6 +34,7 @@ test_args = [
'-Wformat-signedness',
'-Wignored-qualifiers',
'-Wimplicit-function-declaration',
+ '-Werror=implicit-function-declaration',
'-Winit-self',
'-Winline',
'-Wmissing-declarations',
@@ -43,6 +44,7 @@ test_args = [
'-Wmissing-parameter-type',
'-Wmissing-prototypes',
'-Wnested-externs',
+ '-Werror=nested-externs',
'-Wno-discarded-qualifiers',
'-Wno-missing-field-initializers',
'-Wno-strict-aliasing',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]