This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Remove -Wunreachable-code flag
Type: compile error Stage: resolved
Components: Build Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: erik.bray, loewis, ned.deily, pitrou, python-dev, skip.montanaro, vstinner
Priority: normal Keywords: patch

Created on 2015-05-29 13:51 by skip.montanaro, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
unreached.diff skip.montanaro, 2015-09-18 17:36 review
Python351-no-unreachable-check.diff jgarver, 2016-01-19 17:50 Cleaner version of Skip's patch. Just changes configure.ac
Messages (8)
msg244377 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2015-05-29 13:51
Makefile.pre defines BASECFLAGS to include -Wunreachable-code. When building in the Linux environment available to me (GCC 4.4.6), compilation spews tons of warnings about "warning: will never be executed". According to this StackOverflow thread:

http://stackoverflow.com/questions/14591778/

that flag was always broken in GCC and was eventually removed in 4.5. Maybe we should dispense with it when building Python, at least unless requested by the user.
msg245035 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2015-06-08 20:51
I guess this is an autoconf thing. "@BASECFLAGS@" in Makefile.pre.in seems to expand to "-Wsign-compare -Wunreachable-code" in Makefile.pre.
msg251001 - (view) Author: Erik Bray (erik.bray) * (Python triager) Date: 2015-09-18 14:44
This would definitely be nice to fix.  I panicked a bit because of this when I compiled my extension modules against Python 3.5 for the first time.
msg251004 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-09-18 15:21
Can you please propose a patch?
msg251017 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2015-09-18 17:36
This seems to work for me. Diff against default. I have no idea how old the autoconf setup is here at work. I imagine you'll want to only apply the configure.ac patch and regenerate configure.
msg261323 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-03-08 05:30
New changeset 61f8f7610a88 by Ned Deily in branch '3.5':
Issue #24324: Do not enable unreachable code warnings when using
https://hg.python.org/cpython/rev/61f8f7610a88
msg261324 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-03-08 05:52
New changeset 8fecf6e17616 by Ned Deily in branch 'default':
Issue #24324: merge from 3.5
https://hg.python.org/cpython/rev/8fecf6e17616
msg261325 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-03-08 06:01
Thanks for the suggested patches.  I used a somewhat different approach in an attempt to retain the benefit of the unreachable code warning when using other (non-GCC) compilers, in particular, llvm clang where the warnings do seem to be useful.
History
Date User Action Args
2022-04-11 14:58:17adminsetgithub: 68512
2016-03-08 06:01:59ned.deilysetstatus: open -> closed

versions: + Python 3.6, - Python 2.7
nosy: + ned.deily

messages: + msg261325
resolution: fixed
stage: needs patch -> resolved
2016-03-08 05:52:43python-devsetmessages: + msg261324
2016-03-08 05:30:29python-devsetnosy: + python-dev
messages: + msg261323
2016-01-19 17:50:02jgarversetfiles: + Python351-no-unreachable-check.diff
2015-09-18 17:36:42skip.montanarosetfiles: + unreached.diff
keywords: + patch
messages: + msg251017
2015-09-18 15:21:03vstinnersetnosy: + vstinner
messages: + msg251004
2015-09-18 14:44:43erik.braysetnosy: + erik.bray
messages: + msg251001
2015-06-11 04:46:03rhettingersetnosy: + pitrou
2015-06-11 04:45:46rhettingersetnosy: + loewis
2015-06-08 20:51:28skip.montanarosetmessages: + msg245035
2015-05-29 13:51:17skip.montanarocreate