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

implicit-fallthrough warnings in sinproc/sws #1110

Open
andreasstieger opened this issue Feb 4, 2024 · 1 comment
Open

implicit-fallthrough warnings in sinproc/sws #1110

andreasstieger opened this issue Feb 4, 2024 · 1 comment

Comments

@andreasstieger
Copy link

A number of switch case fall-through warnings are triggered. This is gcc13-13.2.1,

[   55s] /home/abuild/rpmbuild/BUILD/nanomsg-1.2.1/src/transports/inproc/sinproc.c: In function ‘nn_sinproc_shutdown_events’:
[   55s] /home/abuild/rpmbuild/BUILD/nanomsg-1.2.1/src/transports/inproc/sinproc.c:224:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
[   55s]   224 |         switch (type) {
[   55s]       |         ^~~~~~
[   55s] /home/abuild/rpmbuild/BUILD/nanomsg-1.2.1/src/transports/inproc/sinproc.c:242:5: note: here
[   55s]   242 |     case NN_SINPROC_SRC_PEER:
[   55s]       |     ^~~~
[   55s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/nanomsg-1.2.1/build'

If this fall-through is intended, in case of src == NN_FSM_ACTION and type != NN_FSM_STOP, please mark it with /* FALLTHRU */ or __attribute__ ((fallthrough)), or [[fallthrough]]; in C++17.

The second one is a 500 line switch-case statement which, which has some fall-through cases that may or may not be intended.

[   56s] /home/abuild/rpmbuild/BUILD/nanomsg-1.2.1/src/transports/ws/sws.c: In function ‘nn_sws_handler’:
[   56s] /home/abuild/rpmbuild/BUILD/nanomsg-1.2.1/src/transports/ws/sws.c:974:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
[   56s]   974 |         switch (src) {
[   56s]       |         ^~~~~~
[   56s] /home/abuild/rpmbuild/BUILD/nanomsg-1.2.1/src/transports/ws/sws.c:1495:5: note: here
[   56s]  1495 |     case NN_SWS_STATE_CLOSING_CONNECTION:
[   56s]       |     ^~~~
[   56s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/nanomsg-1.2.1/build'
[   56s] make[2]: Entering directory '/home/abuild/rpmbuild/BUILD/nanomsg-1.2.1/build'

Full flags are:

[   44s] + /usr/bin/cmake /home/abuild/rpmbuild/BUILD/nanomsg-1.2.1/. '-GUnix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_BINDIR:PATH=bin -DCMAKE_INSTALL_SBINDIR:PATH=sbin -DCMAKE_INSTALL_LIBEXECDIR:PATH=libexec -DCMAKE_INSTALL_SYSCONFDIR:PATH=etc -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=/var/lib -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=var -DCMAKE_INSTALL_RUNSTATEDIR:PATH=run -DCMAKE_INSTALL_LIBDIR:PATH=lib64 -DCMAKE_INSTALL_INCLUDEDIR:PATH=include -DCMAKE_INSTALL_DATAROOTDIR:PATH=share -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DCMAKE_BUILD_TYPE=RelWithDebInfo '-DCMAKE_C_FLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g' '-DCMAKE_CXX_FLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g' '-DCMAKE_Fortran_FLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g' '-DCMAKE_EXE_LINKER_FLAGS=-flto=auto -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' '-DCMAKE_MODULE_LINKER_FLAGS=-flto=auto -Wl,--as-needed' '-DCMAKE_SHARED_LINKER_FLAGS=-flto=auto -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' -DLIB_SUFFIX=64 -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=OFF -DCMAKE_COLOR_MAKEFILE:BOOL=OFF -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF -DCMAKE_MODULES_INSTALL_DIR=/usr/lib64/cmake/nanomsg
@andreasstieger
Copy link
Author

Previously rejected in #1056

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

No branches or pull requests

1 participant