mirror of https://github.com/python/cpython
bpo-45723: Add macro for disabling/enabling CC warnings (GH-29466)
Co-authored-by: Christian Heimes <christian@python.org>
This commit is contained in:
parent
7484a5c82a
commit
9bd0cf5970
|
@ -7074,22 +7074,25 @@ fi
|
|||
UNIVERSAL_ARCH_FLAGS=
|
||||
|
||||
|
||||
|
||||
|
||||
# tweak BASECFLAGS based on compiler and platform
|
||||
case $GCC in
|
||||
yes)
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -std=c99"
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wextra" >&5
|
||||
$as_echo_n "checking for -Wextra... " >&6; }
|
||||
ac_save_cc="$CC"
|
||||
CC="$CC -Wextra -Werror"
|
||||
if ${ac_cv_extra_warnings+:} false; then :
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can add -Wextra" >&5
|
||||
$as_echo_n "checking if we can add -Wextra... " >&6; }
|
||||
|
||||
py_cflags=$CFLAGS
|
||||
CFLAGS="$CFLAGS -Wextra -Werror"
|
||||
if ${ac_cv_enable_extra_warning+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
@ -7097,28 +7100,24 @@ main ()
|
|||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
ac_cv_extra_warnings=yes
|
||||
|
||||
ac_cv_enable_extra_warning=yes
|
||||
else
|
||||
|
||||
ac_cv_extra_warnings=no
|
||||
|
||||
ac_cv_enable_extra_warning=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
|
||||
fi
|
||||
|
||||
CC="$ac_save_cc"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_extra_warnings" >&5
|
||||
$as_echo "$ac_cv_extra_warnings" >&6; }
|
||||
CFLAGS=$py_cflags
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_extra_warning" >&5
|
||||
$as_echo "$ac_cv_enable_extra_warning" >&6; }
|
||||
|
||||
if test $ac_cv_extra_warnings = yes
|
||||
then
|
||||
|
||||
if test "x$ac_cv_enable_extra_warning" = xyes; then :
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -Wextra"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Python doesn't violate C99 aliasing rules, but older versions of
|
||||
# GCC produce warnings for legal Python code. Enable
|
||||
|
@ -7185,30 +7184,27 @@ fi
|
|||
CC="$ac_save_cc"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_no_strict_aliasing" >&5
|
||||
$as_echo "$ac_cv_no_strict_aliasing" >&6; }
|
||||
if test $ac_cv_no_strict_aliasing = yes
|
||||
then
|
||||
if test "x$ac_cv_no_strict_aliasing" = xyes; then :
|
||||
BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
|
||||
fi
|
||||
fi
|
||||
|
||||
# ICC doesn't recognize the option, but only emits a warning
|
||||
## XXX does it emit an unused result warning and can it be disabled?
|
||||
case "$CC" in
|
||||
*icc*)
|
||||
case $CC in #(
|
||||
*icc*) :
|
||||
ac_cv_disable_unused_result_warning=no
|
||||
;;
|
||||
*)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can turn off $CC unused result warning" >&5
|
||||
$as_echo_n "checking if we can turn off $CC unused result warning... " >&6; }
|
||||
ac_save_cc="$CC"
|
||||
CC="$CC -Wunused-result -Werror"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can disable $CC unused-result warning" >&5
|
||||
$as_echo_n "checking if we can disable $CC unused-result warning... " >&6; }
|
||||
|
||||
py_cflags=$CFLAGS
|
||||
CFLAGS="$CFLAGS -Wunused-result -Werror"
|
||||
if ${ac_cv_disable_unused_result_warning+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
@ -7216,44 +7212,41 @@ main ()
|
|||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
ac_cv_disable_unused_result_warning=yes
|
||||
|
||||
else
|
||||
|
||||
ac_cv_disable_unused_result_warning=no
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
|
||||
fi
|
||||
|
||||
CFLAGS="$save_CFLAGS"
|
||||
CC="$ac_save_cc"
|
||||
CFLAGS=$py_cflags
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_disable_unused_result_warning" >&5
|
||||
$as_echo "$ac_cv_disable_unused_result_warning" >&6; }
|
||||
;;
|
||||
esac
|
||||
|
||||
if test $ac_cv_disable_unused_result_warning = yes
|
||||
then
|
||||
;; #(
|
||||
*) :
|
||||
;;
|
||||
esac
|
||||
if test "x$ac_cv_disable_unused_result_warning" = xyes; then :
|
||||
BASECFLAGS="$BASECFLAGS -Wno-unused-result"
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-result"
|
||||
fi
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can turn off $CC unused parameter warning" >&5
|
||||
$as_echo_n "checking if we can turn off $CC unused parameter warning... " >&6; }
|
||||
ac_save_cc="$CC"
|
||||
CC="$CC -Wunused-parameter -Werror"
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can disable $CC unused-parameter warning" >&5
|
||||
$as_echo_n "checking if we can disable $CC unused-parameter warning... " >&6; }
|
||||
|
||||
py_cflags=$CFLAGS
|
||||
CFLAGS="$CFLAGS -Wunused-parameter -Werror"
|
||||
if ${ac_cv_disable_unused_parameter_warning+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
@ -7261,40 +7254,37 @@ main ()
|
|||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
ac_cv_disable_unused_parameter_warning=yes
|
||||
|
||||
else
|
||||
|
||||
ac_cv_disable_unused_parameter_warning=no
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
|
||||
fi
|
||||
|
||||
CC="$ac_save_cc"
|
||||
CFLAGS=$py_cflags
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_disable_unused_parameter_warning" >&5
|
||||
$as_echo "$ac_cv_disable_unused_parameter_warning" >&6; }
|
||||
|
||||
if test $ac_cv_disable_unused_parameter_warning = yes
|
||||
then
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-parameter"
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can turn off $CC missing field initializers warning" >&5
|
||||
$as_echo_n "checking if we can turn off $CC missing field initializers warning... " >&6; }
|
||||
ac_save_cc="$CC"
|
||||
CC="$CC -Wmissing-field-initializers -Werror"
|
||||
if ${ac_cv_disable_missing_field_initializers+:} false; then :
|
||||
if test "x$ac_cv_disable_unused_parameter_warning" = xyes; then :
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-parameter"
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can disable $CC missing-field-initializers warning" >&5
|
||||
$as_echo_n "checking if we can disable $CC missing-field-initializers warning... " >&6; }
|
||||
|
||||
py_cflags=$CFLAGS
|
||||
CFLAGS="$CFLAGS -Wmissing-field-initializers -Werror"
|
||||
if ${ac_cv_disable_missing_field_initializers_warning+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
@ -7302,41 +7292,37 @@ main ()
|
|||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
ac_cv_disable_missing_field_initializers=yes
|
||||
|
||||
ac_cv_disable_missing_field_initializers_warning=yes
|
||||
else
|
||||
|
||||
ac_cv_disable_missing_field_initializers=no
|
||||
|
||||
ac_cv_disable_missing_field_initializers_warning=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
|
||||
fi
|
||||
|
||||
CC="$ac_save_cc"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_disable_missing_field_initializers" >&5
|
||||
$as_echo "$ac_cv_disable_missing_field_initializers" >&6; }
|
||||
CFLAGS=$py_cflags
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_disable_missing_field_initializers_warning" >&5
|
||||
$as_echo "$ac_cv_disable_missing_field_initializers_warning" >&6; }
|
||||
|
||||
if test $ac_cv_disable_missing_field_initializers = yes
|
||||
then
|
||||
|
||||
if test "x$ac_cv_disable_missing_field_initializers_warning" = xyes; then :
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -Wno-missing-field-initializers"
|
||||
fi
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can turn on $CC mixed sign comparison warning" >&5
|
||||
$as_echo_n "checking if we can turn on $CC mixed sign comparison warning... " >&6; }
|
||||
ac_save_cc="$CC"
|
||||
CC="$CC -Wsign-compare"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can enable $CC sign-compare warning" >&5
|
||||
$as_echo_n "checking if we can enable $CC sign-compare warning... " >&6; }
|
||||
|
||||
py_cflags=$CFLAGS
|
||||
CFLAGS="$CFLAGS -Wsign-compare -Werror"
|
||||
if ${ac_cv_enable_sign_compare_warning+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
@ -7344,42 +7330,37 @@ main ()
|
|||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
ac_cv_enable_sign_compare_warning=yes
|
||||
|
||||
else
|
||||
|
||||
ac_cv_enable_sign_compare_warning=no
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
|
||||
fi
|
||||
|
||||
CFLAGS="$save_CFLAGS"
|
||||
CC="$ac_save_cc"
|
||||
CFLAGS=$py_cflags
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_sign_compare_warning" >&5
|
||||
$as_echo "$ac_cv_enable_sign_compare_warning" >&6; }
|
||||
|
||||
if test $ac_cv_enable_sign_compare_warning = yes
|
||||
then
|
||||
BASECFLAGS="$BASECFLAGS -Wsign-compare"
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can turn on $CC unreachable code warning" >&5
|
||||
$as_echo_n "checking if we can turn on $CC unreachable code warning... " >&6; }
|
||||
ac_save_cc="$CC"
|
||||
CC="$CC -Wunreachable-code"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
if test "x$ac_cv_enable_sign_compare_warning" = xyes; then :
|
||||
BASECFLAGS="$BASECFLAGS -Wsign-compare"
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can enable $CC unreachable-code warning" >&5
|
||||
$as_echo_n "checking if we can enable $CC unreachable-code warning... " >&6; }
|
||||
|
||||
py_cflags=$CFLAGS
|
||||
CFLAGS="$CFLAGS -Wunreachable-code -Werror"
|
||||
if ${ac_cv_enable_unreachable_code_warning+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
@ -7387,22 +7368,20 @@ main ()
|
|||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
ac_cv_enable_unreachable_code_warning=yes
|
||||
|
||||
else
|
||||
|
||||
ac_cv_enable_unreachable_code_warning=no
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
|
||||
fi
|
||||
|
||||
CFLAGS="$save_CFLAGS"
|
||||
CC="$ac_save_cc"
|
||||
CFLAGS=$py_cflags
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_unreachable_code_warning" >&5
|
||||
$as_echo "$ac_cv_enable_unreachable_code_warning" >&6; }
|
||||
|
||||
|
||||
# Don't enable unreachable code warning in debug mode, since it usually
|
||||
# results in non-standard code paths.
|
||||
|
@ -7419,20 +7398,19 @@ fi
|
|||
else
|
||||
ac_cv_enable_unreachable_code_warning=no
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_unreachable_code_warning" >&5
|
||||
$as_echo "$ac_cv_enable_unreachable_code_warning" >&6; }
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can turn on $CC strict-prototypes warning" >&5
|
||||
$as_echo_n "checking if we can turn on $CC strict-prototypes warning... " >&6; }
|
||||
ac_save_cc="$CC"
|
||||
CC="$CC -Werror -Wstrict-prototypes"
|
||||
if ${ac_cv_enable_enable_strict_prototypes_warning+:} false; then :
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can enable $CC strict-prototypes warning" >&5
|
||||
$as_echo_n "checking if we can enable $CC strict-prototypes warning... " >&6; }
|
||||
|
||||
py_cflags=$CFLAGS
|
||||
CFLAGS="$CFLAGS -Wstrict-prototypes -Werror"
|
||||
if ${ac_cv_enable_strict_prototypes_warning+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
@ -7440,28 +7418,24 @@ main ()
|
|||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
|
||||
ac_cv_enable_strict_prototypes_warning=yes
|
||||
|
||||
else
|
||||
|
||||
ac_cv_enable_strict_prototypes_warning=no
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
|
||||
fi
|
||||
|
||||
CC="$ac_save_cc"
|
||||
CFLAGS=$py_cflags
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_strict_prototypes_warning" >&5
|
||||
$as_echo "$ac_cv_enable_strict_prototypes_warning" >&6; }
|
||||
|
||||
if test $ac_cv_enable_strict_prototypes_warning = yes
|
||||
then
|
||||
|
||||
if test "x$ac_cv_enable_strict_prototypes_warning" = xyes; then :
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -Wstrict-prototypes"
|
||||
fi
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can make implicit function declaration an error in $CC" >&5
|
||||
$as_echo_n "checking if we can make implicit function declaration an error in $CC... " >&6; }
|
||||
|
@ -7499,10 +7473,9 @@ fi
|
|||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_implicit_function_declaration_error" >&5
|
||||
$as_echo "$ac_cv_enable_implicit_function_declaration_error" >&6; }
|
||||
|
||||
if test $ac_cv_enable_implicit_function_declaration_error = yes
|
||||
then
|
||||
if test "x$ac_cv_enable_implicit_function_declaration_error" = xyes; then :
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -Werror=implicit-function-declaration"
|
||||
fi
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can use visibility in $CC" >&5
|
||||
$as_echo_n "checking if we can use visibility in $CC... " >&6; }
|
||||
|
@ -7540,10 +7513,9 @@ fi
|
|||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_visibility" >&5
|
||||
$as_echo "$ac_cv_enable_visibility" >&6; }
|
||||
|
||||
if test $ac_cv_enable_visibility = yes
|
||||
then
|
||||
if test "x$ac_cv_enable_visibility" = xyes; then :
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -fvisibility=hidden"
|
||||
fi
|
||||
fi
|
||||
|
||||
# if using gcc on alpha, use -mieee to get (near) full IEEE 754
|
||||
# support. Without this, treatment of subnormals doesn't follow
|
||||
|
|
202
configure.ac
202
configure.ac
|
@ -1640,30 +1640,33 @@ AC_SUBST(LDFLAGS_NODIST)
|
|||
UNIVERSAL_ARCH_FLAGS=
|
||||
AC_SUBST(UNIVERSAL_ARCH_FLAGS)
|
||||
|
||||
dnl PY_CHECK_CC_WARNING(ENABLE, WARNING, [MSG])
|
||||
AC_DEFUN([PY_CHECK_CC_WARNING], [
|
||||
AC_MSG_CHECKING(m4_ifblank([$3], [if we can $1 $CC $2 warning], [$3]))
|
||||
AS_VAR_PUSHDEF([py_var], [ac_cv_$1_]m4_normalize($2)[_warning])
|
||||
AS_VAR_COPY([py_cflags], [CFLAGS])
|
||||
AS_VAR_SET([CFLAGS], ["$CFLAGS -W$2 -Werror"])
|
||||
AC_CACHE_VAL(
|
||||
[py_var],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[]], [[]])],
|
||||
[AS_VAR_SET([py_var], [yes])],
|
||||
[AS_VAR_SET([py_var], [no])],
|
||||
)]
|
||||
)
|
||||
AS_VAR_COPY([CFLAGS], [py_cflags])
|
||||
AC_MSG_RESULT([$py_var])
|
||||
AS_VAR_POPDEF([py_var])
|
||||
])
|
||||
|
||||
# tweak BASECFLAGS based on compiler and platform
|
||||
case $GCC in
|
||||
yes)
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -std=c99"
|
||||
|
||||
AC_MSG_CHECKING(for -Wextra)
|
||||
ac_save_cc="$CC"
|
||||
CC="$CC -Wextra -Werror"
|
||||
AC_CACHE_VAL(ac_cv_extra_warnings,
|
||||
AC_COMPILE_IFELSE(
|
||||
[
|
||||
AC_LANG_PROGRAM([[]], [[]])
|
||||
],[
|
||||
ac_cv_extra_warnings=yes
|
||||
],[
|
||||
ac_cv_extra_warnings=no
|
||||
]))
|
||||
CC="$ac_save_cc"
|
||||
AC_MSG_RESULT($ac_cv_extra_warnings)
|
||||
|
||||
if test $ac_cv_extra_warnings = yes
|
||||
then
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -Wextra"
|
||||
fi
|
||||
PY_CHECK_CC_WARNING([enable], [extra], [if we can add -Wextra])
|
||||
AS_VAR_IF([ac_cv_enable_extra_warning], [yes],
|
||||
[CFLAGS_NODIST="$CFLAGS_NODIST -Wextra"])
|
||||
|
||||
# Python doesn't violate C99 aliasing rules, but older versions of
|
||||
# GCC produce warnings for legal Python code. Enable
|
||||
|
@ -1695,121 +1698,31 @@ yes)
|
|||
CFLAGS="$save_CFLAGS"
|
||||
CC="$ac_save_cc"
|
||||
AC_MSG_RESULT($ac_cv_no_strict_aliasing)
|
||||
if test $ac_cv_no_strict_aliasing = yes
|
||||
then
|
||||
BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
|
||||
fi
|
||||
AS_VAR_IF([ac_cv_no_strict_aliasing], [yes],
|
||||
[BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"])
|
||||
|
||||
# ICC doesn't recognize the option, but only emits a warning
|
||||
## XXX does it emit an unused result warning and can it be disabled?
|
||||
case "$CC" in
|
||||
*icc*)
|
||||
ac_cv_disable_unused_result_warning=no
|
||||
;;
|
||||
*)
|
||||
AC_MSG_CHECKING(if we can turn off $CC unused result warning)
|
||||
ac_save_cc="$CC"
|
||||
CC="$CC -Wunused-result -Werror"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
AC_CACHE_VAL(ac_cv_disable_unused_result_warning,
|
||||
AC_COMPILE_IFELSE(
|
||||
[
|
||||
AC_LANG_PROGRAM([[]], [[]])
|
||||
],[
|
||||
ac_cv_disable_unused_result_warning=yes
|
||||
],[
|
||||
ac_cv_disable_unused_result_warning=no
|
||||
]))
|
||||
CFLAGS="$save_CFLAGS"
|
||||
CC="$ac_save_cc"
|
||||
AC_MSG_RESULT($ac_cv_disable_unused_result_warning)
|
||||
;;
|
||||
esac
|
||||
AS_CASE([$CC],
|
||||
[*icc*], [ac_cv_disable_unused_result_warning=no]
|
||||
[PY_CHECK_CC_WARNING([disable], [unused-result])])
|
||||
AS_VAR_IF([ac_cv_disable_unused_result_warning], [yes],
|
||||
[BASECFLAGS="$BASECFLAGS -Wno-unused-result"
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-result"])
|
||||
|
||||
if test $ac_cv_disable_unused_result_warning = yes
|
||||
then
|
||||
BASECFLAGS="$BASECFLAGS -Wno-unused-result"
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-result"
|
||||
fi
|
||||
PY_CHECK_CC_WARNING([disable], [unused-parameter])
|
||||
AS_VAR_IF([ac_cv_disable_unused_parameter_warning], [yes],
|
||||
[CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-parameter"])
|
||||
|
||||
AC_MSG_CHECKING(if we can turn off $CC unused parameter warning)
|
||||
ac_save_cc="$CC"
|
||||
CC="$CC -Wunused-parameter -Werror"
|
||||
AC_CACHE_VAL(ac_cv_disable_unused_parameter_warning,
|
||||
AC_COMPILE_IFELSE(
|
||||
[
|
||||
AC_LANG_PROGRAM([[]], [[]])
|
||||
],[
|
||||
ac_cv_disable_unused_parameter_warning=yes
|
||||
],[
|
||||
ac_cv_disable_unused_parameter_warning=no
|
||||
]))
|
||||
CC="$ac_save_cc"
|
||||
AC_MSG_RESULT($ac_cv_disable_unused_parameter_warning)
|
||||
PY_CHECK_CC_WARNING([disable], [missing-field-initializers])
|
||||
AS_VAR_IF([ac_cv_disable_missing_field_initializers_warning], [yes],
|
||||
[CFLAGS_NODIST="$CFLAGS_NODIST -Wno-missing-field-initializers"])
|
||||
|
||||
if test $ac_cv_disable_unused_parameter_warning = yes
|
||||
then
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-parameter"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(if we can turn off $CC missing field initializers warning)
|
||||
ac_save_cc="$CC"
|
||||
CC="$CC -Wmissing-field-initializers -Werror"
|
||||
AC_CACHE_VAL(ac_cv_disable_missing_field_initializers,
|
||||
AC_COMPILE_IFELSE(
|
||||
[
|
||||
AC_LANG_PROGRAM([[]], [[]])
|
||||
],[
|
||||
ac_cv_disable_missing_field_initializers=yes
|
||||
],[
|
||||
ac_cv_disable_missing_field_initializers=no
|
||||
]))
|
||||
CC="$ac_save_cc"
|
||||
AC_MSG_RESULT($ac_cv_disable_missing_field_initializers)
|
||||
|
||||
if test $ac_cv_disable_missing_field_initializers = yes
|
||||
then
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -Wno-missing-field-initializers"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(if we can turn on $CC mixed sign comparison warning)
|
||||
ac_save_cc="$CC"
|
||||
CC="$CC -Wsign-compare"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
AC_CACHE_VAL(ac_cv_enable_sign_compare_warning,
|
||||
AC_COMPILE_IFELSE(
|
||||
[
|
||||
AC_LANG_PROGRAM([[]], [[]])
|
||||
],[
|
||||
ac_cv_enable_sign_compare_warning=yes
|
||||
],[
|
||||
ac_cv_enable_sign_compare_warning=no
|
||||
]))
|
||||
CFLAGS="$save_CFLAGS"
|
||||
CC="$ac_save_cc"
|
||||
AC_MSG_RESULT($ac_cv_enable_sign_compare_warning)
|
||||
|
||||
if test $ac_cv_enable_sign_compare_warning = yes
|
||||
then
|
||||
BASECFLAGS="$BASECFLAGS -Wsign-compare"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(if we can turn on $CC unreachable code warning)
|
||||
ac_save_cc="$CC"
|
||||
CC="$CC -Wunreachable-code"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
AC_CACHE_VAL(ac_cv_enable_unreachable_code_warning,
|
||||
AC_COMPILE_IFELSE(
|
||||
[
|
||||
AC_LANG_PROGRAM([[]], [[]])
|
||||
],[
|
||||
ac_cv_enable_unreachable_code_warning=yes
|
||||
],[
|
||||
ac_cv_enable_unreachable_code_warning=no
|
||||
]))
|
||||
CFLAGS="$save_CFLAGS"
|
||||
CC="$ac_save_cc"
|
||||
PY_CHECK_CC_WARNING([enable], [sign-compare])
|
||||
AS_VAR_IF([ac_cv_enable_sign_compare_warning], [yes],
|
||||
[BASECFLAGS="$BASECFLAGS -Wsign-compare"])
|
||||
|
||||
PY_CHECK_CC_WARNING([enable], [unreachable-code])
|
||||
# Don't enable unreachable code warning in debug mode, since it usually
|
||||
# results in non-standard code paths.
|
||||
# Issue #24324: Unfortunately, the unreachable code warning does not work
|
||||
|
@ -1825,27 +1738,10 @@ yes)
|
|||
else
|
||||
ac_cv_enable_unreachable_code_warning=no
|
||||
fi
|
||||
AC_MSG_RESULT($ac_cv_enable_unreachable_code_warning)
|
||||
|
||||
AC_MSG_CHECKING(if we can turn on $CC strict-prototypes warning)
|
||||
ac_save_cc="$CC"
|
||||
CC="$CC -Werror -Wstrict-prototypes"
|
||||
AC_CACHE_VAL(ac_cv_enable_enable_strict_prototypes_warning,
|
||||
AC_COMPILE_IFELSE(
|
||||
[
|
||||
AC_LANG_PROGRAM([[]], [[]])
|
||||
],[
|
||||
ac_cv_enable_strict_prototypes_warning=yes
|
||||
],[
|
||||
ac_cv_enable_strict_prototypes_warning=no
|
||||
]))
|
||||
CC="$ac_save_cc"
|
||||
AC_MSG_RESULT($ac_cv_enable_strict_prototypes_warning)
|
||||
|
||||
if test $ac_cv_enable_strict_prototypes_warning = yes
|
||||
then
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -Wstrict-prototypes"
|
||||
fi
|
||||
PY_CHECK_CC_WARNING([enable], [strict-prototypes])
|
||||
AS_VAR_IF([ac_cv_enable_strict_prototypes_warning], [yes],
|
||||
[CFLAGS_NODIST="$CFLAGS_NODIST -Wstrict-prototypes"])
|
||||
|
||||
AC_MSG_CHECKING(if we can make implicit function declaration an error in $CC)
|
||||
ac_save_cc="$CC"
|
||||
|
@ -1862,10 +1758,8 @@ yes)
|
|||
CC="$ac_save_cc"
|
||||
AC_MSG_RESULT($ac_cv_enable_implicit_function_declaration_error)
|
||||
|
||||
if test $ac_cv_enable_implicit_function_declaration_error = yes
|
||||
then
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -Werror=implicit-function-declaration"
|
||||
fi
|
||||
AS_VAR_IF([ac_cv_enable_implicit_function_declaration_error], [yes],
|
||||
[CFLAGS_NODIST="$CFLAGS_NODIST -Werror=implicit-function-declaration"])
|
||||
|
||||
AC_MSG_CHECKING(if we can use visibility in $CC)
|
||||
ac_save_cc="$CC"
|
||||
|
@ -1882,10 +1776,8 @@ yes)
|
|||
CC="$ac_save_cc"
|
||||
AC_MSG_RESULT($ac_cv_enable_visibility)
|
||||
|
||||
if test $ac_cv_enable_visibility = yes
|
||||
then
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST -fvisibility=hidden"
|
||||
fi
|
||||
AS_VAR_IF([ac_cv_enable_visibility], [yes],
|
||||
[CFLAGS_NODIST="$CFLAGS_NODIST -fvisibility=hidden"])
|
||||
|
||||
# if using gcc on alpha, use -mieee to get (near) full IEEE 754
|
||||
# support. Without this, treatment of subnormals doesn't follow
|
||||
|
|
Loading…
Reference in New Issue