iceoryx icon indicating copy to clipboard operation
iceoryx copied to clipboard

Remove suppressions of `Wgnu-zero-variadic-macro-arguments`

Open elfenpiff opened this issue 1 year ago • 5 comments

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 avatar Sep 20 '22 09:09 elfenpiff

@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 avatar Sep 21 '22 20:09 elBoberido

@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 avatar Sep 22 '22 08:09 elfenpiff

@elfenpiff that's the problem. In this case it does not compile and a void does also not help

elBoberido avatar Sep 22 '22 10:09 elBoberido

@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

elBoberido avatar Sep 22 '22 11:09 elBoberido

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 avatar Sep 22 '22 12:09 elfenpiff

@elfenpiff don't worry, TYPED_TEST_CASE is already ported to TYPED_TEST_SUITE. I did it in January :)

elBoberido avatar Sep 22 '22 17:09 elBoberido

@elBoberido then lets go for it. I created an issue: https://github.com/eclipse-iceoryx/iceoryx/issues/1663

elfenpiff avatar Sep 23 '22 09:09 elfenpiff

We switched to gTest 1.14 which fixed the last task.

elBoberido avatar Mar 26 '24 22:03 elBoberido