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

chore: fix -Wimplicit-fallthrough #1626

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

codebytere
Copy link
Contributor

Fixes -Wimplicit-fallthrough clang compilation errors encountered when building Electron and pulling in nghttp2 as a dependency via Node.js.

../../third_party/electron_node/deps/nghttp2/lib/nghttp2_hd.c:1895:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case NGHTTP2_HD_STATE_INFLATE_START:
    ^
../../third_party/electron_node/deps/nghttp2/lib/nghttp2_hd.c:1895:5: note: insert '__attribute__((fallthrough));' to silence this warning
    case NGHTTP2_HD_STATE_INFLATE_START:
    ^
    __attribute__((fallthrough));
../../third_party/electron_node/deps/nghttp2/lib/nghttp2_hd.c:1895:5: note: insert 'break;' to avoid fall-through
    case NGHTTP2_HD_STATE_INFLATE_START:
    ^
    break;
../../third_party/electron_node/deps/nghttp2/lib/nghttp2_hd.c:2005:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case NGHTTP2_HD_STATE_NEWNAME_READ_NAMELEN:
    ^
../../third_party/electron_node/deps/nghttp2/lib/nghttp2_hd.c:2005:5: note: insert '__attribute__((fallthrough));' to silence this warning
    case NGHTTP2_HD_STATE_NEWNAME_READ_NAMELEN:
    ^
    __attribute__((fallthrough));
../../third_party/electron_node/deps/nghttp2/lib/nghttp2_hd.c:2005:5: note: insert 'break;' to avoid fall-through
    case NGHTTP2_HD_STATE_NEWNAME_READ_NAMELEN:
    ^
    break;
../../third_party/electron_node/deps/nghttp2/lib/nghttp2_hd.c:2089:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case NGHTTP2_HD_STATE_READ_VALUELEN:
    ^
../../third_party/electron_node/deps/nghttp2/lib/nghttp2_hd.c:2089:5: note: insert '__attribute__((fallthrough));' to silence this warning
    case NGHTTP2_HD_STATE_READ_VALUELEN:
    ^
    __attribute__((fallthrough));
../../third_party/electron_node/deps/nghttp2/lib/nghttp2_hd.c:2089:5: note: insert 'break;' to avoid fall-through
    case NGHTTP2_HD_STATE_READ_VALUELEN:
    ^
    break;
3 errors generated.
[2/24] CC obj/third_party/electron_node/deps/nghttp2/nghttp2/nghttp2_session.o
ninja: build stopped: subcommand failed.
ERROR Error: Command failed: ninja -j 200 electron
    at checkExecSyncError (node:child_process:707:11)
    at Object.execFileSync (node:child_process:726:15)
    at Object.depotExecFileSync [as execFileSync] (/Users/codebytere/build-tools/src/utils/depot-tools.js:119:16)
    at runNinja (/Users/codebytere/build-tools/src/e-build.js:84:9)
    at Object.<anonymous> (/Users/codebytere/build-tools/src/e-build.js:142:3)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)

which is fixed by adding the explicit fallthrough attribute. Please let me know if you all would prefer a different solution to this issue!

@codebytere
Copy link
Contributor Author

Hmm - looks like this fails here (though not in our CI) - i'll keep looking 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant