Turn off -Wpointer-arith if it generates warnings when including

string.h.
This commit is contained in:
Mike McCormack 2003-02-25 04:01:58 +00:00 committed by Alexandre Julliard
parent efa2b0c159
commit c509bc4d0d
2 changed files with 71 additions and 4 deletions

55
configure vendored
View File

@ -10668,7 +10668,8 @@ fi
if test "x${GCC}" = "xyes"
then
CFLAGS="$CFLAGS -Wall -Wpointer-arith"
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
@ -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 <string.h>
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

View File

@ -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 <string.h>],[],
[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 ****