This was used to allow semi-colons at the end of some macros, but all
the compilers can now handle semi-colons after structures and they can
also ignore extra semi-colons.
Details
Diff Detail
- Lint
Lint Passed - Unit
No Test Coverage
Event Timeline
Hmm, at least in atomic.h, the struct hack is not about compiler which is unable to handle ';' after structures (do such compiler ever existed ?). In atomic.h, the struct hack is used in macros which provide function definitions, to still allow to put semicolon after the macro. With your patch, the macro uses must very carefully avoid putting the ';' at the end of macro instantiations, which probably would confuse syntax-checking editors.
Also, I strongly recommend to mail the patch to bde, on the assumption that you would get a mail from him after the commit, anyway.
sys/amd64/include/atomic.h | ||
---|---|---|
128 | There are at least two more instances of the struct __hack in the file. |
The problem is that there are plenty of other macros in the system that already behave that way. struct __hack is not really consistent in this area because the compiler will never emit a warning unless -Wextra-semi is used (and maybe -Weverything).