File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed
Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change 88#define __always_inline inline
99#endif
1010
11+ /* Not all C++ standards support type declarations inside an anonymous union */
12+ #ifndef __cplusplus
13+ #define __struct_group_tag (TAG ) TAG
14+ #else
15+ #define __struct_group_tag (TAG )
16+ #endif
17+
1118/**
1219 * __struct_group() - Create a mirrored named and anonyomous struct
1320 *
2027 * and size: one anonymous and one named. The former's members can be used
2128 * normally without sub-struct naming, and the latter can be used to
2229 * reason about the start, end, and size of the group of struct members.
23- * The named struct can also be explicitly tagged for layer reuse, as well
24- * as both having struct attributes appended.
30+ * The named struct can also be explicitly tagged for layer reuse (C only),
31+ * as well as both having struct attributes appended.
2532 */
2633#define __struct_group (TAG , NAME , ATTRS , MEMBERS ...) \
2734 union { \
2835 struct { MEMBERS } ATTRS; \
29- struct TAG { MEMBERS } ATTRS NAME; \
36+ struct __struct_group_tag( TAG) { MEMBERS } ATTRS NAME; \
3037 } ATTRS
3138
3239#ifdef __cplusplus
Original file line number Diff line number Diff line change 88#define __always_inline __inline__
99#endif
1010
11+ /* Not all C++ standards support type declarations inside an anonymous union */
12+ #ifndef __cplusplus
13+ #define __struct_group_tag (TAG ) TAG
14+ #else
15+ #define __struct_group_tag (TAG )
16+ #endif
17+
1118/**
1219 * __struct_group() - Create a mirrored named and anonyomous struct
1320 *
2027 * and size: one anonymous and one named. The former's members can be used
2128 * normally without sub-struct naming, and the latter can be used to
2229 * reason about the start, end, and size of the group of struct members.
23- * The named struct can also be explicitly tagged for layer reuse, as well
24- * as both having struct attributes appended.
30+ * The named struct can also be explicitly tagged for layer reuse (C only),
31+ * as well as both having struct attributes appended.
2532 */
2633#define __struct_group (TAG , NAME , ATTRS , MEMBERS ...) \
2734 union { \
2835 struct { MEMBERS } ATTRS; \
29- struct TAG { MEMBERS } ATTRS NAME; \
30- }
36+ struct __struct_group_tag( TAG) { MEMBERS } ATTRS NAME; \
37+ } ATTRS
3138
3239/**
3340 * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
You can’t perform that action at this time.
0 commit comments