You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
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.
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.
Activity
smontanaro commentedon May 29, 2015
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.
smontanaro commentedon Jun 8, 2015
I guess this is an autoconf thing. "@BASECFLAGS@" in Makefile.pre.in seems to expand to "-Wsign-compare -Wunreachable-code" in Makefile.pre.
embray commentedon Sep 18, 2015
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.
vstinner commentedon Sep 18, 2015
Can you please propose a patch?
smontanaro commentedon Sep 18, 2015
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.
python-dev commentedon Mar 8, 2016
New changeset 61f8f7610a88 by Ned Deily in branch '3.5':
Issue bpo-24324: Do not enable unreachable code warnings when using
https://hg.python.org/cpython/rev/61f8f7610a88
python-dev commentedon Mar 8, 2016
New changeset 8fecf6e17616 by Ned Deily in branch 'default':
Issue bpo-24324: merge from 3.5
https://hg.python.org/cpython/rev/8fecf6e17616
ned-deily commentedon Mar 8, 2016
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.