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 8
8
#define __always_inline inline
9
9
#endif
10
10
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
+
11
18
/**
12
19
* __struct_group() - Create a mirrored named and anonyomous struct
13
20
*
20
27
* and size: one anonymous and one named. The former's members can be used
21
28
* normally without sub-struct naming, and the latter can be used to
22
29
* 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.
25
32
*/
26
33
#define __struct_group (TAG , NAME , ATTRS , MEMBERS ...) \
27
34
union { \
28
35
struct { MEMBERS } ATTRS; \
29
- struct TAG { MEMBERS } ATTRS NAME; \
36
+ struct __struct_group_tag( TAG) { MEMBERS } ATTRS NAME; \
30
37
} ATTRS
31
38
32
39
#ifdef __cplusplus
Original file line number Diff line number Diff line change 8
8
#define __always_inline __inline__
9
9
#endif
10
10
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
+
11
18
/**
12
19
* __struct_group() - Create a mirrored named and anonyomous struct
13
20
*
20
27
* and size: one anonymous and one named. The former's members can be used
21
28
* normally without sub-struct naming, and the latter can be used to
22
29
* 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.
25
32
*/
26
33
#define __struct_group (TAG , NAME , ATTRS , MEMBERS ...) \
27
34
union { \
28
35
struct { MEMBERS } ATTRS; \
29
- struct TAG { MEMBERS } ATTRS NAME; \
30
- }
36
+ struct __struct_group_tag( TAG) { MEMBERS } ATTRS NAME; \
37
+ } ATTRS
31
38
32
39
/**
33
40
* __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
You can’t perform that action at this time.
0 commit comments