[PATCH libinput 2/2] enable -Wall -Werror for CFLAGS

Peter Hutterer peter.hutterer at who-t.net
Thu Aug 20 19:05:05 PDT 2015


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?
> 
> 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.

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.

Cheers,
   Peter


More information about the wayland-devel mailing list