[libvirt PATCH 6/6] meson: don't probe for -Werror if -Dwerror is enabled

Daniel P. Berrangé posted 6 patches 4 years, 10 months ago
[libvirt PATCH 6/6] meson: don't probe for -Werror if -Dwerror is enabled
Posted by Daniel P. Berrangé 4 years, 10 months ago
Meson has its own mechanism to turn on -Werror with the -Dwerror option.
If this is set, then there is no reason for libvirt to check for -Werror
itself.

We remove the summary line output because it is potentially misleading
when libvirt hasn't enabled -Werror, but meson has.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 meson.build | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 9fda0c7948..725d0e1cf0 100644
--- a/meson.build
+++ b/meson.build
@@ -207,7 +207,7 @@ cc = meson.get_compiler('c')
 cc_flags = []
 
 git_werror = get_option('git_werror')
-if git_werror.enabled() or git_werror.auto() and git
+if (git_werror.enabled() or git_werror.auto()) and git and not get_option('werror')
   cc_flags += [ '-Werror' ]
 endif
 
@@ -2300,7 +2300,6 @@ else
   loader_res = ''
 endif
 misc_summary = {
-  'Use -Werror': cc_flags.contains('-Werror'),
   'Warning Flags': supported_cc_flags,
   'docs': gen_docs,
   'tests': build_tests,
-- 
2.30.2

Re: [libvirt PATCH 6/6] meson: don't probe for -Werror if -Dwerror is enabled
Posted by Pavel Hrdina 4 years, 10 months ago
On Thu, Apr 08, 2021 at 11:58:23AM +0100, Daniel P. Berrangé wrote:
> Meson has its own mechanism to turn on -Werror with the -Dwerror option.
> If this is set, then there is no reason for libvirt to check for -Werror
> itself.

s/-Dwerror/--werror/ here and in $SUBJECT

In meson --werror is build-in option so it is not used together with the
-D{name} option.

> We remove the summary line output because it is potentially misleading
> when libvirt hasn't enabled -Werror, but meson has.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  meson.build | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 9fda0c7948..725d0e1cf0 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -207,7 +207,7 @@ cc = meson.get_compiler('c')
>  cc_flags = []
>  
>  git_werror = get_option('git_werror')
> -if git_werror.enabled() or git_werror.auto() and git
> +if (git_werror.enabled() or git_werror.auto()) and git and not get_option('werror')
>    cc_flags += [ '-Werror' ]
>  endif
>  
> @@ -2300,7 +2300,6 @@ else
>    loader_res = ''
>  endif
>  misc_summary = {
> -  'Use -Werror': cc_flags.contains('-Werror'),
>    'Warning Flags': supported_cc_flags,
>    'docs': gen_docs,
>    'tests': build_tests,
> -- 
> 2.30.2
>