Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
portability: Ensure no C99-illegal semicolons exists in structs
Macro _OBJECT_TRACING_NEXT_PTR expands to a member or to nothing. Macro _OBJECT_TRACING_NEXT_PTR is used in a number of places, like: struct k_stack { .. omitted .. _OBJECT_TRACING_NEXT_PTR(k_stack); u8_t flags; }; When the macro expands to nothing, a lonesome semi would remain. This is illegal in C99, but permitted in GCC with GNU extensions. Rather than expand to empty, we now expand to a zero-length array. This means we can retain the trailing semis across structs wherein the macro is used. Note that zero-length array (foo[0]) != flexible array member (foo[]): * zero-length array: Is GNU+Clang extension. Anywhere in struct. * flexible array member: Is C99. Only in end of struct. Thus we have really only traded-off one portability issue for another, more acceptable, one at least. Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
- Loading branch information