[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#367657: GCC new warnings and compatibility



On Wed, May 17, 2006 at 03:14:04PM +0100, Ian Jackson wrote:
> Furthermore, because GCC has traditionally had such good warnings, and
> such good configurability of warnings, and because no-one looks at
> warnings that don't cause build failures, many people (myself
> included) use -Werror in nearly all of their projects.

If you're using autotools, you could do the following as a workaround.

In configure.ac:

AC_ARG_ENABLE(warnings-as-errors,
	AC_HELP_STRING(--enable-warnings-as-errors,Treat warnings as errors (default off),
	[WARN_IS_ERR="$enableval"], [WARN_IS_ERR="no"])

AM_CONDITIONAL(WARN, test "$WARN_IS_ERR" = yes)

In Makefile.am:

if C_WARN
AM_CFLAGS += -Werror
endif

If you do that, then run configure with --enable-warnings-as-errors,
you'll get -Werror on your compiler command line, and not otherwise.

If you don't use autotools, you could just say make CFLAGS='-Werror',
which would also work.

-- 
Fun will now commence
  -- Seven Of Nine, "Ashes to Ashes", stardate 53679.4



Reply to: