[v2] meson: add option to disable selective werror

Submitted by Marty E. Plummer on Aug. 9, 2018, 5:41 p.m.

Details

Message ID 20180809174143.ryfjp2jaetm5ljhk@proprietary-killer
State New
Headers show
Series "meson: add option to disable selective werror" ( rev: 2 ) in X.org

Not browsing as part of any series.

Commit Message

Marty E. Plummer Aug. 9, 2018, 5:41 p.m.
Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
---
My mistake, missed a colon on the first go around.
 meson.build       | 12 +++++++-----
 meson_options.txt |  2 ++
 2 files changed, 9 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meson.build b/meson.build
index cd1e4a58c..b2c46f730 100644
--- a/meson.build
+++ b/meson.build
@@ -50,11 +50,13 @@  else
 endif
 
 common_wflags = []
-foreach wflag: test_wflags
-    if cc.has_argument(wflag)
-        common_wflags += [ wflag ]
-    endif
-endforeach
+if get_option('selective-werror')
+  foreach wflag: test_wflags
+      if cc.has_argument(wflag)
+          common_wflags += [ wflag ]
+      endif
+  endforeach
+endif
 
 add_global_arguments(common_wflags, language : 'c')
 
diff --git a/meson_options.txt b/meson_options.txt
index 3453b8df5..c7f299a4a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -16,6 +16,8 @@  option('xvfb', type: 'boolean', value: true,
        description: 'Enable Xvfb X server')
 option('xwin', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto',
        description: 'Enable XWin X server')
+option('selective-werror', type: 'boolean', value: true,
+       description: 'Enable selective werror')
 
 option('builder_addr', type: 'string', description: 'Builder address', value: 'xorg@lists.freedesktop.org')
 option('builder_string', type: 'string', description: 'Additional builder string')

Comments

"Marty E. Plummer" <hanetzer@startmail.com> writes:

> Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>

We definitely want our -W flags.  Are you finding that one of the
-Werror ones is throwing errors for you?  If so, let's fix that for
everyone.
On Thu, Aug 9, 2018 at 1:03 PM, Eric Anholt <eric@anholt.net> wrote:
> "Marty E. Plummer" <hanetzer@startmail.com> writes:
>
>> Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
>
> We definitely want our -W flags.  Are you finding that one of the
> -Werror ones is throwing errors for you?  If so, let's fix that for
> everyone.

-Werror is fine for developers, but for distros it's a huge pain.

https://flameeyes.blog/2009/02/25/future-proof-your-code-dont-use-werror/

With every new version of GCC, not only does the set of warnings on by
default change but also its ability to detect warnings (i.e., the same
-Wflag is now more effective). Upgrading GCC already causes lots of
churn, and having to immediately deal with -Werror fall out just makes
this more difficult.
Matt Turner <mattst88@gmail.com> writes:

> On Thu, Aug 9, 2018 at 1:03 PM, Eric Anholt <eric@anholt.net> wrote:
>> "Marty E. Plummer" <hanetzer@startmail.com> writes:
>>
>>> Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
>>
>> We definitely want our -W flags.  Are you finding that one of the
>> -Werror ones is throwing errors for you?  If so, let's fix that for
>> everyone.
>
> -Werror is fine for developers, but for distros it's a huge pain.
>
> https://flameeyes.blog/2009/02/25/future-proof-your-code-dont-use-werror/
>
> With every new version of GCC, not only does the set of warnings on by
> default change but also its ability to detect warnings (i.e., the same
> -Wflag is now more effective). Upgrading GCC already causes lots of
> churn, and having to immediately deal with -Werror fall out just makes
> this more difficult.

I also happen to hate Werror, and I think the solution is to delete it
from meson.build for everyone, not introduce a flag to get the right
behavior.
On Thu, Aug 09, 2018 at 01:03:57PM -0700, Eric Anholt wrote:
> "Marty E. Plummer" <hanetzer@startmail.com> writes:
> 
> > Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
> 
> We definitely want our -W flags.  Are you finding that one of the
> -Werror ones is throwing errors for you?  If so, let's fix that for
> everyone.
Nothing is failing outright, but in gentoo we don't have/allow -Werror
into ebuilds for the end user. Which is why I set the option to default
on, so developers can continue using it as is and distros that flip it
off can do so easily.