-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
build: add -Wimplicit-fallthrough #14561
Conversation
once ci finishes I'll push this in |
Wow that's interesting. It looks like we actually have some implicit fallthrough but only OpenBSD build catches them. I tested locally on Ubuntu 20.04 and didn't see the errors. CI doesn't have errors on Ubuntu as well... |
clang-15 reproduces this problem for me on my build machine |
cb5ee0a
to
87f65e1
Compare
So yes, OpenBSD uses clang as a compiler and there were two problems with the current code:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -229,7 +229,7 @@ send_capability(struct nbr *nbr, uint16_t capability, int enable) | |||
* Announcement Parameter in Capability messages sent to | |||
* its peers". | |||
*/ | |||
/* FALLTHROUGH */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree that this should be a fallthrough to the below message. The message seems wrong to me.
@@ -333,7 +333,7 @@ recv_capability(struct nbr *nbr, char *buf, uint16_t len) | |||
* parameter and process any other Capability Parameters | |||
* in the message". | |||
*/ | |||
/* FALLTHROUGH */ | |||
fallthrough; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again the actions taken in the default seem to be off to me.
Mark, Igor and myself spoke in slack and had this conversation: a) This changes exposes some problems in the code from my perspective, but it is not Igor's fault for this exposure and as such should not be punished Igor has agreed to go through and fix the easy ones. The harder ones I am tracking down the original implementer and asking them to fix them problems. The easy one's should not be too much of a problem to go through and fix, all three of us have seen changes that need to be made and Igor should be positioning these changes soon. Let's hold off pushing this in until Igor updates the PR again. |
Also: - replace all /* fallthrough */ comments with portable fallthrough; pseudo keyword to accomodate both gcc and clang - add missing break; statements as required by older versions of gcc - cleanup some code to remove unnecessary fallthrough Signed-off-by: Igor Ryzhov <[email protected]>
87f65e1
to
7d67b9f
Compare
I cleaned up all places where the use of |
There are currently no cases of implicit fallthrough in FRR. Adding this to be safe in the future.