Issue #24324: Do not enable unreachable code warnings when using · pythoncapi/cpython@bec699e · GitHub
Skip to content

Commit bec699e

Browse files
committed
Issue python#24324: Do not enable unreachable code warnings when using
gcc as the option does not work correctly in older versions of gcc and has been silently removed as of gcc-4.5.
1 parent adbf8ce commit bec699e

4 files changed

Lines changed: 29 additions & 7 deletions

File tree

Misc/NEWS

Lines changed: 4 additions & 0 deletions

aclocal.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
1+
# generated automatically by aclocal 1.15 -*- Autoconf -*-
22

3-
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
3+
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
44

55
# This file is free software; the Free Software Foundation
66
# gives unlimited permission to copy and/or distribute it,

configure

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6963,15 +6963,24 @@ fi
69636963

69646964
CFLAGS="$save_CFLAGS"
69656965
CC="$ac_save_cc"
6966-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_unreachable_code_warning" >&5
6967-
$as_echo "$ac_cv_enable_unreachable_code_warning" >&6; }
69686966

69696967
# Don't enable unreachable code warning in debug mode, since it usually
69706968
# results in non-standard code paths.
6971-
if test $ac_cv_enable_unreachable_code_warning = yes && test "$Py_DEBUG" != "true"
6969+
# Issue #24324: Unfortunately, the unreachable code warning does not work
6970+
# correctly on gcc and has been silently removed from the compiler.
6971+
# It is supported on clang but on OS X systems gcc may be an alias
6972+
# for clang. Try to determine if the compiler is not really gcc and,
6973+
# if so, only then enable the warning.
6974+
if test $ac_cv_enable_unreachable_code_warning = yes && \
6975+
test "$Py_DEBUG" != "true" && \
6976+
test -z "`$CC --version 2>/dev/null | grep 'Free Software Foundation'`"
69726977
then
69736978
BASECFLAGS="$BASECFLAGS -Wunreachable-code"
6979+
else
6980+
ac_cv_enable_unreachable_code_warning=no
69746981
fi
6982+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_unreachable_code_warning" >&5
6983+
$as_echo "$ac_cv_enable_unreachable_code_warning" >&6; }
69756984

69766985
# if using gcc on alpha, use -mieee to get (near) full IEEE 754
69776986
# support. Without this, treatment of subnormals doesn't follow

configure.ac

Lines changed: 11 additions & 2 deletions

0 commit comments

Comments
 (0)