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

Check fall-through in _codecs_iso2022.c #75458

Closed
skrah mannequin opened this issue Aug 25, 2017 · 5 comments
Closed

Check fall-through in _codecs_iso2022.c #75458

skrah mannequin opened this issue Aug 25, 2017 · 5 comments
Labels
3.7 (EOL) end of life build The build process and cross-build

Comments

@skrah
Copy link
Mannequin

skrah mannequin commented Aug 25, 2017

BPO 31275
Nosy @vstinner, @skrah, @serhiy-storchaka
PRs
  • bpo-31275: Small refactoring to silence a fall-through warning. #3206
  • [3.6] bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0 #3518
  • 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 2017-08-25.16:32:52.091>
    created_at = <Date 2017-08-25.12:21:15.652>
    labels = ['build', '3.7']
    title = 'Check fall-through in _codecs_iso2022.c'
    updated_at = <Date 2017-09-12.23:15:33.807>
    user = 'https://github.com/skrah'

    bugs.python.org fields:

    activity = <Date 2017-09-12.23:15:33.807>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-08-25.16:32:52.091>
    closer = 'skrah'
    components = ['Build']
    creation = <Date 2017-08-25.12:21:15.652>
    creator = 'skrah'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31275
    keywords = []
    message_count = 5.0
    messages = ['300834', '300836', '300844', '300846', '302004']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'skrah', 'serhiy.storchaka']
    pr_nums = ['3206', '3518']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue31275'
    versions = ['Python 3.6', 'Python 3.7']

    @skrah
    Copy link
    Mannequin Author

    skrah mannequin commented Aug 25, 2017

    The last fall-through warning is in _codecs_iso2022.c. IMO the
    current code is equivalent to this, but I'm no codecs expert at
    all:

    diff --git a/Modules/cjkcodecs/_codecs_iso2022.c b/Modules/cjkcodecs/_codecs_iso2022.c
    index 1ce4218f30..abf214880f 100644
    --- a/Modules/cjkcodecs/_codecs_iso2022.c
    +++ b/Modules/cjkcodecs/_codecs_iso2022.c
    @@ -807,15 +807,9 @@ jisx0213_encoder(const Py_UCS4 *data, Py_ssize_t *length, void *config)
         case 2: /* second character of unicode pair */
             coded = find_pairencmap((ucs2_t)data[0], (ucs2_t)data[1],
                                     jisx0213_pair_encmap, JISX0213_ENCPAIRS);
    -        if (coded == DBCINV) {
    -            *length = 1;
    -            coded = find_pairencmap((ucs2_t)data[0], 0,
    -                      jisx0213_pair_encmap, JISX0213_ENCPAIRS);
    -            if (coded == DBCINV)
    -                return MAP_UNMAPPABLE;
    -        }
    -        else
    +        if (coded != DBCINV) {
                 return coded;
    +        /* fall through */
     
         case -1: /* flush unterminated */
             *length = 1;

    @serhiy-storchaka
    Copy link
    Member

    This looks equivalent to me.

    @skrah
    Copy link
    Mannequin Author

    skrah mannequin commented Aug 25, 2017

    New changeset 138753c by Stefan Krah in branch 'master':
    bpo-31275: Small refactoring to silence a fall-through warning. (bpo-3206)
    138753c

    @skrah
    Copy link
    Mannequin Author

    skrah mannequin commented Aug 25, 2017

    Thanks, Serhiy!

    @skrah skrah mannequin added 3.7 (EOL) end of life build The build process and cross-build labels Aug 25, 2017
    @skrah skrah mannequin closed this as completed Aug 25, 2017
    @skrah skrah mannequin added the build The build process and cross-build label Aug 25, 2017
    @vstinner
    Copy link
    Member

    New changeset c0e7736 by Victor Stinner in branch '3.6':
    [3.6] bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0 (bpo-3518)
    c0e7736

    @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
    3.7 (EOL) end of life build The build process and cross-build
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants