From 6276d173b6bf9774747e33da79fbd2076f657f3b Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 6 Nov 2018 16:16:16 -0500 Subject: Fix compiler warnings (Issue #5423) --- config-scripts/cups-compiler.m4 | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) (limited to 'config-scripts') diff --git a/config-scripts/cups-compiler.m4 b/config-scripts/cups-compiler.m4 index a6923750a..0921b25dd 100644 --- a/config-scripts/cups-compiler.m4 +++ b/config-scripts/cups-compiler.m4 @@ -1,7 +1,7 @@ dnl dnl Compiler stuff for CUPS. dnl -dnl Copyright 2007-2017 by Apple Inc. +dnl Copyright 2007-2018 by Apple Inc. dnl Copyright 1997-2007 by Easy Software Products, all rights reserved. dnl dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information. @@ -152,34 +152,16 @@ if test -n "$GCC"; then if test "x$with_optim" = x; then # Add useful warning options for tracking down problems... - OPTIM="-Wall -Wno-format-y2k -Wunused $OPTIM" - - AC_MSG_CHECKING(whether compiler supports -Wno-unused-result) - OLDCFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror -Wno-unused-result" - AC_TRY_COMPILE(,, - [OPTIM="$OPTIM -Wno-unused-result" - AC_MSG_RESULT(yes)], - AC_MSG_RESULT(no)) - CFLAGS="$OLDCFLAGS" - - AC_MSG_CHECKING(whether compiler supports -Wsign-conversion) - OLDCFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror -Wsign-conversion" - AC_TRY_COMPILE(,, - [OPTIM="$OPTIM -Wsign-conversion" - AC_MSG_RESULT(yes)], - AC_MSG_RESULT(no)) - CFLAGS="$OLDCFLAGS" - - AC_MSG_CHECKING(whether compiler supports -Wno-tautological-compare) - OLDCFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror -Wno-tautological-compare" - AC_TRY_COMPILE(,, - [OPTIM="$OPTIM -Wno-tautological-compare" - AC_MSG_RESULT(yes)], - AC_MSG_RESULT(no)) - CFLAGS="$OLDCFLAGS" + OPTIM="-Wall -Wno-format-y2k -Wunused -Wno-unused-result -Wsign-conversion $OPTIM" + + # Test GCC version for certain warning flags since -Werror + # doesn't trigger... + gccversion=`$CC --version | head -1 | awk '{print $NF}'` + case "$gccversion" in + 7.*) + OPTIM="$OPTIM -Wno-format-truncation -Wno-tautological-compare" + ;; + esac # Additional warning options for development testing... if test -d .git; then -- cgit v1.2.1