d48eb60bd527ce364e21ab17c33d6d9cac90ab96
1 // SPDX-License-Identifier: MIT
3 * Copyright 2022-2023 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 #ifndef SIDE_INSTRUMENTATION_C_API_H
7 #define SIDE_INSTRUMENTATION_C_API_H
10 #include <side/macros.h>
11 #include <side/endian.h>
13 #include <side/abi/type-value.h>
14 #include <side/abi/attribute.h>
15 #include <side/abi/type-description.h>
17 #if (SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN)
18 # define SIDE_TYPE_BYTE_ORDER_HOST SIDE_TYPE_BYTE_ORDER_LE
20 # define SIDE_TYPE_BYTE_ORDER_HOST SIDE_TYPE_BYTE_ORDER_BE
23 #if (SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN)
24 # define SIDE_TYPE_FLOAT_WORD_ORDER_HOST SIDE_TYPE_BYTE_ORDER_LE
26 # define SIDE_TYPE_FLOAT_WORD_ORDER_HOST SIDE_TYPE_BYTE_ORDER_BE
29 /* Event and type attributes */
31 #define side_attr(_key, _value) \
34 .p = SIDE_PTR_INIT(_key), \
35 .unit_size = sizeof(uint8_t), \
36 .byte_order = SIDE_ENUM_INIT(SIDE_TYPE_BYTE_ORDER_HOST), \
38 .value = SIDE_PARAM(_value), \
41 #define side_attr_list(...) \
42 SIDE_COMPOUND_LITERAL(const struct side_attr, __VA_ARGS__)
44 #define side_attr_null(_val) { .type = SIDE_ATTR_TYPE_NULL }
45 #define side_attr_bool(_val) { .type = SIDE_ENUM_INIT(SIDE_ATTR_TYPE_BOOL), .u = { .bool_value = !!(_val) } }
46 #define side_attr_u8(_val) { .type = SIDE_ENUM_INIT(SIDE_ATTR_TYPE_U8), .u = { .integer_value = { .side_u8 = (_val) } } }
47 #define side_attr_u16(_val) { .type = SIDE_ENUM_INIT(SIDE_ATTR_TYPE_U16), .u = { .integer_value = { .side_u16 = (_val) } } }
48 #define side_attr_u32(_val) { .type = SIDE_ENUM_INIT(SIDE_ATTR_TYPE_U32), .u = { .integer_value = { .side_u32 = (_val) } } }
49 #define side_attr_u64(_val) { .type = SIDE_ENUM_INIT(SIDE_ATTR_TYPE_U64), .u = { .integer_value = { .side_u64 = (_val) } } }
50 #define side_attr_u128(_val) { .type = SIDE_ENUM_INIT(SIDE_ATTR_TYPE_U128), .u = { .integer_value = { .side_u128 = (_val) } } }
51 #define side_attr_s8(_val) { .type = SIDE_ENUM_INIT(SIDE_ATTR_TYPE_S8), .u = { .integer_value = { .side_s8 = (_val) } } }
52 #define side_attr_s16(_val) { .type = SIDE_ENUM_INIT(SIDE_ATTR_TYPE_S16), .u = { .integer_value = { .side_s16 = (_val) } } }
53 #define side_attr_s32(_val) { .type = SIDE_ENUM_INIT(SIDE_ATTR_TYPE_S32), .u = { .integer_value = { .side_s32 = (_val) } } }
54 #define side_attr_s64(_val) { .type = SIDE_ENUM_INIT(SIDE_ATTR_TYPE_S64), .u = { .integer_value = { .side_s64 = (_val) } } }
55 #define side_attr_s128(_val) { .type = SIDE_ENUM_INIT(SIDE_ATTR_TYPE_S128), .u = { .integer_value = { .side_s128 = (_val) } } }
56 #define side_attr_float_binary16(_val) { .type = SIDE_ENUM_INIT(SIDE_ATTR_TYPE_FLOAT_BINARY16), .u = { .float_value = { .side_float_binary16 = (_val) } } }
57 #define side_attr_float_binary32(_val) { .type = SIDE_ENUM_INIT(SIDE_ATTR_TYPE_FLOAT_BINARY32), .u = { .float_value = { .side_float_binary32 = (_val) } } }
58 #define side_attr_float_binary64(_val) { .type = SIDE_ENUM_INIT(SIDE_ATTR_TYPE_FLOAT_BINARY64), .u = { .float_value = { .side_float_binary64 = (_val) } } }
59 #define side_attr_float_binary128(_val) { .type = SIDE_ENUM_INIT(SIDE_ATTR_TYPE_FLOAT_BINARY128), .u = { .float_value = { .side_float_binary128 = (_val) } } }
61 #define _side_attr_string(_val, _byte_order, _unit_size) \
63 .type = SIDE_ENUM_INIT(SIDE_ATTR_TYPE_STRING), \
66 .p = SIDE_PTR_INIT(_val), \
67 .unit_size = _unit_size, \
68 .byte_order = SIDE_ENUM_INIT(_byte_order), \
73 #define side_attr_string(_val) _side_attr_string(_val, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint8_t))
74 #define side_attr_string16(_val) _side_attr_string(_val, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint16_t))
75 #define side_attr_string32(_val) _side_attr_string(_val, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint32_t))
77 /* Stack-copy enumeration type definitions */
79 #define side_define_enum(_identifier, _mappings, _attr...) \
80 const struct side_enum_mappings _identifier = { \
81 .mappings = SIDE_PTR_INIT(_mappings), \
82 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
83 .nr_mappings = SIDE_ARRAY_SIZE(SIDE_PARAM(_mappings)), \
84 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
87 #define side_enum_mapping_list(...) \
88 SIDE_COMPOUND_LITERAL(const struct side_enum_mapping, __VA_ARGS__)
90 #define side_enum_mapping_range(_label, _begin, _end) \
92 .range_begin = _begin, \
95 .p = SIDE_PTR_INIT(_label), \
96 .unit_size = sizeof(uint8_t), \
97 .byte_order = SIDE_ENUM_INIT(SIDE_TYPE_BYTE_ORDER_HOST), \
101 #define side_enum_mapping_value(_label, _value) \
103 .range_begin = _value, \
104 .range_end = _value, \
106 .p = SIDE_PTR_INIT(_label), \
107 .unit_size = sizeof(uint8_t), \
108 .byte_order = SIDE_ENUM_INIT(SIDE_TYPE_BYTE_ORDER_HOST), \
112 #define side_define_enum_bitmap(_identifier, _mappings, _attr...) \
113 const struct side_enum_bitmap_mappings _identifier = { \
114 .mappings = SIDE_PTR_INIT(_mappings), \
115 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
116 .nr_mappings = SIDE_ARRAY_SIZE(SIDE_PARAM(_mappings)), \
117 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
120 #define side_enum_bitmap_mapping_list(...) \
121 SIDE_COMPOUND_LITERAL(const struct side_enum_bitmap_mapping, __VA_ARGS__)
123 #define side_enum_bitmap_mapping_range(_label, _begin, _end) \
125 .range_begin = _begin, \
128 .p = SIDE_PTR_INIT(_label), \
129 .unit_size = sizeof(uint8_t), \
130 .byte_order = SIDE_ENUM_INIT(SIDE_TYPE_BYTE_ORDER_HOST), \
134 #define side_enum_bitmap_mapping_value(_label, _value) \
136 .range_begin = _value, \
137 .range_end = _value, \
139 .p = SIDE_PTR_INIT(_label), \
140 .unit_size = sizeof(uint8_t), \
141 .byte_order = SIDE_ENUM_INIT(SIDE_TYPE_BYTE_ORDER_HOST), \
145 /* Stack-copy field and type definitions */
147 #define side_type_null(_attr...) \
149 .type = SIDE_ENUM_INIT(SIDE_TYPE_NULL), \
152 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
153 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
158 #define side_type_bool(_attr...) \
160 .type = SIDE_ENUM_INIT(SIDE_TYPE_BOOL), \
163 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
164 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
165 .bool_size = sizeof(uint8_t), \
167 .byte_order = SIDE_ENUM_INIT(SIDE_TYPE_BYTE_ORDER_HOST), \
172 #define side_type_byte(_attr...) \
174 .type = SIDE_ENUM_INIT(SIDE_TYPE_BYTE), \
177 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
178 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
183 #define _side_type_string(_type, _byte_order, _unit_size, _attr) \
185 .type = SIDE_ENUM_INIT(_type), \
188 .attr = SIDE_PTR_INIT(_attr), \
189 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
190 .unit_size = _unit_size, \
191 .byte_order = SIDE_ENUM_INIT(_byte_order), \
196 #define side_type_dynamic() \
198 .type = SIDE_ENUM_INIT(SIDE_TYPE_DYNAMIC), \
201 #define _side_type_integer(_type, _signedness, _byte_order, _integer_size, _len_bits, _attr) \
203 .type = SIDE_ENUM_INIT(_type), \
206 .attr = SIDE_PTR_INIT(_attr), \
207 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
208 .integer_size = _integer_size, \
209 .len_bits = _len_bits, \
210 .signedness = _signedness, \
211 .byte_order = SIDE_ENUM_INIT(_byte_order), \
216 #define _side_type_float(_type, _byte_order, _float_size, _attr) \
218 .type = SIDE_ENUM_INIT(_type), \
221 .attr = SIDE_PTR_INIT(_attr), \
222 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
223 .float_size = _float_size, \
224 .byte_order = SIDE_ENUM_INIT(_byte_order), \
229 #define _side_field(_name, _type) \
231 .field_name = SIDE_PTR_INIT(_name), \
232 .side_type = _type, \
235 #define side_option_range(_range_begin, _range_end, _type) \
237 .range_begin = _range_begin, \
238 .range_end = _range_end, \
239 .side_type = _type, \
242 #define side_option(_value, _type) \
243 side_option_range(_value, _value, SIDE_PARAM(_type))
246 #define side_type_u8(_attr...) _side_type_integer(SIDE_TYPE_U8, false, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint8_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
247 #define side_type_u16(_attr...) _side_type_integer(SIDE_TYPE_U16, false, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint16_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
248 #define side_type_u32(_attr...) _side_type_integer(SIDE_TYPE_U32, false, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint32_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
249 #define side_type_u64(_attr...) _side_type_integer(SIDE_TYPE_U64, false, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint64_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
250 #define side_type_u128(_attr...) _side_type_integer(SIDE_TYPE_U128, false, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(unsigned __int128), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
251 #define side_type_s8(_attr...) _side_type_integer(SIDE_TYPE_S8, true, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(int8_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
252 #define side_type_s16(_attr...) _side_type_integer(SIDE_TYPE_S16, true, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(int16_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
253 #define side_type_s32(_attr...) _side_type_integer(SIDE_TYPE_S32, true, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(int32_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
254 #define side_type_s64(_attr...) _side_type_integer(SIDE_TYPE_S64, true, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(int64_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
255 #define side_type_s128(_attr...) _side_type_integer(SIDE_TYPE_S128, true, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(__int128), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
256 #define side_type_pointer(_attr...) _side_type_integer(SIDE_TYPE_POINTER, false, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uintptr_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
257 #define side_type_float_binary16(_attr...) _side_type_float(SIDE_TYPE_FLOAT_BINARY16, SIDE_TYPE_FLOAT_WORD_ORDER_HOST, sizeof(_Float16), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
258 #define side_type_float_binary32(_attr...) _side_type_float(SIDE_TYPE_FLOAT_BINARY32, SIDE_TYPE_FLOAT_WORD_ORDER_HOST, sizeof(_Float32), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
259 #define side_type_float_binary64(_attr...) _side_type_float(SIDE_TYPE_FLOAT_BINARY64, SIDE_TYPE_FLOAT_WORD_ORDER_HOST, sizeof(_Float64), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
260 #define side_type_float_binary128(_attr...) _side_type_float(SIDE_TYPE_FLOAT_BINARY128, SIDE_TYPE_FLOAT_WORD_ORDER_HOST, sizeof(_Float128), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
261 #define side_type_string(_attr...) _side_type_string(SIDE_TYPE_STRING_UTF8, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint8_t), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
262 #define side_type_string16(_attr...) _side_type_string(SIDE_TYPE_STRING_UTF16, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint16_t), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
263 #define side_type_string32(_attr...) _side_type_string(SIDE_TYPE_STRING_UTF32, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint32_t), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
265 #define side_field_null(_name, _attr...) _side_field(_name, side_type_null(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
266 #define side_field_bool(_name, _attr...) _side_field(_name, side_type_bool(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
267 #define side_field_u8(_name, _attr...) _side_field(_name, side_type_u8(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
268 #define side_field_u16(_name, _attr...) _side_field(_name, side_type_u16(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
269 #define side_field_u32(_name, _attr...) _side_field(_name, side_type_u32(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
270 #define side_field_u64(_name, _attr...) _side_field(_name, side_type_u64(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
271 #define side_field_u128(_name, _attr...) _side_field(_name, side_type_u128(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
272 #define side_field_s8(_name, _attr...) _side_field(_name, side_type_s8(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
273 #define side_field_s16(_name, _attr...) _side_field(_name, side_type_s16(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
274 #define side_field_s32(_name, _attr...) _side_field(_name, side_type_s32(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
275 #define side_field_s64(_name, _attr...) _side_field(_name, side_type_s64(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
276 #define side_field_s128(_name, _attr...) _side_field(_name, side_type_s128(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
277 #define side_field_byte(_name, _attr...) _side_field(_name, side_type_byte(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
278 #define side_field_pointer(_name, _attr...) _side_field(_name, side_type_pointer(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
279 #define side_field_float_binary16(_name, _attr...) _side_field(_name, side_type_float_binary16(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
280 #define side_field_float_binary32(_name, _attr...) _side_field(_name, side_type_float_binary32(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
281 #define side_field_float_binary64(_name, _attr...) _side_field(_name, side_type_float_binary64(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
282 #define side_field_float_binary128(_name, _attr...) _side_field(_name, side_type_float_binary128(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
283 #define side_field_string(_name, _attr...) _side_field(_name, side_type_string(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
284 #define side_field_string16(_name, _attr...) _side_field(_name, side_type_string16(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
285 #define side_field_string32(_name, _attr...) _side_field(_name, side_type_string32(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
286 #define side_field_dynamic(_name) _side_field(_name, side_type_dynamic())
289 #define side_type_u16_le(_attr...) _side_type_integer(SIDE_TYPE_U16, false, SIDE_TYPE_BYTE_ORDER_LE, sizeof(uint16_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
290 #define side_type_u32_le(_attr...) _side_type_integer(SIDE_TYPE_U32, false, SIDE_TYPE_BYTE_ORDER_LE, sizeof(uint32_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
291 #define side_type_u64_le(_attr...) _side_type_integer(SIDE_TYPE_U64, false, SIDE_TYPE_BYTE_ORDER_LE, sizeof(uint64_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
292 #define side_type_u128_le(_attr...) _side_type_integer(SIDE_TYPE_U128, false, SIDE_TYPE_BYTE_ORDER_LE, sizeof(unsigned __int128), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
293 #define side_type_s16_le(_attr...) _side_type_integer(SIDE_TYPE_S16, true, SIDE_TYPE_BYTE_ORDER_LE, sizeof(int16_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
294 #define side_type_s32_le(_attr...) _side_type_integer(SIDE_TYPE_S32, true, SIDE_TYPE_BYTE_ORDER_LE, sizeof(int32_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
295 #define side_type_s64_le(_attr...) _side_type_integer(SIDE_TYPE_S64, true, SIDE_TYPE_BYTE_ORDER_LE, sizeof(int64_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
296 #define side_type_s128_le(_attr...) _side_type_integer(SIDE_TYPE_S128, true, SIDE_TYPE_BYTE_ORDER_LE, sizeof(__int128), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
297 #define side_type_pointer_le(_attr...) _side_type_integer(SIDE_TYPE_POINTER, false, SIDE_TYPE_BYTE_ORDER_LE, sizeof(uintptr_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
298 #define side_type_float_binary16_le(_attr...) _side_type_float(SIDE_TYPE_FLOAT_BINARY16, SIDE_TYPE_BYTE_ORDER_LE, sizeof(_Float16), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
299 #define side_type_float_binary32_le(_attr...) _side_type_float(SIDE_TYPE_FLOAT_BINARY32, SIDE_TYPE_BYTE_ORDER_LE, sizeof(_Float32), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
300 #define side_type_float_binary64_le(_attr...) _side_type_float(SIDE_TYPE_FLOAT_BINARY64, SIDE_TYPE_BYTE_ORDER_LE, sizeof(_Float64), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
301 #define side_type_float_binary128_le(_attr...) _side_type_float(SIDE_TYPE_FLOAT_BINARY128, SIDE_TYPE_BYTE_ORDER_LE, sizeof(_Float128), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
302 #define side_type_string16_le(_attr...) _side_type_string(SIDE_TYPE_STRING_UTF16, SIDE_TYPE_BYTE_ORDER_LE, sizeof(uint16_t), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
303 #define side_type_string32_le(_attr...) _side_type_string(SIDE_TYPE_STRING_UTF32, SIDE_TYPE_BYTE_ORDER_LE, sizeof(uint32_t), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
305 #define side_field_u16_le(_name, _attr...) _side_field(_name, side_type_u16_le(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
306 #define side_field_u32_le(_name, _attr...) _side_field(_name, side_type_u32_le(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
307 #define side_field_u64_le(_name, _attr...) _side_field(_name, side_type_u64_le(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
308 #define side_field_u128_le(_name, _attr...) _side_field(_name, side_type_u128_le(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
309 #define side_field_s16_le(_name, _attr...) _side_field(_name, side_type_s16_le(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
310 #define side_field_s32_le(_name, _attr...) _side_field(_name, side_type_s32_le(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
311 #define side_field_s64_le(_name, _attr...) _side_field(_name, side_type_s64_le(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
312 #define side_field_s128_le(_name, _attr...) _side_field(_name, side_type_s128_le(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
313 #define side_field_pointer_le(_name, _attr...) _side_field(_name, side_type_pointer_le(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
314 #define side_field_float_binary16_le(_name, _attr...) _side_field(_name, side_type_float_binary16_le(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
315 #define side_field_float_binary32_le(_name, _attr...) _side_field(_name, side_type_float_binary32_le(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
316 #define side_field_float_binary64_le(_name, _attr...) _side_field(_name, side_type_float_binary64_le(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
317 #define side_field_float_binary128_le(_name, _attr...) _side_field(_name, side_type_float_binary128_le(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
318 #define side_field_string16_le(_name, _attr...) _side_field(_name, side_type_string16_le(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
319 #define side_field_string32_le(_name, _attr...) _side_field(_name, side_type_string32_le(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
322 #define side_type_u16_be(_attr...) _side_type_integer(SIDE_TYPE_U16, false, SIDE_TYPE_BYTE_ORDER_BE, sizeof(uint16_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
323 #define side_type_u32_be(_attr...) _side_type_integer(SIDE_TYPE_U32, false, SIDE_TYPE_BYTE_ORDER_BE, sizeof(uint32_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
324 #define side_type_u64_be(_attr...) _side_type_integer(SIDE_TYPE_U64, false, SIDE_TYPE_BYTE_ORDER_BE, sizeof(uint64_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
325 #define side_type_u128_be(_attr...) _side_type_integer(SIDE_TYPE_U128, false, SIDE_TYPE_BYTE_ORDER_BE, sizeof(unsigned __int128), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
326 #define side_type_s16_be(_attr...) _side_type_integer(SIDE_TYPE_S16, false, SIDE_TYPE_BYTE_ORDER_BE, sizeof(int16_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
327 #define side_type_s32_be(_attr...) _side_type_integer(SIDE_TYPE_S32, false, SIDE_TYPE_BYTE_ORDER_BE, sizeof(int32_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
328 #define side_type_s64_be(_attr...) _side_type_integer(SIDE_TYPE_S64, false, SIDE_TYPE_BYTE_ORDER_BE, sizeof(int64_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
329 #define side_type_s128_be(_attr...) _side_type_integer(SIDE_TYPE_S128, false, SIDE_TYPE_BYTE_ORDER_BE, sizeof(__int128), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
330 #define side_type_pointer_be(_attr...) _side_type_integer(SIDE_TYPE_POINTER, false, SIDE_TYPE_BYTE_ORDER_BE, sizeof(uintptr_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
331 #define side_type_float_binary16_be(_attr...) _side_type_float(SIDE_TYPE_FLOAT_BINARY16, SIDE_TYPE_BYTE_ORDER_BE, sizeof(_Float16), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
332 #define side_type_float_binary32_be(_attr...) _side_type_float(SIDE_TYPE_FLOAT_BINARY32, SIDE_TYPE_BYTE_ORDER_BE, sizeof(_Float32), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
333 #define side_type_float_binary64_be(_attr...) _side_type_float(SIDE_TYPE_FLOAT_BINARY64, SIDE_TYPE_BYTE_ORDER_BE, sizeof(_Float64), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
334 #define side_type_float_binary128_be(_attr...) _side_type_float(SIDE_TYPE_FLOAT_BINARY128, SIDE_TYPE_BYTE_ORDER_BE, sizeof(_Float128), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
335 #define side_type_string16_be(_attr...) _side_type_string(SIDE_TYPE_STRING_UTF16, SIDE_TYPE_BYTE_ORDER_BE, sizeof(uint16_t), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
336 #define side_type_string32_be(_attr...) _side_type_string(SIDE_TYPE_STRING_UTF32, SIDE_TYPE_BYTE_ORDER_BE, sizeof(uint32_t), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
338 #define side_field_u16_be(_name, _attr...) _side_field(_name, side_type_u16_be(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
339 #define side_field_u32_be(_name, _attr...) _side_field(_name, side_type_u32_be(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
340 #define side_field_u64_be(_name, _attr...) _side_field(_name, side_type_u64_be(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
341 #define side_field_u128_be(_name, _attr...) _side_field(_name, side_type_u128_be(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
342 #define side_field_s16_be(_name, _attr...) _side_field(_name, side_type_s16_be(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
343 #define side_field_s32_be(_name, _attr...) _side_field(_name, side_type_s32_be(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
344 #define side_field_s64_be(_name, _attr...) _side_field(_name, side_type_s64_be(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
345 #define side_field_s128_be(_name, _attr...) _side_field(_name, side_type_s128_be(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
346 #define side_field_pointer_be(_name, _attr...) _side_field(_name, side_type_pointer_be(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
347 #define side_field_float_binary16_be(_name, _attr...) _side_field(_name, side_type_float_binary16_be(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
348 #define side_field_float_binary32_be(_name, _attr...) _side_field(_name, side_type_float_binary32_be(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
349 #define side_field_float_binary64_be(_name, _attr...) _side_field(_name, side_type_float_binary64_be(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
350 #define side_field_float_binary128_be(_name, _attr...) _side_field(_name, side_type_float_binary128_be(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
351 #define side_field_string16_be(_name, _attr...) _side_field(_name, side_type_string16_be(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
352 #define side_field_string32_be(_name, _attr...) _side_field(_name, side_type_string32_be(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
354 #define side_type_enum(_mappings, _elem_type) \
356 .type = SIDE_ENUM_INIT(SIDE_TYPE_ENUM), \
359 .mappings = SIDE_PTR_INIT(_mappings), \
360 .elem_type = SIDE_PTR_INIT(_elem_type), \
364 #define side_field_enum(_name, _mappings, _elem_type) \
365 _side_field(_name, side_type_enum(SIDE_PARAM(_mappings), SIDE_PARAM(_elem_type)))
367 #define side_type_enum_bitmap(_mappings, _elem_type) \
369 .type = SIDE_ENUM_INIT(SIDE_TYPE_ENUM_BITMAP), \
371 .side_enum_bitmap = { \
372 .mappings = SIDE_PTR_INIT(_mappings), \
373 .elem_type = SIDE_PTR_INIT(_elem_type), \
377 #define side_field_enum_bitmap(_name, _mappings, _elem_type) \
378 _side_field(_name, side_type_enum_bitmap(SIDE_PARAM(_mappings), SIDE_PARAM(_elem_type)))
380 #define side_type_struct(_struct) \
382 .type = SIDE_ENUM_INIT(SIDE_TYPE_STRUCT), \
384 .side_struct = SIDE_PTR_INIT(_struct), \
387 #define side_field_struct(_name, _struct) \
388 _side_field(_name, side_type_struct(SIDE_PARAM(_struct)))
390 #define _side_type_struct_define(_fields, _attr) \
392 .fields = SIDE_PTR_INIT(_fields), \
393 .attr = SIDE_PTR_INIT(_attr), \
394 .nr_fields = SIDE_ARRAY_SIZE(SIDE_PARAM(_fields)), \
395 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
398 #define side_define_struct(_identifier, _fields, _attr...) \
399 const struct side_type_struct _identifier = _side_type_struct_define(SIDE_PARAM(_fields), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
401 #define side_struct_literal(_fields, _attr...) \
402 SIDE_COMPOUND_LITERAL(const struct side_type_struct, \
403 _side_type_struct_define(SIDE_PARAM(_fields), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
405 #define side_type_variant(_variant) \
407 .type = SIDE_ENUM_INIT(SIDE_TYPE_VARIANT), \
409 .side_variant = SIDE_PTR_INIT(_variant), \
412 #define side_field_variant(_name, _variant) \
413 _side_field(_name, side_type_variant(SIDE_PARAM(_variant)))
415 #define _side_type_variant_define(_selector, _options, _attr) \
417 .selector = _selector, \
418 .options = SIDE_PTR_INIT(_options), \
419 .attr = SIDE_PTR_INIT(_attr), \
420 .nr_options = SIDE_ARRAY_SIZE(SIDE_PARAM(_options)), \
421 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
424 #define side_define_variant(_identifier, _selector, _options, _attr...) \
425 const struct side_type_variant _identifier = \
426 _side_type_variant_define(SIDE_PARAM(_selector), SIDE_PARAM(_options), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
428 #define side_variant_literal(_selector, _options, _attr...) \
429 SIDE_COMPOUND_LITERAL(const struct side_type_variant, \
430 _side_type_variant_define(SIDE_PARAM(_selector), SIDE_PARAM(_options), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
432 #define side_type_array(_elem_type, _length, _attr...) \
434 .type = SIDE_ENUM_INIT(SIDE_TYPE_ARRAY), \
437 .elem_type = SIDE_PTR_INIT(_elem_type), \
438 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
440 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
444 #define side_field_array(_name, _elem_type, _length, _attr...) \
445 _side_field(_name, side_type_array(SIDE_PARAM(_elem_type), _length, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
447 #define side_type_vla(_elem_type, _length_type, _attr...) \
449 .type = SIDE_ENUM_INIT(SIDE_TYPE_VLA), \
452 .elem_type = SIDE_PTR_INIT(_elem_type), \
453 .length_type = SIDE_PTR_INIT(_length_type), \
454 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
455 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
459 #define side_field_vla(_name, _elem_type, _length_type, _attr...) \
460 _side_field(_name, side_type_vla(SIDE_PARAM(_elem_type), SIDE_PARAM(_length_type), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
462 #define _side_type_vla_visitor_define(_elem_type, _length_type, _visitor, _attr...) \
464 .elem_type = SIDE_PTR_INIT(_elem_type), \
465 .length_type = SIDE_PTR_INIT(_length_type), \
466 .visitor = SIDE_PTR_INIT(_visitor), \
467 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
468 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
471 #define side_define_vla_visitor(_identifier, _elem_type, _length_type, _visitor, _attr...) \
472 const struct side_type_struct _identifier = _side_type_struct_define(SIDE_PARAM(_elem_type), SIDE_PARAM(_length_type), SIDE_PARAM(_visitor), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
474 #define side_vla_visitor_literal(_elem_type, _length_type, _visitor, _attr...) \
475 SIDE_COMPOUND_LITERAL(const struct side_type_vla_visitor, \
476 _side_type_vla_visitor_define(SIDE_PARAM(_elem_type), SIDE_PARAM(_length_type), SIDE_PARAM(_visitor), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
478 #define side_type_vla_visitor(_vla_visitor) \
480 .type = SIDE_ENUM_INIT(SIDE_TYPE_VLA_VISITOR), \
482 .side_vla_visitor = SIDE_PTR_INIT(_vla_visitor), \
485 #define side_field_vla_visitor(_name, _vla_visitor) \
486 _side_field(_name, side_type_vla_visitor(SIDE_PARAM(_vla_visitor)))
488 /* Gather field and type definitions */
490 #define side_type_gather_byte(_offset, _access_mode, _attr...) \
492 .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_BYTE), \
498 .access_mode = SIDE_ENUM_INIT(_access_mode), \
500 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
501 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
508 #define side_field_gather_byte(_name, _offset, _access_mode, _attr...) \
509 _side_field(_name, side_type_gather_byte(_offset, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
511 #define _side_type_gather_bool(_byte_order, _offset, _bool_size, _offset_bits, _len_bits, _access_mode, _attr...) \
513 .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_BOOL), \
519 .access_mode = SIDE_ENUM_INIT(_access_mode), \
521 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
522 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
523 .bool_size = _bool_size, \
524 .len_bits = _len_bits, \
525 .byte_order = SIDE_ENUM_INIT(_byte_order), \
527 .offset_bits = _offset_bits, \
533 #define side_type_gather_bool(_offset, _bool_size, _offset_bits, _len_bits, _access_mode, _attr...) \
534 _side_type_gather_bool(SIDE_TYPE_BYTE_ORDER_HOST, _offset, _bool_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
535 #define side_type_gather_bool_le(_offset, _bool_size, _offset_bits, _len_bits, _access_mode, _attr...) \
536 _side_type_gather_bool(SIDE_TYPE_BYTE_ORDER_LE, _offset, _bool_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
537 #define side_type_gather_bool_be(_offset, _bool_size, _offset_bits, _len_bits, _access_mode, _attr...) \
538 _side_type_gather_bool(SIDE_TYPE_BYTE_ORDER_BE, _offset, _bool_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
540 #define side_field_gather_bool(_name, _offset, _bool_size, _offset_bits, _len_bits, _access_mode, _attr...) \
541 _side_field(_name, side_type_gather_bool(_offset, _bool_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))))
542 #define side_field_gather_bool_le(_name, _offset, _bool_size, _offset_bits, _len_bits, _access_mode, _attr...) \
543 _side_field(_name, side_type_gather_bool_le(_offset, _bool_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))))
544 #define side_field_gather_bool_be(_name, _offset, _bool_size, _offset_bits, _len_bits, _access_mode, _attr...) \
545 _side_field(_name, side_type_gather_bool_be(_offset, _bool_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))))
547 #define _side_type_gather_integer(_type, _signedness, _byte_order, _offset, \
548 _integer_size, _offset_bits, _len_bits, _access_mode, _attr...) \
550 .type = SIDE_ENUM_INIT(_type), \
556 .access_mode = SIDE_ENUM_INIT(_access_mode), \
558 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
559 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
560 .integer_size = _integer_size, \
561 .len_bits = _len_bits, \
562 .signedness = _signedness, \
563 .byte_order = SIDE_ENUM_INIT(_byte_order), \
565 .offset_bits = _offset_bits, \
572 #define side_type_gather_unsigned_integer(_integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, _attr...) \
573 _side_type_gather_integer(SIDE_TYPE_GATHER_INTEGER, false, SIDE_TYPE_BYTE_ORDER_HOST, \
574 _integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
575 #define side_type_gather_signed_integer(_integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, _attr...) \
576 _side_type_gather_integer(SIDE_TYPE_GATHER_INTEGER, true, SIDE_TYPE_BYTE_ORDER_HOST, \
577 _integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
579 #define side_type_gather_unsigned_integer_le(_integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, _attr...) \
580 _side_type_gather_integer(SIDE_TYPE_GATHER_INTEGER, false, SIDE_TYPE_BYTE_ORDER_LE, \
581 _integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
582 #define side_type_gather_signed_integer_le(_integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, _attr...) \
583 _side_type_gather_integer(SIDE_TYPE_GATHER_INTEGER, true, SIDE_TYPE_BYTE_ORDER_LE, \
584 _integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
586 #define side_type_gather_unsigned_integer_be(_integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, _attr...) \
587 _side_type_gather_integer(SIDE_TYPE_GATHER_INTEGER, false, SIDE_TYPE_BYTE_ORDER_BE, \
588 _integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
589 #define side_type_gather_signed_integer_be(_integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, _attr...) \
590 _side_type_gather_integer(SIDE_TYPE_GATHER_INTEGER, true, SIDE_TYPE_BYTE_ORDER_BE, \
591 _integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
593 #define side_field_gather_unsigned_integer(_name, _integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, _attr...) \
594 _side_field(_name, side_type_gather_unsigned_integer(_integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
595 #define side_field_gather_signed_integer(_name, _integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, _attr...) \
596 _side_field(_name, side_type_gather_signed_integer(_integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
598 #define side_field_gather_unsigned_integer_le(_name, _integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, _attr...) \
599 _side_field(_name, side_type_gather_unsigned_integer_le(_integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
600 #define side_field_gather_signed_integer_le(_name, _integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, _attr...) \
601 _side_field(_name, side_type_gather_signed_integer_le(_integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
603 #define side_field_gather_unsigned_integer_be(_name, _integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, _attr...) \
604 _side_field(_name, side_type_gather_unsigned_integer_be(_integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
605 #define side_field_gather_signed_integer_be(_name, _integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, _attr...) \
606 _side_field(_name, side_type_gather_signed_integer_be(_integer_offset, _integer_size, _offset_bits, _len_bits, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
608 #define side_type_gather_pointer(_offset, _access_mode, _attr...) \
609 _side_type_gather_integer(SIDE_TYPE_GATHER_POINTER, false, SIDE_TYPE_BYTE_ORDER_HOST, \
610 _offset, sizeof(uintptr_t), 0, 0, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
611 #define side_field_gather_pointer(_name, _offset, _access_mode, _attr...) \
612 _side_field(_name, side_type_gather_pointer(_offset, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
614 #define side_type_gather_pointer_le(_offset, _access_mode, _attr...) \
615 _side_type_gather_integer(SIDE_TYPE_GATHER_POINTER, false, SIDE_TYPE_BYTE_ORDER_LE, \
616 _offset, sizeof(uintptr_t), 0, 0, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
617 #define side_field_gather_pointer_le(_name, _offset, _access_mode, _attr...) \
618 _side_field(_name, side_type_gather_pointer_le(_offset, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
620 #define side_type_gather_pointer_be(_offset, _access_mode, _attr...) \
621 _side_type_gather_integer(SIDE_TYPE_GATHER_POINTER, false, SIDE_TYPE_BYTE_ORDER_BE, \
622 _offset, sizeof(uintptr_t), 0, 0, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
623 #define side_field_gather_pointer_be(_name, _offset, _access_mode, _attr...) \
624 _side_field(_name, side_type_gather_pointer_be(_offset, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
626 #define _side_type_gather_float(_byte_order, _offset, _float_size, _access_mode, _attr...) \
628 .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_FLOAT), \
634 .access_mode = SIDE_ENUM_INIT(_access_mode), \
636 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
637 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
638 .float_size = _float_size, \
639 .byte_order = SIDE_ENUM_INIT(_byte_order), \
647 #define side_type_gather_float(_offset, _float_size, _access_mode, _attr...) \
648 _side_type_gather_float(SIDE_TYPE_FLOAT_WORD_ORDER_HOST, _offset, _float_size, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
649 #define side_type_gather_float_le(_offset, _float_size, _access_mode, _attr...) \
650 _side_type_gather_float(SIDE_TYPE_BYTE_ORDER_LE, _offset, _float_size, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
651 #define side_type_gather_float_be(_offset, _float_size, _access_mode, _attr...) \
652 _side_type_gather_float(SIDE_TYPE_BYTE_ORDER_BE, _offset, _float_size, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
654 #define side_field_gather_float(_name, _offset, _float_size, _access_mode, _attr...) \
655 _side_field(_name, side_type_gather_float(_offset, _float_size, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
656 #define side_field_gather_float_le(_name, _offset, _float_size, _access_mode, _attr...) \
657 _side_field(_name, side_type_gather_float_le(_offset, _float_size, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
658 #define side_field_gather_float_be(_name, _offset, _float_size, _access_mode, _attr...) \
659 _side_field(_name, side_type_gather_float_be(_offset, _float_size, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
661 #define _side_type_gather_string(_offset, _byte_order, _unit_size, _access_mode, _attr...) \
663 .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_STRING), \
669 .access_mode = SIDE_ENUM_INIT(_access_mode), \
671 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
672 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
673 .unit_size = _unit_size, \
674 .byte_order = SIDE_ENUM_INIT(_byte_order), \
681 #define side_type_gather_string(_offset, _access_mode, _attr...) \
682 _side_type_gather_string(_offset, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint8_t), _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
683 #define side_field_gather_string(_name, _offset, _access_mode, _attr...) \
684 _side_field(_name, side_type_gather_string(_offset, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
686 #define side_type_gather_string16(_offset, _access_mode, _attr...) \
687 _side_type_gather_string(_offset, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint16_t), _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
688 #define side_type_gather_string16_le(_offset, _access_mode, _attr...) \
689 _side_type_gather_string(_offset, SIDE_TYPE_BYTE_ORDER_LE, sizeof(uint16_t), _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
690 #define side_type_gather_string16_be(_offset, _access_mode, _attr...) \
691 _side_type_gather_string(_offset, SIDE_TYPE_BYTE_ORDER_BE, sizeof(uint16_t), _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
693 #define side_field_gather_string16(_name, _offset, _access_mode, _attr...) \
694 _side_field(_name, side_type_gather_string16(_offset, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
695 #define side_field_gather_string16_le(_name, _offset, _access_mode, _attr...) \
696 _side_field(_name, side_type_gather_string16_le(_offset, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
697 #define side_field_gather_string16_be(_name, _offset, _access_mode, _attr...) \
698 _side_field(_name, side_type_gather_string16_be(_offset, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
700 #define side_type_gather_string32(_offset, _access_mode, _attr...) \
701 _side_type_gather_string(_offset, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint32_t), _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
702 #define side_type_gather_string32_le(_offset, _access_mode, _attr...) \
703 _side_type_gather_string(_offset, SIDE_TYPE_BYTE_ORDER_LE, sizeof(uint32_t), _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
704 #define side_type_gather_string32_be(_offset, _access_mode, _attr...) \
705 _side_type_gather_string(_offset, SIDE_TYPE_BYTE_ORDER_BE, sizeof(uint32_t), _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
707 #define side_field_gather_string32(_name, _offset, _access_mode, _attr...) \
708 _side_field(_name, side_type_gather_string32(_offset, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
709 #define side_field_gather_string32_le(_name, _offset, _access_mode, _attr...) \
710 _side_field(_name, side_type_gather_string32_le(_offset, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
711 #define side_field_gather_string32_be(_name, _offset, _access_mode, _attr...) \
712 _side_field(_name, side_type_gather_string32_be(_offset, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
714 #define side_type_gather_enum(_mappings, _elem_type) \
716 .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_ENUM), \
719 .mappings = SIDE_PTR_INIT(_mappings), \
720 .elem_type = SIDE_PTR_INIT(_elem_type), \
724 #define side_field_gather_enum(_name, _mappings, _elem_type) \
725 _side_field(_name, side_type_gather_enum(SIDE_PARAM(_mappings), SIDE_PARAM(_elem_type)))
727 #define side_type_gather_struct(_struct_gather, _offset, _size, _access_mode) \
729 .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_STRUCT), \
735 .access_mode = SIDE_ENUM_INIT(_access_mode), \
736 .type = SIDE_PTR_INIT(_struct_gather), \
743 #define side_field_gather_struct(_name, _struct_gather, _offset, _size, _access_mode) \
744 _side_field(_name, side_type_gather_struct(SIDE_PARAM(_struct_gather), _offset, _size, _access_mode))
746 #define side_type_gather_array(_elem_type_gather, _length, _offset, _access_mode, _attr...) \
748 .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_ARRAY), \
754 .access_mode = SIDE_ENUM_INIT(_access_mode), \
756 .elem_type = SIDE_PTR_INIT(_elem_type_gather), \
757 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
759 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
766 #define side_field_gather_array(_name, _elem_type, _length, _offset, _access_mode, _attr...) \
767 _side_field(_name, side_type_gather_array(SIDE_PARAM(_elem_type), _length, _offset, _access_mode, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
769 #define side_type_gather_vla(_elem_type_gather, _offset, _access_mode, _length_type_gather, _attr...) \
771 .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_VLA), \
777 .access_mode = SIDE_ENUM_INIT(_access_mode), \
779 .elem_type = SIDE_PTR_INIT(_elem_type_gather), \
780 .length_type = SIDE_PTR_INIT(_length_type_gather), \
781 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
782 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
789 #define side_field_gather_vla(_name, _elem_type_gather, _offset, _access_mode, _length_type_gather, _attr...) \
790 _side_field(_name, side_type_gather_vla(SIDE_PARAM(_elem_type_gather), _offset, _access_mode, SIDE_PARAM(_length_type_gather), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())))
792 #define side_elem(...) \
793 SIDE_COMPOUND_LITERAL(const struct side_type, __VA_ARGS__)
795 #define side_length(...) \
796 SIDE_COMPOUND_LITERAL(const struct side_type, __VA_ARGS__)
798 #define side_field_list(...) \
799 SIDE_COMPOUND_LITERAL(const struct side_event_field, __VA_ARGS__)
801 #define side_option_list(...) \
802 SIDE_COMPOUND_LITERAL(const struct side_variant_option, __VA_ARGS__)
804 /* Stack-copy field arguments */
806 #define side_arg_null(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_NULL), .flags = 0, }
807 #define side_arg_bool(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_BOOL), .flags = 0, .u = { .side_static = { .bool_value = { .side_bool8 = !!(_val) } } } }
808 #define side_arg_byte(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_BYTE), .flags = 0, .u = { .side_static = { .byte_value = (_val) } } }
809 #define side_arg_string(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_STRING_UTF8), .flags = 0, .u = { .side_static = { .string_value = SIDE_PTR_INIT(_val) } } }
810 #define side_arg_string16(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_STRING_UTF16), .flags = 0, .u = { .side_static = { .string_value = SIDE_PTR_INIT(_val) } } }
811 #define side_arg_string32(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_STRING_UTF32), .flags = 0, .u = { .side_static = { .string_value = SIDE_PTR_INIT(_val) } } }
813 #define side_arg_u8(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_U8), .flags = 0, .u = { .side_static = { .integer_value = { .side_u8 = (_val) } } } }
814 #define side_arg_u16(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_U16), .flags = 0, .u = { .side_static = { .integer_value = { .side_u16 = (_val) } } } }
815 #define side_arg_u32(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_U32), .flags = 0, .u = { .side_static = { .integer_value = { .side_u32 = (_val) } } } }
816 #define side_arg_u64(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_U64), .flags = 0, .u = { .side_static = { .integer_value = { .side_u64 = (_val) } } } }
817 #define side_arg_u128(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_U128), .flags = 0, .u = { .side_static = { .integer_value = { .side_u128 = (_val) } } } }
818 #define side_arg_s8(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_S8), .flags = 0, .u = { .side_static = { .integer_value = { .side_s8 = (_val) } } } }
819 #define side_arg_s16(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_S16), .flags = 0, .u = { .side_static = { .integer_value = { .side_s16 = (_val) } } } }
820 #define side_arg_s32(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_S32), .flags = 0, .u = { .side_static = { .integer_value = { .side_s32 = (_val) } } } }
821 #define side_arg_s64(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_S64), .flags = 0, .u = { .side_static = { .integer_value = { .side_s64 = (_val) } } } }
822 #define side_arg_s128(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_S128), .flags = 0, .u = { .side_static = { .integer_value = { .side_s128 = (_val) } } } }
823 #define side_arg_pointer(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_POINTER), .flags = 0, .u = { .side_static = { .integer_value = { .side_uptr = (uintptr_t) (_val) } } } }
824 #define side_arg_float_binary16(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_FLOAT_BINARY16), .flags = 0, .u = { .side_static = { .float_value = { .side_float_binary16 = (_val) } } } }
825 #define side_arg_float_binary32(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_FLOAT_BINARY32), .flags = 0, .u = { .side_static = { .float_value = { .side_float_binary32 = (_val) } } } }
826 #define side_arg_float_binary64(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_FLOAT_BINARY64), .flags = 0, .u = { .side_static = { .float_value = { .side_float_binary64 = (_val) } } } }
827 #define side_arg_float_binary128(_val) { .type = SIDE_ENUM_INIT(SIDE_TYPE_FLOAT_BINARY128), .flags = 0, .u = { .side_static = { .float_value = { .side_float_binary128 = (_val) } } } }
829 #define side_arg_struct(_side_type) { .type = SIDE_ENUM_INIT(SIDE_TYPE_STRUCT), .flags = 0, .u = { .side_static = { .side_struct = SIDE_PTR_INIT(_side_type) } } }
831 #define side_arg_define_variant(_identifier, _selector_val, _option) \
832 const struct side_arg_variant _identifier = { \
833 .selector = _selector_val, \
836 #define side_arg_variant(_side_variant) \
838 .type = SIDE_ENUM_INIT(SIDE_TYPE_VARIANT), \
842 .side_variant = SIDE_PTR_INIT(_side_variant), \
847 #define side_arg_array(_side_type) { .type = SIDE_ENUM_INIT(SIDE_TYPE_ARRAY), .flags = 0, .u = { .side_static = { .side_array = SIDE_PTR_INIT(_side_type) } } }
848 #define side_arg_vla(_side_type) { .type = SIDE_ENUM_INIT(SIDE_TYPE_VLA), .flags = 0, .u = { .side_static = { .side_vla = SIDE_PTR_INIT(_side_type) } } }
849 #define side_arg_vla_visitor(_side_vla_visitor) \
851 .type = SIDE_ENUM_INIT(SIDE_TYPE_VLA_VISITOR), \
855 .side_vla_visitor = SIDE_PTR_INIT(_side_vla_visitor), \
860 #define side_arg_define_vla_visitor(_identifier, _ctx) \
861 struct side_arg_vla_visitor _identifier = { \
862 .app_ctx = SIDE_PTR_INIT(_ctx), \
863 .cached_arg = SIDE_PTR_INIT(NULL), \
866 /* Gather field arguments */
868 #define side_arg_gather_bool(_ptr) { .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_BOOL), .flags = 0, .u = { .side_static = { .side_bool_gather_ptr = SIDE_PTR_INIT(_ptr) } } }
869 #define side_arg_gather_byte(_ptr) { .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_BYTE), .flags = 0, .u = { .side_static = { .side_byte_gather_ptr = SIDE_PTR_INIT(_ptr) } } }
870 #define side_arg_gather_pointer(_ptr) { .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_POINTER), .flags = 0, .u = { .side_static = { .side_integer_gather_ptr = SIDE_PTR_INIT(_ptr) } } }
871 #define side_arg_gather_integer(_ptr) { .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_INTEGER), .flags = 0, .u = { .side_static = { .side_integer_gather_ptr = SIDE_PTR_INIT(_ptr) } } }
872 #define side_arg_gather_float(_ptr) { .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_FLOAT), .flags = 0, .u = { .side_static = { .side_float_gather_ptr = SIDE_PTR_INIT(_ptr) } } }
873 #define side_arg_gather_string(_ptr) { .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_STRING), .flags = 0, .u = { .side_static = { .side_string_gather_ptr = SIDE_PTR_INIT(_ptr) } } }
874 #define side_arg_gather_struct(_ptr) { .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_STRUCT), .flags = 0, .u = { .side_static = { .side_struct_gather_ptr = SIDE_PTR_INIT(_ptr) } } }
875 #define side_arg_gather_array(_ptr) { .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_ARRAY), .flags = 0, .u = { .side_static = { .side_array_gather_ptr = SIDE_PTR_INIT(_ptr) } } }
876 #define side_arg_gather_vla(_ptr, _length_ptr) { .type = SIDE_ENUM_INIT(SIDE_TYPE_GATHER_VLA), .flags = 0, .u = { .side_static = { .side_vla_gather = { .ptr = SIDE_PTR_INIT(_ptr), .length_ptr = SIDE_PTR_INIT(_length_ptr) } } } }
878 /* Dynamic field arguments */
880 #define side_arg_dynamic_null(_attr...) \
882 .type = SIDE_ENUM_INIT(SIDE_TYPE_DYNAMIC_NULL), \
887 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
888 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
894 #define side_arg_dynamic_bool(_val, _attr...) \
896 .type = SIDE_ENUM_INIT(SIDE_TYPE_DYNAMIC_BOOL), \
902 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
903 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
904 .bool_size = sizeof(uint8_t), \
906 .byte_order = SIDE_ENUM_INIT(SIDE_TYPE_BYTE_ORDER_HOST), \
909 .side_bool8 = !!(_val), \
916 #define side_arg_dynamic_byte(_val, _attr...) \
918 .type = SIDE_ENUM_INIT(SIDE_TYPE_DYNAMIC_BYTE), \
924 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
925 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
933 #define _side_arg_dynamic_string(_val, _byte_order, _unit_size, _attr...) \
935 .type = SIDE_ENUM_INIT(SIDE_TYPE_DYNAMIC_STRING), \
941 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
942 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
943 .unit_size = _unit_size, \
944 .byte_order = SIDE_ENUM_INIT(_byte_order), \
946 .value = (uintptr_t) (_val), \
951 #define side_arg_dynamic_string(_val, _attr...) \
952 _side_arg_dynamic_string(_val, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint8_t), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
953 #define side_arg_dynamic_string16(_val, _attr...) \
954 _side_arg_dynamic_string(_val, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint16_t), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
955 #define side_arg_dynamic_string16_le(_val, _attr...) \
956 _side_arg_dynamic_string(_val, SIDE_TYPE_BYTE_ORDER_LE, sizeof(uint16_t), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
957 #define side_arg_dynamic_string16_be(_val, _attr...) \
958 _side_arg_dynamic_string(_val, SIDE_TYPE_BYTE_ORDER_BE, sizeof(uint16_t), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
959 #define side_arg_dynamic_string32(_val, _attr...) \
960 _side_arg_dynamic_string(_val, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint32_t), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
961 #define side_arg_dynamic_string32_le(_val, _attr...) \
962 _side_arg_dynamic_string(_val, SIDE_TYPE_BYTE_ORDER_LE, sizeof(uint32_t), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
963 #define side_arg_dynamic_string32_be(_val, _attr...) \
964 _side_arg_dynamic_string(_val, SIDE_TYPE_BYTE_ORDER_BE, sizeof(uint32_t), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
966 #define _side_arg_dynamic_integer(_field, _val, _type, _signedness, _byte_order, _integer_size, _len_bits, _attr...) \
968 .type = SIDE_ENUM_INIT(_type), \
974 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
975 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
976 .integer_size = _integer_size, \
977 .len_bits = _len_bits, \
978 .signedness = _signedness, \
979 .byte_order = SIDE_ENUM_INIT(_byte_order), \
989 #define side_arg_dynamic_u8(_val, _attr...) \
990 _side_arg_dynamic_integer(.side_u8, _val, SIDE_TYPE_DYNAMIC_INTEGER, false, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(uint8_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
991 #define side_arg_dynamic_s8(_val, _attr...) \
992 _side_arg_dynamic_integer(.side_s8, _val, SIDE_TYPE_DYNAMIC_INTEGER, true, SIDE_TYPE_BYTE_ORDER_HOST, sizeof(int8_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
994 #define _side_arg_dynamic_u16(_val, _byte_order, _attr...) \
995 _side_arg_dynamic_integer(.side_u16, _val, SIDE_TYPE_DYNAMIC_INTEGER, false, _byte_order, sizeof(uint16_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
996 #define _side_arg_dynamic_u32(_val, _byte_order, _attr...) \
997 _side_arg_dynamic_integer(.side_u32, _val, SIDE_TYPE_DYNAMIC_INTEGER, false, _byte_order, sizeof(uint32_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
998 #define _side_arg_dynamic_u64(_val, _byte_order, _attr...) \
999 _side_arg_dynamic_integer(.side_u64, _val, SIDE_TYPE_DYNAMIC_INTEGER, false, _byte_order, sizeof(uint64_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1000 #define _side_arg_dynamic_u128(_val, _byte_order, _attr...) \
1001 _side_arg_dynamic_integer(.side_u128, _val, SIDE_TYPE_DYNAMIC_INTEGER, false, _byte_order, sizeof(unsigned __int128), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1003 #define _side_arg_dynamic_s16(_val, _byte_order, _attr...) \
1004 _side_arg_dynamic_integer(.side_s16, _val, SIDE_TYPE_DYNAMIC_INTEGER, true, _byte_order, sizeof(int16_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1005 #define _side_arg_dynamic_s32(_val, _byte_order, _attr...) \
1006 _side_arg_dynamic_integer(.side_s32, _val, SIDE_TYPE_DYNAMIC_INTEGER, true, _byte_order, sizeof(int32_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1007 #define _side_arg_dynamic_s64(_val, _byte_order, _attr...) \
1008 _side_arg_dynamic_integer(.side_s64, _val, SIDE_TYPE_DYNAMIC_INTEGER, true, _byte_order, sizeof(int64_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1009 #define _side_arg_dynamic_s128(_val, _byte_order, _attr...) \
1010 _side_arg_dynamic_integer(.side_s128, _val, SIDE_TYPE_DYNAMIC_INTEGER, true, _byte_order, sizeof(__int128), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1012 #define _side_arg_dynamic_pointer(_val, _byte_order, _attr...) \
1013 _side_arg_dynamic_integer(.side_uptr, (uintptr_t) (_val), SIDE_TYPE_DYNAMIC_POINTER, false, _byte_order, \
1014 sizeof(uintptr_t), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1016 #define _side_arg_dynamic_float(_field, _val, _type, _byte_order, _float_size, _attr...) \
1018 .type = SIDE_ENUM_INIT(_type), \
1024 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
1025 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
1026 .float_size = _float_size, \
1027 .byte_order = SIDE_ENUM_INIT(_byte_order), \
1037 #define _side_arg_dynamic_float_binary16(_val, _byte_order, _attr...) \
1038 _side_arg_dynamic_float(.side_float_binary16, _val, SIDE_TYPE_DYNAMIC_FLOAT, _byte_order, sizeof(_Float16), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1039 #define _side_arg_dynamic_float_binary32(_val, _byte_order, _attr...) \
1040 _side_arg_dynamic_float(.side_float_binary32, _val, SIDE_TYPE_DYNAMIC_FLOAT, _byte_order, sizeof(_Float32), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1041 #define _side_arg_dynamic_float_binary64(_val, _byte_order, _attr...) \
1042 _side_arg_dynamic_float(.side_float_binary64, _val, SIDE_TYPE_DYNAMIC_FLOAT, _byte_order, sizeof(_Float64), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1043 #define _side_arg_dynamic_float_binary128(_val, _byte_order, _attr...) \
1044 _side_arg_dynamic_float(.side_float_binary128, _val, SIDE_TYPE_DYNAMIC_FLOAT, _byte_order, sizeof(_Float128), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1047 #define side_arg_dynamic_u16(_val, _attr...) _side_arg_dynamic_u16(_val, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1048 #define side_arg_dynamic_u32(_val, _attr...) _side_arg_dynamic_u32(_val, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1049 #define side_arg_dynamic_u64(_val, _attr...) _side_arg_dynamic_u64(_val, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1050 #define side_arg_dynamic_u128(_val, _attr...) _side_arg_dynamic_u128(_val, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1051 #define side_arg_dynamic_s16(_val, _attr...) _side_arg_dynamic_s16(_val, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1052 #define side_arg_dynamic_s32(_val, _attr...) _side_arg_dynamic_s32(_val, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1053 #define side_arg_dynamic_s64(_val, _attr...) _side_arg_dynamic_s64(_val, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1054 #define side_arg_dynamic_s128(_val, _attr...) _side_arg_dynamic_s128(_val, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1055 #define side_arg_dynamic_pointer(_val, _attr...) _side_arg_dynamic_pointer(_val, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1056 #define side_arg_dynamic_float_binary16(_val, _attr...) _side_arg_dynamic_float_binary16(_val, SIDE_TYPE_FLOAT_WORD_ORDER_HOST, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1057 #define side_arg_dynamic_float_binary32(_val, _attr...) _side_arg_dynamic_float_binary32(_val, SIDE_TYPE_FLOAT_WORD_ORDER_HOST, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1058 #define side_arg_dynamic_float_binary64(_val, _attr...) _side_arg_dynamic_float_binary64(_val, SIDE_TYPE_FLOAT_WORD_ORDER_HOST, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1059 #define side_arg_dynamic_float_binary128(_val, _attr...) _side_arg_dynamic_float_binary128(_val, SIDE_TYPE_FLOAT_WORD_ORDER_HOST, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1062 #define side_arg_dynamic_u16_le(_val, _attr...) _side_arg_dynamic_u16(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1063 #define side_arg_dynamic_u32_le(_val, _attr...) _side_arg_dynamic_u32(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1064 #define side_arg_dynamic_u64_le(_val, _attr...) _side_arg_dynamic_u64(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1065 #define side_arg_dynamic_u128_le(_val, _attr...) _side_arg_dynamic_u128(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1066 #define side_arg_dynamic_s16_le(_val, _attr...) _side_arg_dynamic_s16(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1067 #define side_arg_dynamic_s32_le(_val, _attr...) _side_arg_dynamic_s32(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1068 #define side_arg_dynamic_s64_le(_val, _attr...) _side_arg_dynamic_s64(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1069 #define side_arg_dynamic_s128_le(_val, _attr...) _side_arg_dynamic_s128(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1070 #define side_arg_dynamic_pointer_le(_val, _attr...) _side_arg_dynamic_pointer(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1071 #define side_arg_dynamic_float_binary16_le(_val, _attr...) _side_arg_dynamic_float_binary16(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1072 #define side_arg_dynamic_float_binary32_le(_val, _attr...) _side_arg_dynamic_float_binary32(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1073 #define side_arg_dynamic_float_binary64_le(_val, _attr...) _side_arg_dynamic_float_binary64(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1074 #define side_arg_dynamic_float_binary128_le(_val, _attr...) _side_arg_dynamic_float_binary128(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1077 #define side_arg_dynamic_u16_be(_val, _attr...) _side_arg_dynamic_u16(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1078 #define side_arg_dynamic_u32_be(_val, _attr...) _side_arg_dynamic_u32(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1079 #define side_arg_dynamic_u64_be(_val, _attr...) _side_arg_dynamic_u64(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1080 #define side_arg_dynamic_u128_be(_val, _attr...) _side_arg_dynamic_u128(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1081 #define side_arg_dynamic_s16_be(_val, _attr...) _side_arg_dynamic_s16(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1082 #define side_arg_dynamic_s32_be(_val, _attr...) _side_arg_dynamic_s32(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1083 #define side_arg_dynamic_s64_be(_val, _attr...) _side_arg_dynamic_s64(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1084 #define side_arg_dynamic_s128_be(_val, _attr...) _side_arg_dynamic_s128(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1085 #define side_arg_dynamic_pointer_be(_val, _attr...) _side_arg_dynamic_pointer(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1086 #define side_arg_dynamic_float_binary16_be(_val, _attr...) _side_arg_dynamic_float_binary16(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1087 #define side_arg_dynamic_float_binary32_be(_val, _attr...) _side_arg_dynamic_float_binary32(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1088 #define side_arg_dynamic_float_binary64_be(_val, _attr...) _side_arg_dynamic_float_binary64(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1089 #define side_arg_dynamic_float_binary128_be(_val, _attr...) _side_arg_dynamic_float_binary128(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1091 #define side_arg_dynamic_vla(_vla) \
1093 .type = SIDE_ENUM_INIT(SIDE_TYPE_DYNAMIC_VLA), \
1097 .side_dynamic_vla = SIDE_PTR_INIT(_vla), \
1102 #define side_arg_dynamic_vla_visitor(_dynamic_vla_visitor) \
1104 .type = SIDE_ENUM_INIT(SIDE_TYPE_DYNAMIC_VLA_VISITOR), \
1108 .side_dynamic_vla_visitor = SIDE_PTR_INIT(_dynamic_vla_visitor), \
1113 #define side_arg_dynamic_struct(_struct) \
1115 .type = SIDE_ENUM_INIT(SIDE_TYPE_DYNAMIC_STRUCT), \
1119 .side_dynamic_struct = SIDE_PTR_INIT(_struct), \
1124 #define side_arg_dynamic_struct_visitor(_dynamic_struct_visitor) \
1126 .type = SIDE_ENUM_INIT(SIDE_TYPE_DYNAMIC_STRUCT_VISITOR), \
1130 .side_dynamic_struct_visitor = SIDE_PTR_INIT(_dynamic_struct_visitor), \
1135 #define side_arg_dynamic_define_vec(_identifier, _sav, _attr...) \
1136 const struct side_arg _identifier##_vec[] = { _sav }; \
1137 const struct side_arg_dynamic_vla _identifier = { \
1138 .sav = SIDE_PTR_INIT(_identifier##_vec), \
1139 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
1140 .len = SIDE_ARRAY_SIZE(_identifier##_vec), \
1141 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
1144 #define side_arg_dynamic_define_struct(_identifier, _struct_fields, _attr...) \
1145 const struct side_arg_dynamic_field _identifier##_fields[] = { _struct_fields }; \
1146 const struct side_arg_dynamic_struct _identifier = { \
1147 .fields = SIDE_PTR_INIT(_identifier##_fields), \
1148 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
1149 .len = SIDE_ARRAY_SIZE(_identifier##_fields), \
1150 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
1153 #define side_arg_dynamic_define_struct_visitor(_identifier, _dynamic_struct_visitor, _ctx, _attr...) \
1154 struct side_arg_dynamic_struct_visitor _identifier = { \
1155 .visitor = SIDE_PTR_INIT(_dynamic_struct_visitor), \
1156 .app_ctx = SIDE_PTR_INIT(_ctx), \
1157 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
1158 .cached_arg = SIDE_PTR_INIT(NULL), \
1159 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
1162 #define side_arg_dynamic_define_vla_visitor(_identifier, _dynamic_vla_visitor, _ctx, _attr...) \
1163 struct side_arg_dynamic_vla_visitor _identifier = { \
1164 .visitor = SIDE_PTR_INIT(_dynamic_vla_visitor), \
1165 .app_ctx = SIDE_PTR_INIT(_ctx), \
1166 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
1167 .cached_arg = SIDE_PTR_INIT(NULL), \
1168 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
1171 #define side_arg_define_vec(_identifier, _sav) \
1172 const struct side_arg _identifier##_vec[] = { _sav }; \
1173 const struct side_arg_vec _identifier = { \
1174 .sav = SIDE_PTR_INIT(_identifier##_vec), \
1175 .len = SIDE_ARRAY_SIZE(_identifier##_vec), \
1178 #define side_arg_dynamic_field(_name, _elem) \
1180 .field_name = SIDE_PTR_INIT(_name), \
1185 * Event instrumentation description registration, runtime enabled state
1186 * check, and instrumentation invocation.
1189 #define side_arg_list(...) __VA_ARGS__
1191 #define side_event_cond(_identifier) \
1192 if (side_unlikely(__atomic_load_n(&side_event_state__##_identifier.enabled, \
1195 #define _side_event_call(_call, _identifier, _sav) \
1197 const struct side_arg side_sav[] = { _sav }; \
1198 const struct side_arg_vec side_arg_vec = { \
1199 .sav = SIDE_PTR_INIT(side_sav), \
1200 .len = SIDE_ARRAY_SIZE(side_sav), \
1202 _call(&(side_event_state__##_identifier).parent, &side_arg_vec); \
1205 #define side_event_call(_identifier, _sav) \
1206 _side_event_call(side_call, _identifier, SIDE_PARAM(_sav))
1208 #define side_event(_identifier, _sav) \
1209 side_event_cond(_identifier) \
1210 side_event_call(_identifier, SIDE_PARAM(_sav))
1212 #define _side_event_call_variadic(_call, _identifier, _sav, _var_fields, _attr...) \
1214 const struct side_arg side_sav[] = { _sav }; \
1215 const struct side_arg_vec side_arg_vec = { \
1216 .sav = SIDE_PTR_INIT(side_sav), \
1217 .len = SIDE_ARRAY_SIZE(side_sav), \
1219 const struct side_arg_dynamic_field side_fields[] = { _var_fields }; \
1220 const struct side_arg_dynamic_struct var_struct = { \
1221 .fields = SIDE_PTR_INIT(side_fields), \
1222 .attr = SIDE_PTR_INIT(_attr), \
1223 .len = SIDE_ARRAY_SIZE(side_fields), \
1224 .nr_attr = SIDE_ARRAY_SIZE(_attr), \
1226 _call(&(side_event_state__##_identifier.parent), &side_arg_vec, &var_struct); \
1229 #define side_event_call_variadic(_identifier, _sav, _var_fields, _attr...) \
1230 _side_event_call_variadic(side_call_variadic, _identifier, SIDE_PARAM(_sav), SIDE_PARAM(_var_fields), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1232 #define side_event_variadic(_identifier, _sav, _var, _attr...) \
1233 side_event_cond(_identifier) \
1234 side_event_call_variadic(_identifier, SIDE_PARAM(_sav), SIDE_PARAM(_var), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1236 #define _side_statedump_event_call(_call, _identifier, _key, _sav) \
1238 const struct side_arg side_sav[] = { _sav }; \
1239 const struct side_arg_vec side_arg_vec = { \
1240 .sav = SIDE_PTR_INIT(side_sav), \
1241 .len = SIDE_ARRAY_SIZE(side_sav), \
1243 _call(&(side_event_state__##_identifier).parent, &side_arg_vec, _key); \
1246 #define side_statedump_event_call(_identifier, _key, _sav) \
1247 _side_statedump_event_call(side_statedump_call, _identifier, _key, SIDE_PARAM(_sav))
1249 #define _side_statedump_event_call_variadic(_call, _identifier, _key, _sav, _var_fields, _attr...) \
1251 const struct side_arg side_sav[] = { _sav }; \
1252 const struct side_arg_vec side_arg_vec = { \
1253 .sav = side_ptr_init(side_sav), \
1254 .len = side_array_size(side_sav), \
1256 const struct side_arg_dynamic_field side_fields[] = { _var_fields }; \
1257 const struct side_arg_dynamic_struct var_struct = { \
1258 .fields = side_ptr_init(side_fields), \
1259 .attr = side_ptr_init(_attr), \
1260 .len = side_array_size(side_fields), \
1261 .nr_attr = side_array_size(_attr), \
1263 _call(&(side_event_state__##_identifier.parent), &side_arg_vec, &var_struct, _key); \
1266 #define side_statedump_event_call_variadic(_identifier, _key, _sav, _var_fields, _attr...) \
1267 _side_statedump_event_call_variadic(side_statedump_call_variadic, _identifier, _key, SIDE_PARAM(_sav), SIDE_PARAM(_var_fields), SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1269 #define _side_define_event(_linkage, _identifier, _provider, _event, _loglevel, _fields, _flags, _attr...) \
1270 _linkage struct side_event_description __attribute__((section("side_event_description"))) \
1272 _linkage struct side_event_state_0 __attribute__((section("side_event_state"))) \
1273 side_event_state__##_identifier = { \
1275 .version = SIDE_EVENT_STATE_ABI_VERSION, \
1277 .nr_callbacks = 0, \
1279 .callbacks = (const struct side_callback *) &side_empty_callback[0], \
1280 .desc = &(_identifier), \
1282 _linkage struct side_event_description __attribute__((section("side_event_description"))) \
1284 .struct_size = offsetof(struct side_event_description, end), \
1285 .version = SIDE_EVENT_DESCRIPTION_ABI_VERSION, \
1286 .state = SIDE_PTR_INIT(&(side_event_state__##_identifier.parent)), \
1287 .provider_name = SIDE_PTR_INIT(_provider), \
1288 .event_name = SIDE_PTR_INIT(_event), \
1289 .fields = SIDE_PTR_INIT(_fields), \
1290 .attr = SIDE_PTR_INIT(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
1291 .flags = (_flags), \
1292 .nr_side_type_label = _NR_SIDE_TYPE_LABEL, \
1293 .nr_side_attr_type = _NR_SIDE_ATTR_TYPE, \
1294 .loglevel = SIDE_ENUM_INIT(_loglevel), \
1295 .nr_fields = SIDE_ARRAY_SIZE(SIDE_PARAM(_fields)), \
1296 .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list())), \
1298 static const struct side_event_description *side_event_ptr__##_identifier \
1299 __attribute__((section("side_event_description_ptr"), used)) = &(_identifier);
1301 #define side_static_event(_identifier, _provider, _event, _loglevel, _fields, _attr...) \
1302 _side_define_event(static, _identifier, _provider, _event, _loglevel, SIDE_PARAM(_fields), \
1305 #define side_static_event_variadic(_identifier, _provider, _event, _loglevel, _fields, _attr...) \
1306 _side_define_event(static, _identifier, _provider, _event, _loglevel, SIDE_PARAM(_fields), \
1307 SIDE_EVENT_FLAG_VARIADIC, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1309 #define side_hidden_event(_identifier, _provider, _event, _loglevel, _fields, _attr...) \
1310 _side_define_event(__attribute__((visibility("hidden"))), _identifier, _provider, _event, \
1311 _loglevel, SIDE_PARAM(_fields), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1313 #define side_hidden_event_variadic(_identifier, _provider, _event, _loglevel, _fields, _attr...) \
1314 _side_define_event(__attribute__((visibility("hidden"))), _identifier, _provider, _event, \
1315 _loglevel, SIDE_PARAM(_fields), SIDE_EVENT_FLAG_VARIADIC, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1317 #define side_export_event(_identifier, _provider, _event, _loglevel, _fields, _attr...) \
1318 _side_define_event(__attribute__((visibility("default"))), _identifier, _provider, _event, \
1319 _loglevel, SIDE_PARAM(_fields), 0, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1321 #define side_export_event_variadic(_identifier, _provider, _event, _loglevel, _fields, _attr...) \
1322 _side_define_event(__attribute__((visibility("default"))), _identifier, _provider, _event, \
1323 _loglevel, SIDE_PARAM(_fields), SIDE_EVENT_FLAG_VARIADIC, SIDE_PARAM_SELECT_ARG1(_, ##_attr, side_attr_list()))
1325 #define side_declare_event(_identifier) \
1326 extern struct side_event_state_0 side_event_state_##_identifier; \
1327 extern struct side_event_description _identifier
1329 #endif /* SIDE_INSTRUMENTATION_C_API_H */
This page took 0.066477 seconds and 5 git commands to generate.