diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-03-30 17:34:47 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-03-30 17:34:47 (GMT) |
commit | e6c9d24562adf4eddfcbeb6cc1873b3e6795e2eb (patch) | |
tree | 94f3a3a9aa204d231bbb6feb567a6a23db660976 /configure | |
parent | fc91aa28fd8dad5280fd4d3a4747b5e08ee37ac0 (diff) | |
download | cpython-e6c9d24562adf4eddfcbeb6cc1873b3e6795e2eb.zip cpython-e6c9d24562adf4eddfcbeb6cc1873b3e6795e2eb.tar.gz cpython-e6c9d24562adf4eddfcbeb6cc1873b3e6795e2eb.tar.bz2 |
build without -fno-strict-aliasing when gcc isn't buggy #3326
Patch from Daniel Stutzbach
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 69 |
1 files changed, 57 insertions, 12 deletions
@@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 78965 . +# From configure.in Revision: 79401 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 3.2. # @@ -4569,14 +4569,16 @@ UNIVERSAL_ARCH_FLAGS= # tweak BASECFLAGS based on compiler and platform case $GCC in yes) - # Python violates C99 rules, by casting between incompatible - # pointer types. GCC may generate bad code as a result of that, - # so use -fno-strict-aliasing if supported. - { echo "$as_me:$LINENO: checking whether $CC accepts -fno-strict-aliasing" >&5 -echo $ECHO_N "checking whether $CC accepts -fno-strict-aliasing... $ECHO_C" >&6; } + # Python doesn't violate C99 aliasing rules, but older versions of + # GCC produce warnings for legal Python code. Enable + # -fno-strict-aliasing on versions of GCC that support but produce + # warnings. See Issue3326 + { echo "$as_me:$LINENO: checking whether $CC accepts and needs -fno-strict-aliasing" >&5 +echo $ECHO_N "checking whether $CC accepts and needs -fno-strict-aliasing... $ECHO_C" >&6; } ac_save_cc="$CC" CC="$CC -fno-strict-aliasing" - if test "${ac_cv_no_strict_aliasing_ok+set}" = set; then + save_CFLAGS="$CFLAGS" + if test "${ac_cv_no_strict_aliasing+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -4611,21 +4613,64 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_no_strict_aliasing_ok=yes + CC="$ac_save_cc -fstrict-aliasing" + CFLAGS="$CFLAGS -Werror -Wstrict-aliasing" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +void f(int **x) {} int main() { double *x; f((int **) &x); return 0; } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_no_strict_aliasing=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_no_strict_aliasing=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_no_strict_aliasing_ok=no + ac_cv_no_strict_aliasing=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi + CFLAGS="$save_CFLAGS" CC="$ac_save_cc" - { echo "$as_me:$LINENO: result: $ac_cv_no_strict_aliasing_ok" >&5 -echo "${ECHO_T}$ac_cv_no_strict_aliasing_ok" >&6; } - if test $ac_cv_no_strict_aliasing_ok = yes + { echo "$as_me:$LINENO: result: $ac_cv_no_strict_aliasing" >&5 +echo "${ECHO_T}$ac_cv_no_strict_aliasing" >&6; } + if test $ac_cv_no_strict_aliasing = yes then BASECFLAGS="$BASECFLAGS -fno-strict-aliasing" fi |