-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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
Fix Wpedantic warning 'extra ;' for c++ #10385
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b136ee3
Fix Wpedantic warning 'extra ;' for c++
marjoleinheyndrickx 8177cd0
Merge branch 'protocolbuffers:main' into main
marjoleinheyndrickx 71af720
Use protoc version for --version
deannagarcia 8fee1de
Update to have two distinct methods
deannagarcia f36b3c2
Disabling upb tests in python_cpp builds (#10392)
mkruskal-google 4c3ab6c
Reverting changes to ruby aarch64 build. (#10394)
mkruskal-google 7df94e2
Upgrade third_party/googletest submodule to current main branch (#10393)
acozzette 9450259
Fixing php proto generation script to work properly during sync (#10395)
mkruskal-google def602d
change macro to avoid pedantic warning
marjoleinheyndrickx 8335ad0
Merge branch 'protocolbuffers:main' into main
marjoleinheyndrickx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
please fix this macro to not end with a
;
insteadThere 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.
The macro is defined empty:
#if !defined(PROTOBUF_INTERNAL_CHECK_CLASS_SIZE) #define PROTOBUF_INTERNAL_CHECK_CLASS_SIZE(t, expected) #endif
which means the double ; comes from the fact that we have a regular statement before the macro, then emptyness (the macro) and then another ; after that.
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 can see that the removal of the ; from my patch would be problematic for anyone who has defined PROTOBUF_INTERNAL_CHECK_CLASS_SIZE as something which has content but doesn't end in ;
If it is the case that this macro is actually used, this pull request should probably be rejected or the macro definition there adapted.
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.
you could change the empty definition to
do {} while (false)
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.
since the macro's are used outside of a function scope, a regular function calling or piece of code won't compile there ("expected constructor, destructor, or type conversion before ';' token"). Putting an empty class or struct definition is also not possible since the macro is used multiple times so then you get redefinition errors.
The macro seems like something used internally by google, is that correct?
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.
you can change them to
static_assert(true, "")
which will be valid at all scopes.