Re: [PATCH 6/6] libdrm: Add configuration option to enable strict compilation Also add -pedantic to list of warning flags.
On Sun, Jul 05, 2009 at 06:56:41PM +0300, Pauli Nieminen wrote: > @@ -124,6 +129,10 @@ AC_CACHE_CHECK([for supported warning flags], > libdrm_cv_warn_cflags, [ > AC_MSG_CHECKING([which warning flags were supported])]) > WARN_CFLAGS="$libdrm_cv_warn_cflags" > > +if test "x$STRICT_COMPILE" = xyes; then > + CFLAGS="$CFLAGS $WARN_CFLAGS -std=c99 -Werror" I think instead you should use AC_PROG_CC_C99. I believe that this should always be used or -pendantic generates a number of spurious warnings. Does anyone object to force-enabling C99? There is at least one place in inteldrm where a C99 extension (variadic macros) is actually used. signature.asc Description: Digital signature -- -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
Re: [PATCH 6/6] libdrm: Add configuration option to enable strict compilation Also add -pedantic to list of warning flags.
On Sun, Jul 5, 2009 at 6:53 PM, Pauli Nieminen wrote: > On Sat, Jul 4, 2009 at 2:37 AM, Pauli Nieminen wrote: >> This might also require -std=c99 to set c standard correctly. I did >> use that in my CFLAGS when I tried to compile with -Werror. >> > > New version of patch attached to add the -std=c99 if using strict compilation > I should learn to type and test everything well before submitting. From fc7f62d955f2d7b66cd5179eace2f628a7c66277 Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Sun, 5 Jul 2009 18:34:29 +0300 Subject: [PATCH 6/6] libdrm: Add configuration option to enable strict compilation Source is writen for c99 standard so we have to tell compiler about it with -std=c99 if we want strict warnings. Also add -pedantic to list of warning flags. --- configure.ac | 11 ++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/configure.ac b/configure.ac index be2fbbf..a63655e 100644 --- a/configure.ac +++ b/configure.ac @@ -52,6 +52,11 @@ AC_ARG_ENABLE(radeon-experimental-api, [Enable support for radeon's KMS API (default: disabled)]), [RADEON=$enableval], [RADEON=no]) +AC_ARG_ENABLE(strict-compilation, + AS_HELP_STRING([--enable-strict-compilation], + [Enable all warnings from compiler and make them errors (default: disabled)]), + [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) + dnl === dnl check compiler flags AC_DEFUN([LIBDRM_CC_TRY_FLAG], [ @@ -93,7 +98,7 @@ MAYBE_WARN="-Wall -Wextra \ -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \ -Wdeclaration-after-statement -Wold-style-definition \ -Wno-missing-field-initializers -Wno-unused-parameter \ --Wno-attributes -Wno-long-long -Winline" +-Wno-attributes -Wno-long-long -Winline -pedantic" # invalidate cached value if MAYBE_WARN has changed if test "x$libdrm_cv_warn_maybe" != "x$MAYBE_WARN"; then @@ -124,6 +129,10 @@ AC_CACHE_CHECK([for supported warning flags], libdrm_cv_warn_cflags, [ AC_MSG_CHECKING([which warning flags were supported])]) WARN_CFLAGS="$libdrm_cv_warn_cflags" +if test "x$STRICT_COMPILE" = xyes; then + CFLAGS="$CFLAGS $WARN_CFLAGS -std=c99 -Werror" +fi + if test "x$UDEV" = xyes; then AC_DEFINE(UDEV, 1, [Have UDEV support]) fi -- 1.6.3.1 -- -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
Re: [PATCH 6/6] libdrm: Add configuration option to enable strict compilation Also add -pedantic to list of warning flags.
On Sat, Jul 4, 2009 at 2:37 AM, Pauli Nieminen wrote: > This might also require -std=c99 to set c standard correctly. I did > use that in my CFLAGS when I tried to compile with -Werror. > New version of patch attached to add the -std=c99 if using strict compilation From fc7f62d955f2d7b66cd5179eace2f628a7c66277 Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Sun, 5 Jul 2009 18:34:29 +0300 Subject: [PATCH 6/6] libdrm: Add configuration option to enable strict compilation Source is writen for c99 standard so we have to tell compiler about it with -std=c99 if we want strict warnings. Also add -pedantic to list of warning flags. --- configure.ac | 11 ++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/configure.ac b/configure.ac index be2fbbf..a63655e 100644 --- a/configure.ac +++ b/configure.ac @@ -52,6 +52,11 @@ AC_ARG_ENABLE(radeon-experimental-api, [Enable support for radeon's KMS API (default: disabled)]), [RADEON=$enableval], [RADEON=no]) +AC_ARG_ENABLE(strict-compilation, + AS_HELP_STRING([--enable-strict-compilation], + [Enable all warnings from compiler and make them errors (default: disabled)]), + [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) + dnl === dnl check compiler flags AC_DEFUN([LIBDRM_CC_TRY_FLAG], [ @@ -93,7 +98,7 @@ MAYBE_WARN="-Wall -Wextra \ -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \ -Wdeclaration-after-statement -Wold-style-definition \ -Wno-missing-field-initializers -Wno-unused-parameter \ --Wno-attributes -Wno-long-long -Winline" +-Wno-attributes -Wno-long-long -Winline -pedantic" # invalidate cached value if MAYBE_WARN has changed if test "x$libdrm_cv_warn_maybe" != "x$MAYBE_WARN"; then @@ -124,6 +129,10 @@ AC_CACHE_CHECK([for supported warning flags], libdrm_cv_warn_cflags, [ AC_MSG_CHECKING([which warning flags were supported])]) WARN_CFLAGS="$libdrm_cv_warn_cflags" +if test "x$STRICT_COMPILE" = xyes; then + CFLAGS="$CFLAGS $WARN_CLAGS -std=c99 -Werror" +fi + if test "x$UDEV" = xyes; then AC_DEFINE(UDEV, 1, [Have UDEV support]) fi -- 1.6.3.1 -- -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
Re: [PATCH 6/6] libdrm: Add configuration option to enable strict compilation Also add -pedantic to list of warning flags.
This might also require -std=c99 to set c standard correctly. I did use that in my CFLAGS when I tried to compile with -Werror. -- -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[PATCH 6/6] libdrm: Add configuration option to enable strict compilation Also add -pedantic to list of warning flags.
--- configure.ac | 11 ++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/configure.ac b/configure.ac index be2fbbf..763464b 100644 --- a/configure.ac +++ b/configure.ac @@ -52,6 +52,11 @@ AC_ARG_ENABLE(radeon-experimental-api, [Enable support for radeon's KMS API (default: disabled)]), [RADEON=$enableval], [RADEON=no]) +AC_ARG_ENABLE(strict-compilation, + AS_HELP_STRING([--enable-strict-compilation], + [Enable all warnings from compiler and make them errors (default: disabled)]), + [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) + dnl === dnl check compiler flags AC_DEFUN([LIBDRM_CC_TRY_FLAG], [ @@ -93,7 +98,7 @@ MAYBE_WARN="-Wall -Wextra \ -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \ -Wdeclaration-after-statement -Wold-style-definition \ -Wno-missing-field-initializers -Wno-unused-parameter \ --Wno-attributes -Wno-long-long -Winline" +-Wno-attributes -Wno-long-long -Winline -pedantic" # invalidate cached value if MAYBE_WARN has changed if test "x$libdrm_cv_warn_maybe" != "x$MAYBE_WARN"; then @@ -124,6 +129,10 @@ AC_CACHE_CHECK([for supported warning flags], libdrm_cv_warn_cflags, [ AC_MSG_CHECKING([which warning flags were supported])]) WARN_CFLAGS="$libdrm_cv_warn_cflags" +if test "x$STRICT_COMPILE" = xyes; then + CFLAGS="$CFLAGS $WARN_CLAGS -Werror" +fi + if test "x$UDEV" = xyes; then AC_DEFINE(UDEV, 1, [Have UDEV support]) fi -- 1.6.3.1 -- -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel