-
Notifications
You must be signed in to change notification settings - Fork 128
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 zero-variadic-macro-arguments warning when using clang. #768
Conversation
When building this package with clang, we get a lot of warnings like the following: must specify at least one argument for '...' parameter of variadic macro That comes mostly from the TYPED_TEST_SUITE macros in gtest, the signature of which looks like: Prior to C++20, C++ technically did not allow macros with variadic arguments to be called with nothing for the last variadic part. This is allowed in C++20, but we aren't ready to transition to it yet. So just add in an unused third "empty" argument anytime we use these variadic arguments. This will quiet the warning on clang and have no effect on operation. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
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.
🤷
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.
We ran into this in the gazebo codebase as well and it annoys me deeply.
So There are two paths forward here:
I think I'm going to go for 2; this will stop being a warning at all in C++20, so I really don't see a downside to doing it. |
This reverts commit cdf6746. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
Signed-off-by: Chris Lalancette <clalancette@gmail.com>
9d84354
to
1b408f6
Compare
And this is now done in 1b408f6. Here's CI: |
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.
After some offline deliberating, I'm good with this flag. It's an artifact of -Wpedantic
and clang
and will be resolved in C++20.
Since this is all test code, there is no potential of this leaking to other packages.
When building this package with clang, we get a lot of warnings like the following:
must specify at least one argument for '...' parameter of variadic macro
That comes mostly from the TYPED_TEST_SUITE macros in gtest, the signature of which looks like:
Prior to C++20, C++ technically did not allow macros with variadic arguments to be called with nothing for the last variadic part. This is allowed in C++20, but we aren't ready to transition to it yet.
So just add in an unused third "empty" argument anytime we use these variadic arguments. This will quiet the warning on clang and have no effect on operation.