iceoryx
iceoryx copied to clipboard
Remove suppressions of `Wgnu-zero-variadic-macro-arguments`
Brief feature description
The typed test case code and mocks for methods without parameter are cluttered with suppressions like
#ifdef __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif
TYPED_TEST_SUITE(IoxLogStreamHexBin_test, LogHexBinTypes);
#ifdef __clang__
#pragma GCC diagnostic pop
#endif
The solution to suppress this error is rather simple for typed tests. Just add an additional comma like:
TYPED_TEST_SUITE(IoxLogStreamHexBin_test, LogHexBinTypes, );
and the macros are completely gone.
For mock methods there is no workaround possible. The bug is fixed upstream and released with googletest v1.11.
Tasks
- [x] fix typed tests
- [ ] use googletests 1.11 and remove the suppression from the mock methods
@elfenpiff there were two types of macros where this warning was suppressed. One was TYPED_TEST_SUITE
and the second one is MOCK_METHOD
for methods without a parameter. This is fixed upstream in gTest. It seems to be part of the v1.11 release
@elBoberido but I fear that we won't use the latest gtest upstream version anytime soon. I would still add the extra comma when after the change the code compiles without errors with the latest gtest upstream version.
@elfenpiff that's the problem. In this case it does not compile and a void
does also not help
@elfenpiff I removed this from the v3 project and decreased the priority to low. Do you think we should create an issue to upgrade to googletest v1.11 or v1.12? I seems there is a bug with noexcept
mocks which is fixed in v1.11
https://github.com/google/googletest/releases
I think upgrading to 1.11 or 1.12 could become a huge task. You know gtest deprecated TYPED_TEST_CASES
and we use them excessively for testing generic types. I have no idea when this is being removed and we should check this first.
@elfenpiff don't worry, TYPED_TEST_CASE
is already ported to TYPED_TEST_SUITE
. I did it in January :)
@elBoberido then lets go for it. I created an issue: https://github.com/eclipse-iceoryx/iceoryx/issues/1663
We switched to gTest 1.14 which fixed the last task.