[PATCH libinput 2/2] enable -Wall -Werror for CFLAGS
Andreas Pokorny
andreas.pokorny at canonical.com
Fri Aug 21 04:04:13 PDT 2015
Hi,
The sole purpose of Werror is to keep warnings out. But libinput already
did a good job without Wall + Werror being enabled.
On Fri, Aug 21, 2015 at 4:05 AM, Peter Hutterer <peter.hutterer at who-t.net>
wrote:
> On Thu, Aug 20, 2015 at 02:32:23PM +0300, Pekka Paalanen wrote:
> > On Thu, 20 Aug 2015 12:51:38 +0200
> > Andreas Pokorny <andreas.pokorny at canonical.com> wrote:
> >
> > > Just a small change in test is necessary to enable -Wall -Werror.
> > >
> > > Signed-off-by: Andreas Pokorny <andreas.pokorny at canonical.com>
> > > ---
> > > configure.ac | 4 ++--
> > > test/litest.c | 8 ++++++--
> > > 2 files changed, 8 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/configure.ac b/configure.ac
> > > index 885cb39..b7597f0 100644
> > > --- a/configure.ac
> > > +++ b/configure.ac
> > > @@ -87,8 +87,8 @@ AC_CHECK_LIB([m], [atan2])
> > > AC_CHECK_LIB([rt], [clock_gettime])
> > >
> > > if test "x$GCC" = "xyes"; then
> > > - GCC_CXXFLAGS="-Wall -Wextra -Wno-unused-parameter -g
> -fvisibility=hidden"
> > > - GCC_CFLAGS="$GCC_CXXFLAGS -Wmissing-prototypes -Wstrict-prototypes"
> > > + GCC_CXXFLAGS="-Wall -Werror -Wextra -Wno-unused-parameter -g
> -fvisibility=hidden"
> > > + GCC_CFLAGS="$GCC_CXXFLAGS -Wall -Werror -Wmissing-prototypes
> -Wstrict-prototypes"
> >
> > Hi,
> >
> > are you sure you want to force -Werror on everyone? Even distribution
> > builds?
>
Rather force it on the project. I think that developers are usually ahead
of distributions in terms of compiler versions.
> >
> > New compilers come out with new warnings, new or old headers might
> > cause warnings...
> >
> > While checking with colleagues, I was pointed at
> > https://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html
> > Maybe that could inspire something?
> >
>
> yeah, I agree with Pekka here. -Werror is almost always wrong unless you
> added it yourself to the $CFLAGS on the host you're building on.
> Worse, -Werror doesn't actually add anything - the reason these warnings
> haven't been caught before was because they didn't show up. some of them
> depend on compiler versions, library versions, etc.
>
The second warning showed up because I added -Wall which before was only
present in the CXXFLAGS.
You get something out of Werror if you enforce it, and sure Werror does not
add additional warnings.
AX_COMPILER_FLAGS looks interesting, but unsure on the result. the term
> "useful warnings" can be quite project-dependent and adding #pragmas to
> turn
> some of them off isn't helpful either. Haven't tried it yet though.
>
> Merged patch 1/2 though, thanks.
>
Thanks.
regards
Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20150821/09e877e5/attachment-0001.html>
More information about the wayland-devel
mailing list