On Sun, Jul 5, 2009 at 6:53 PM, Pauli Nieminen<[email protected]> wrote:
> On Sat, Jul 4, 2009 at 2:37 AM, Pauli Nieminen<[email protected]> 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 <[email protected]>
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to