[libvirt PATCH] meson: add -Wall and -Wextra explicitly for buildtype=plain

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If someone runs `meson setup --buildtype plain` meson ignores
warning_level=2 that is in our meson.build file. The implication is
that Meson will not automatically add -Wall which enables -Wformat.

This breaks building libvirt from git with the buildtype set to plain.

There is an issue reported [1] to not ignore warning_level silently
and the change to ignore it was done by upstream commit [2].

[1] <https://github.com/mesonbuild/meson/issues/7399>
[2] <https://github.com/mesonbuild/meson/commit/8ee1c9a07a3a35e3ed262fbc358fd86c257a966e>

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 meson.build | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index e193166a9b..f38785eeae 100644
--- a/meson.build
+++ b/meson.build
@@ -503,10 +503,6 @@ cc_flags_disabled = [
   # In meson this is specified using 'c_std=gnu99' in project() function.
   '-std=gnu99',
 
-  # In meson this is specified using 'warning_level=2' in project() function.
-  '-Wall',
-  '-Wextra',
-
   # don't care about C++ compiler compat
   '-Wc++-compat',
   '-Wabi',
@@ -573,6 +569,21 @@ cc_flags_disabled = [
   '-Wsuggest-attribute=malloc',
 ]
 
+# In meson this is specified using 'warning_level=2' in project() function.
+# However, meson silently ignores 'warning_level' option with 'buildtype=plain'
+# so we have to enable them explicitly.
+if get_option('buildtype') == 'plain'
+  cc_flags += [
+    '-Wall',
+    '-Wextra',
+  ]
+else
+  cc_flags_disabled += [
+    '-Wall',
+    '-Wextra',
+  ]
+endif
+
 foreach flag : cc_flags_disabled
   if cc_flags.contains(flag)
     error('@0@ is disabled but listed in cc_flags'.format(flag))
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux