You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.../include/zephyr/kernel.h:5707:9: error: either all initializer clauses should be designated or none of them should be
5707 | { \
| ^
...file.cpp:325:9: note: in expansion of macro ‘K_POLL_EVENT_STATIC_INITIALIZER’
325 | K_POLL_EVENT_STATIC_INITIALIZER(K_POLL_TYPE_MSGQ_DATA_AVAILABLE, K_POLL_MODE_NOTIFY_ONLY,
And the error is valid, since C++ does not allow mixing the initializes.
For C++, using __cplusplus #define to strip the extra brackets out could do it. But that would not be a fix for clang -Wc99-designator error. Is there some xt-xcc define which could be utilized instead?
Introduction
Extension to the discussion filed here:
#33549
Problem description
The following MACROs to init a struct are mixing designated and non-designated initializers.
Note, the initialization of
{.obj = _event_obj}
This triggers
-Wc99-designator
error.Proposed change
The error can be fixed up by explicitly introducing a concrete variable for anonymous union and initialize with designated initializer
Detailed RFC
With this the union in new
struct k_poll_event
can now beSo the macros will now be:
Dependencies
None
Concerns and Unresolved Questions
Alternatives
Directly initialize anonymous
.obj
variable. c99 allows this way since, the nest.obj
is unique in globalstruct k_poll_event
struct.The text was updated successfully, but these errors were encountered: