[collectd] [PATCH] Removed the use of -Werror when compiling with gcc

Yves Mettier ymettier at free.fr
Mon Mar 4 09:22:25 CET 2013


Hello,

I had a problem with -Werror 3 or 4 days ago with liboconfig.
There is no prototype for yyparse() and compiling oconfig.c complains.
Compilation fails when using -Werror.

I have not understood why a bug (introduced by my and fixed by me) in 
configure.in that had nothing to do with liboconfig or -Werror raised 
this issue. However, maybe someone should have a look on liboconfig and 
yyparse.

About my bug : I used $SAVE_CFLAGS to save the CFLAGS somewhere and 
restore it somewhere else. I changed the name of my variable and the 
issue disappeared. Note : there is SAVE_CFLAGS somewhere else in 
configure.in and it work. I don't know why.

About yyparse and yacc : parser.y compiles well with bison -y. I failed 
at compiling it with byacc (on Redhat 6).

Well, if some happy hacker wants to play with C/yacc code, enjoy this 
issue. IMHO, it is not very important.

Regards,
Yves

Le 2013-03-02 15:19, Dan Fandrich a écrit :
> While the goal of building warning-free is noble, erroring out
> on warnings by default makes the build too brittle with ever-
> changing warning behaviour in newer versions of gcc.
> ---
>  configure.in                      |    6 +++---
>  src/Makefile.am                   |    2 +-
>  src/libcollectdclient/Makefile.am |    2 +-
>  3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/configure.in b/configure.in
> index 6572a19..7c55827 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -577,7 +577,7 @@ SAVE_CFLAGS="$CFLAGS"
>  # Emulate behavior of src/Makefile.am
>  if test "x$GCC" = "xyes"
>  then
> -	CFLAGS="$CFLAGS -Wall -Werror"
> +	CFLAGS="$CFLAGS -Wall"
>  fi
>
>  AC_CACHE_CHECK([for strtok_r],
> @@ -704,7 +704,7 @@ AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"],
> [have_getutxent="no"])
>  if test "x$GCC" = "xyes"
>  then
>  	SAVE_CFLAGS="$CFLAGS"
> -	CFLAGS="$CFLAGS -Wall -Wextra -Werror"
> +	CFLAGS="$CFLAGS -Wall -Wextra"
>  fi
>
>  AC_CHECK_FUNCS(strptime, [have_strptime="yes"], 
> [have_strptime="no"])
> @@ -3122,7 +3122,7 @@ then
>  	SAVE_LDFLAGS="$LDFLAGS"
>  	# trigger an error if Perl_load_module*() uses 
> __attribute__nonnull__(3)
>  	# (see issues #41 and #42)
> -	CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
> +	CFLAGS="$CFLAGS $PERL_CFLAGS -Wall"
>  	LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
>
>  	AC_CACHE_CHECK([for broken Perl_load_module()],
> diff --git a/src/Makefile.am b/src/Makefile.am
> index c41afb3..3910bfd 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -4,7 +4,7 @@ SUBDIRS += liboconfig
>  endif
>
>  if COMPILER_IS_GCC
> -AM_CFLAGS = -Wall -Werror
> +AM_CFLAGS = -Wall
>  endif
>
>  AM_CPPFLAGS = -DPREFIX='"${prefix}"'
> diff --git a/src/libcollectdclient/Makefile.am
> b/src/libcollectdclient/Makefile.am
> index 1d4dff5..7b2c96e 100644
> --- a/src/libcollectdclient/Makefile.am
> +++ b/src/libcollectdclient/Makefile.am
> @@ -1,7 +1,7 @@
>  AUTOMAKE_OPTIONS = foreign no-dependencies
>
>  if COMPILER_IS_GCC
> -AM_CFLAGS = -Wall -Werror
> +AM_CFLAGS = -Wall
>  endif
>
>  pkginclude_HEADERS = collectd/client.h collectd/network.h
> collectd/network_buffer.h collectd/lcc_features.h

-- 
- Homepage       - http://ymettier.free.fr                             
-
- GPG key        - http://ymettier.free.fr/gpg.txt                     
-
- C en action    - http://ymettier.free.fr/livres/C_en_action_ed2.html 
-
- Guide Survie C - http://www.pearson.fr/livre/?GCOI=27440100673730    
-



More information about the collectd mailing list