Stylecheck: ERROR: space required before the open parenthesis '('

Viewed 298

I have a C++ macro it looks like below,

#define UTRACE_WRITE(trace_fd, ...)     do { if (trace_fd >= 0) this->trace_write (trace_fd, __VA_ARGS__); } while(0);

Style check program checkpatch.pl through an error as below

ERROR: space required before the open parenthesis '('

How to overcome the above error instead of using /*IGNORE_STYLE_CHECK*/?

Also, my style check code giving a warning for ';' What is the future problem if I ignore this?

WARNING: do {} while (0) macros should not be semicolon terminated
1 Answers

I really like answers, so here it is:

#define UTRACE_WRITE(trace_fd, ...)     do { if (trace_fd >= 0) this->trace_write (trace_fd, __VA_ARGS__); } while (0)

put a space in here in front of the open parenthesis: while (0)

and remove the semicolon after the close parenthesis at the end.

Related