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>
This commit is contained in:
parent
f0e2e1bccb
commit
9960bd9545
1 changed files with 1 additions and 1 deletions
|
@ -100,7 +100,7 @@ typedef struct {
|
|||
#define _OBJECT_TRACING_INIT .__next = NULL,
|
||||
#else
|
||||
#define _OBJECT_TRACING_INIT
|
||||
#define _OBJECT_TRACING_NEXT_PTR(type)
|
||||
#define _OBJECT_TRACING_NEXT_PTR(type) u8_t __dummy_next[0]
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_POLL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue