Unity: Flush function can't be omitted
Hi,
We are using Unity with output-char putting a character directly to the console. But we can’t omit the new Flush function added in commit c5c392b18a21b048ceb6f728bb7dea84c6e20db5.
When I define UNITY_OUTPUT_FLUSH or UNITY_OUTPUT_FLUSH() it fails at the https://github.com/ThrowTheSwitch/Unity/blob/master/src/unity_internals.h#L308 declaration.
For -D'UNITY_OUTPUT_FLUSH()'
:
error: macro "UNITY_OUTPUT_FLUSH" passed 1 arguments, but takes just 0
for -DUNITY_OUTPUT_FLUSH
:
error: expected identifier or '(' before numeric constant
../Unity/src/unity_internals.h:308:13: note: in expansion of macro 'UNITY_OUTPUT_FLUSH'
extern void UNITY_OUTPUT_FLUSH(void);
^
for -DUNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION -DUNITY_OUTPUT_FLUSH
:
<command-line>:0:20: error: expected identifier or '(' before numeric constant
../Unity/src/unity.c:15:5: note: in expansion of macro 'UNITY_OUTPUT_FLUSH'
int UNITY_OUTPUT_FLUSH(void);
^
for -DUNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION -D'UNITY_OUTPUT_FLUSH()'
:
../Unity/src/unity.c:15:28: error: macro "UNITY_OUTPUT_FLUSH" passed 1 arguments, but takes just 0
int UNITY_OUTPUT_FLUSH(void);
^
I’m out of combinations. I also tried thinks like: -D'UNITY_OUTPUT_FLUSH()'='(void)'
I just want to omit this feature which is unneeded for our case.
Having odd forward declarations all over the shop seems a bit odd. Perhaps a UNITY_HAS_FLUSH and UNITY_FLUSH_FORWARD_DECL config options are more desirable than the current situation.
Kind regards,
Rik
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 16 (16 by maintainers)
I only got caught with a different problem but this has nothing todo with the flush see issue #200.
@mvandervoord I have tested it and it works (for the flush function). We only specifiy our own
UNITY_OUTPUT_CHAR
and seems to be enough.@rikvdh you may close this issue.
😃 Anytime you can use XKCD in a comment is worthwhile.
Anyway, your statement on working out-of-the-box is exactly our goal. We try to make it Just Work ™ for most users and then allow them to override default behavior where needed. This feature is definitely failing to meet that criteria at this point!
snicker Well that was a colorful statement of support for revising this feature!
Rik:
Thanks for delving into this issue! I’ve reproduced your results and agree with all your findings. I’m also not happy with how complex this minor feature is at the moment… it’s something that is rarely used but is getting complicated for people to just ignore.
The biggest problem with the current implementation is that it really wants to detect if the UNITY_OUTPUT_FLUSH macro has been defined as nothing. The only good way to do that is to use VA_ARGS which isn’t standard. So that’s out.
I’ll fiddle around with it a bit and get a something working. It might be something along the lines of what you suggest. If anyone else has thoughts, now is the time. 😉