meekrosoft / fff

A testing micro framework for creating function test doubles
Other
749 stars 163 forks source link

fix FAKE_VALUE_FUNC example #95

Open mmitch opened 3 years ago

mmitch commented 3 years ago

This is a documentation update:

Functions without arguments need FAKE_VALUE_FUNC0 instead of FAKE_VALUE_FUNC, otherwise C compiler will emit warnings like ISO C99 requires at least one argument for the "..." in a variadic macro.

AppVeyorBot commented 3 years ago

:white_check_mark: Build fff 89-appveyor completed (commit https://github.com/meekrosoft/fff/commit/7e356d6225 by @mmitch)

rubiot commented 3 years ago

I just opened a pull request to fix this warning, so you won't need to use FAKE_VALUE_FUNC0 anymore.

mmitch commented 3 years ago

Your linked pull request does not resolve, did you mean https://github.com/meekrosoft/fff/pull/98?

rubiot commented 3 years ago

Ah, yes, sorry.

mmitch commented 3 years ago

I have applied your pull request to my project after reverting from FAKE_VALUE_FUNC0 to FAKE_VALUE_FUNC. See this branch here: https://github.com/mmitch/syndig/tree/warning-fix

While the GCC throws no pedantic errors after applying your patch, the clang build still fails. If I understand correctly, #pragma GCC system_header just disables the warnings, it does not fix anything about using the wrong macro. I think it's better to fix the code (by using ..._FUNC0 over ..._FUNC) instead of disabling the warnings and thus the example in the documentation should be updated to that regard instead.

(I was unsure if I should reply here or over at your pull request.)