[master] 52d3477 Don't assume our compiler likes -Wall -Werror

Nils Goroll nils.goroll at uplex.de
Mon Aug 22 15:57:12 CEST 2016


commit 52d3477dceb2d8d14257dd808db7677cc99f0d97
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Aug 22 15:20:15 2016 +0200

    Don't assume our compiler likes -Wall -Werror
    
    and add a -Werror replacement for Solaris Studio.
    
    This only makes Solaris Studio work with the default options, not for
    --enable-developer-warnings
    
    Partly addresses #2047

diff --git a/configure.ac b/configure.ac
index fb34c13..fbbb0b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -572,8 +572,22 @@ gl_LD_VERSION_SCRIPT
 # The reason for -Wno-error=unused-result is a glibc/gcc interaction
 # idiocy where write is marked as warn_unused_result, causing build
 # failures.
-CFLAGS="${CFLAGS} -Wall -Werror"
-OCFLAGS="${OCFLAGS} -Wall -Werror"
+
+AX_CHECK_COMPILE_FLAG([-Wall],
+     [CFLAGS="${CFLAGS} -Wall"
+      OCFLAGS="${OCFLAGS} -Wall"])
+
+SUNCC_CFLAGS=" \
+	-errwarn=%all,no%E_EMPTY_TRANSLATION_UNIT,no%E_ATTRIBUTE_UNKNOWN,no%E_STATEMENT_NOT_REACHED,no%E_EMPTY_DECLARATION \
+	-errtags=yes \
+	"
+AX_CHECK_COMPILE_FLAG([-Werror],
+     [CFLAGS="${CFLAGS} -Werror"
+      OCFLAGS="${OCFLAGS} -Werror"],
+     [AX_CHECK_COMPILE_FLAG([${SUNCC_CFLAGS}],
+      [CFLAGS="${CFLAGS} ${SUNCC_CFLAGS}"
+       OCFLAGS="${OCFLAGS} ${SUNCC_CFLAGS}"])])
+
 AX_CHECK_COMPILE_FLAG([-Werror=unused-result],
     [CFLAGS="${CFLAGS} -Wno-error=unused-result"
      OCFLAGS="${OCFLAGS} -Wno-error=unused-result"],



More information about the varnish-commit mailing list