Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove -Wunreachable-code flag #68512

Closed
smontanaro opened this issue May 29, 2015 · 8 comments
Closed

Remove -Wunreachable-code flag #68512

smontanaro opened this issue May 29, 2015 · 8 comments
Labels
build The build process and cross-build

Comments

@smontanaro
Copy link
Contributor

BPO 24324
Nosy @loewis, @smontanaro, @pitrou, @vstinner, @ned-deily, @embray
Files
  • unreached.diff
  • Python351-no-unreachable-check.diff: Cleaner version of Skip's patch. Just changes configure.ac
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2016-03-08.06:01:59.710>
    created_at = <Date 2015-05-29.13:51:17.482>
    labels = ['build']
    title = 'Remove -Wunreachable-code flag'
    updated_at = <Date 2016-03-08.06:01:59.706>
    user = 'https://github.com/smontanaro'

    bugs.python.org fields:

    activity = <Date 2016-03-08.06:01:59.706>
    actor = 'ned.deily'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-03-08.06:01:59.710>
    closer = 'ned.deily'
    components = ['Build']
    creation = <Date 2015-05-29.13:51:17.482>
    creator = 'skip.montanaro'
    dependencies = []
    files = ['40510', '41663']
    hgrepos = []
    issue_num = 24324
    keywords = ['patch']
    message_count = 8.0
    messages = ['244377', '245035', '251001', '251004', '251017', '261323', '261324', '261325']
    nosy_count = 7.0
    nosy_names = ['loewis', 'skip.montanaro', 'pitrou', 'vstinner', 'ned.deily', 'python-dev', 'erik.bray']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue24324'
    versions = ['Python 3.5', 'Python 3.6']

    @smontanaro
    Copy link
    Contributor Author

    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 smontanaro added build The build process and cross-build labels May 29, 2015
    @smontanaro
    Copy link
    Contributor Author

    I guess this is an autoconf thing. "@BASECFLAGS@" in Makefile.pre.in seems to expand to "-Wsign-compare -Wunreachable-code" in Makefile.pre.

    @embray
    Copy link
    Contributor

    embray commented 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
    Copy link
    Member

    Can you please propose a patch?

    @smontanaro
    Copy link
    Contributor Author

    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
    Copy link
    Mannequin

    python-dev mannequin commented 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
    Copy link
    Mannequin

    python-dev mannequin commented 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
    Copy link
    Member

    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.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    build The build process and cross-build
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants