Skip to content

Check fall-through in _codecs_iso2022.c #75458

Closed

Description

@skrah
mannequin
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']

    Activity

    1. skrah commented on Aug 25, 2017

      skrahmannequin
      MannequinAuthor

      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;
    2. serhiy-storchaka commented on Aug 25, 2017

      @serhiy-storchaka
      Member

      This looks equivalent to me.

    3. skrah commented on Aug 25, 2017

      skrahmannequin
      MannequinAuthor

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

    4. skrah commented on Aug 25, 2017

      skrahmannequin
      MannequinAuthor

      Thanks, Serhiy!

    5. added
      3.7 (EOL)
      build
      on Aug 25, 2017
    6. added
      build
      on Aug 25, 2017
    7. vstinner commented on Sep 12, 2017

      @vstinner
      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

    8. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)build

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions