From c509bc4d0d999c09ba9878bf83b1c25502ed3ae5 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Tue, 25 Feb 2003 04:01:58 +0000 Subject: [PATCH] Turn off -Wpointer-arith if it generates warnings when including string.h. --- configure | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++-- configure.ac | 18 +++++++++++++++-- 2 files changed, 71 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 9cf7ffe7ba3..321dda183e3 100755 --- a/configure +++ b/configure @@ -10668,8 +10668,9 @@ fi if test "x${GCC}" = "xyes" then - CFLAGS="$CFLAGS -Wall -Wpointer-arith" - echo "$as_me:$LINENO: checking for gcc strength-reduce bug" >&5 + CFLAGS="$CFLAGS -Wall" + + echo "$as_me:$LINENO: checking for gcc strength-reduce bug" >&5 echo $ECHO_N "checking for gcc strength-reduce bug... $ECHO_C" >&6 if test "${ac_cv_c_gcc_strength_bug+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -10830,6 +10831,58 @@ echo "${ECHO_T}$ac_cv_c_gcc_gstabs" >&6 then CFLAGS="$CFLAGS -gstabs+" fi + + saved_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -Wpointer-arith -Werror" + echo "$as_me:$LINENO: checking for broken string.h that generates warnings" >&5 +echo $ECHO_N "checking for broken string.h that generates warnings... $ECHO_C" >&6 +if test "${ac_cv_c_string_h_warnings+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_string_h_warnings=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_string_h_warnings=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_string_h_warnings" >&5 +echo "${ECHO_T}$ac_cv_c_string_h_warnings" >&6 + CFLAGS=$saved_CFLAGS + if test "$ac_cv_c_string_h_warnings" = "no" + then + CFLAGS="$CFLAGS -Wpointer-arith" + fi fi diff --git a/configure.ac b/configure.ac index 321d97e5ac5..60964deef55 100644 --- a/configure.ac +++ b/configure.ac @@ -634,11 +634,13 @@ then AC_DEFINE(_FILE_OFFSET_BITS, 64, [Set this to 64 to enable 64-bit file support on Linux]) fi -dnl **** Check for gcc strength-reduce bug **** +dnl **** Check for gcc specific options **** if test "x${GCC}" = "xyes" then - CFLAGS="$CFLAGS -Wall -Wpointer-arith" + CFLAGS="$CFLAGS -Wall" + + dnl Check for strength-reduce bug AC_CACHE_CHECK( [for gcc strength-reduce bug], ac_cv_c_gcc_strength_bug, AC_TRY_RUN([ int L[[4]] = {0,1,2,3}; @@ -676,6 +678,18 @@ int main(void) { then CFLAGS="$CFLAGS -gstabs+" fi + + dnl Check for noisy string.h + saved_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -Wpointer-arith -Werror" + AC_CACHE_CHECK([for broken string.h that generates warnings], ac_cv_c_string_h_warnings, + AC_TRY_COMPILE([#include ],[], + [ac_cv_c_string_h_warnings=no],[ac_cv_c_string_h_warnings=yes])) + CFLAGS=$saved_CFLAGS + if test "$ac_cv_c_string_h_warnings" = "no" + then + CFLAGS="$CFLAGS -Wpointer-arith" + fi fi dnl **** Check how to define a function in assembly code ****