Skip to content

Disable -Wimplicit-fallthrough warning for Modules/expat #125506

@sobolevn

Description

@sobolevn

Bug report

Right now compilers produce a lot of warnings for vendored modules:

But, there's not much we can do about them, since they are vendored. For example, siphash has explicit fall-through comments:

case 7:
b |= (uint64_t)H->buf[6] << 48;
/* fall through */
case 6:
b |= (uint64_t)H->buf[5] << 40;
/* fall through */
case 5:
b |= (uint64_t)H->buf[4] << 32;
/* fall through */

But, it is still reported:

 In file included from ./Modules/expat/xmlparse.c:121:
./Modules/expat/siphash.h:238:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
  case 6:
  ^
./Modules/expat/siphash.h:238:3: note: insert '__attribute__((fallthrough));' to silence this warning
  case 6:
  ^
  __attribute__((fallthrough)); 
./Modules/expat/siphash.h:238:3: note: insert 'break;' to avoid fall-through
  case 6:
  ^
  break; 
./Modules/expat/siphash.h:241:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
  case 5:
  ^
./Modules/expat/siphash.h:241:3: note: insert '__attribute__((fallthrough));' to silence this warning
  case 5:
  ^
  __attribute__((fallthrough)); 
./Modules/expat/siphash.h:241:3: note: insert 'break;' to avoid fall-through
  case 5:
  ^
  break; 
./Modules/expat/siphash.h:244:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
  case 4:
  ^
./Modules/expat/siphash.h:244:3: note: insert '__attribute__((fallthrough));' to silence this warning
  case 4:
  ^
  __attribute__((fallthrough)); 
./Modules/expat/siphash.h:244:3: note: insert 'break;' to avoid fall-through
  case 4:
  ^
  break; 
./Modules/expat/siphash.h:247:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
  case 3:
  ^
./Modules/expat/siphash.h:247:3: note: insert '__attribute__((fallthrough));' to silence this warning
  case 3:
  ^
  __attribute__((fallthrough)); 
./Modules/expat/siphash.h:247:3: note: insert 'break;' to avoid fall-through
  case 3:
  ^
  break; 
./Modules/expat/siphash.h:250:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
  case 2:
  ^
./Modules/expat/siphash.h:250:3: note: insert '__attribute__((fallthrough));' to silence this warning
  case 2:
  ^
  __attribute__((fallthrough)); 
./Modules/expat/siphash.h:250:3: note: insert 'break;' to avoid fall-through
  case 2:
  ^
  break; 
./Modules/expat/siphash.h:253:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
  case 1:
  ^
./Modules/expat/siphash.h:253:3: note: insert '__attribute__((fallthrough));' to silence this warning
  case 1:
  ^
  __attribute__((fallthrough)); 
./Modules/expat/siphash.h:253:3: note: insert 'break;' to avoid fall-through
  case 1:
  ^
  break; 
./Modules/expat/siphash.h:256:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
  case 0:
  ^
./Modules/expat/siphash.h:256:3: note: insert 'break;' to avoid fall-through
  case 0:
  ^
  break; 
./Modules/expat/xmlparse.c:1944:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
  default:
  ^
./Modules/expat/xmlparse.c:1944:3: note: insert '__attribute__((fallthrough));' to silence this warning
  default:
  ^
  __attribute__((fallthrough)); 
./Modules/expat/xmlparse.c:1944:3: note: insert 'break;' to avoid fall-through
  default:
  ^
  break; 
./Modules/expat/xmlparse.c:2067:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
  default:
  ^
./Modules/expat/xmlparse.c:2067:3: note: insert '__attribute__((fallthrough));' to silence this warning
  default:
  ^
  __attribute__((fallthrough)); 
./Modules/expat/xmlparse.c:2067:3: note: insert 'break;' to avoid fall-through
  default:
  ^
  break; 
./Modules/expat/xmlparse.c:2096:5: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
    default:; /* should not happen */
    ^
./Modules/expat/xmlparse.c:2096:5: note: insert '__attribute__((fallthrough));' to silence this warning
    default:; /* should not happen */
    ^
    __attribute__((fallthrough)); 
./Modules/expat/xmlparse.c:2096:5: note: insert 'break;' to avoid fall-through
    default:; /* should not happen */
    ^
    break; 
./Modules/expat/xmlparse.c:2292:5: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
    default:;
    ^
./Modules/expat/xmlparse.c:2292:5: note: insert '__attribute__((fallthrough));' to silence this warning
    default:;
    ^
    __attribute__((fallthrough)); 
./Modules/expat/xmlparse.c:2292:5: note: insert 'break;' to avoid fall-through
    default:;
    ^
    break; 
./Modules/expat/xmlparse.c:4864:5: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
    case XML_ROLE_ENTITY_PUBLIC_ID:
    ^
./Modules/expat/xmlparse.c:4864:5: note: insert '__attribute__((fallthrough));' to silence this warning
    case XML_ROLE_ENTITY_PUBLIC_ID:
    ^
    __attribute__((fallthrough)); 
./Modules/expat/xmlparse.c:4864:5: note: insert 'break;' to avoid fall-through
    case XML_ROLE_ENTITY_PUBLIC_ID:
    ^
    break; 
./Modules/expat/xmlparse.c:5192:5: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
    case XML_ROLE_ENTITY_SYSTEM_ID:
    ^
./Modules/expat/xmlparse.c:5192:5: note: insert '__attribute__((fallthrough));' to silence this warning
    case XML_ROLE_ENTITY_SYSTEM_ID:
    ^
    __attribute__((fallthrough)); 
./Modules/expat/xmlparse.c:5192:5: note: insert 'break;' to avoid fall-through
    case XML_ROLE_ENTITY_SYSTEM_ID:
    ^
    break; 
./Modules/expat/xmlparse.c:6050:5: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
    case XML_TOK_ATTRIBUTE_VALUE_S:
    ^
./Modules/expat/xmlparse.c:6050:5: note: insert '__attribute__((fallthrough));' to silence this warning
    case XML_TOK_ATTRIBUTE_VALUE_S:
    ^
    __attribute__((fallthrough)); 
./Modules/expat/xmlparse.c:6050:5: note: insert 'break;' to avoid fall-through
    case XML_TOK_ATTRIBUTE_VALUE_S:
    ^
    break; 
./Modules/expat/xmlparse.c:6303:5: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
    case XML_TOK_DATA_NEWLINE:
    ^
./Modules/expat/xmlparse.c:6303:5: note: insert '__attribute__((fallthrough));' to silence this warning
    case XML_TOK_DATA_NEWLINE:
    ^
    __attribute__((fallthrough)); 
./Modules/expat/xmlparse.c:6303:5: note: insert 'break;' to avoid fall-through
    case XML_TOK_DATA_NEWLINE:
    ^
    break; 

My opinion is that we only should show actionable warnings, that we can actually fix.

CC @hugovk

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions