Add attributes to optional types
authorOlivier Dion <odion@efficios.com>
Thu, 24 Oct 2024 16:14:12 +0000 (12:14 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 24 Oct 2024 20:32:52 +0000 (16:32 -0400)
Change-Id: I3297006a806ec929a809dc09caca2cccbb99b96f
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/side/abi/type-description.h
include/side/instrumentation-c-api.h

index 431e0d23fdb60cc1c4f7080b23572513ff413683..69142231d1a6376ee10b7088830ab0330bcf9049 100644 (file)
@@ -414,6 +414,8 @@ side_check_size(struct side_type_variant, 40 + sizeof(const struct side_type));
 
 struct side_type_optional {
        side_ptr_t(const struct side_type) elem_type;
+       side_ptr_t(const struct side_attr) attr;
+       uint32_t nr_attr;
 };
 
 struct side_event_field {
index 33e1e98084d23d177b78139b27fc07261c8ca8eb..fedcaa2552981fa4ccbf6585e8d0cae45856cedb 100644 (file)
@@ -642,19 +642,22 @@ enum {
                }                                                       \
        }
 
-#define _side_type_optional_define(_elem_type)         \
-       {                                               \
-               .elem_type = SIDE_PTR_INIT(_elem_type), \
+#define _side_type_optional_define(_elem_type, _attr...)               \
+       {                                                               \
+               .elem_type = SIDE_PTR_INIT(_elem_type),                 \
+               .attr = SIDE_PTR_INIT(SIDE_DEFAULT_ATTR(_, ##_attr, side_attr_list())), \
+               .nr_attr = SIDE_ARRAY_SIZE(SIDE_DEFAULT_ATTR(_, ##_attr, side_attr_list())), \
        }
 
-#define _side_define_optional(_identifier, _elem_type) \
-       const struct side_type_optional _identifier = _side_type_optional_define(SIDE_PARAM(_elem_type))
+#define _side_define_optional(_identifier, _elem_type, _attr...)       \
+       const struct side_type_optional _identifier = _side_type_optional_define(SIDE_PARAM(_elem_type), \
+                                                                               SIDE_DEFAULT_ATTR(_, ##_attr, side_attr_list()))
 
 #define _side_field_optional(_name, _identifier)               \
        _side_field(_name, _side_type_optional(SIDE_PARAM(&(_identifier))))
 
-#define _side_field_optional_literal(_name, _elem_type)                        \
-       _side_field(_name, _side_type_optional(SIDE_COMPOUND_LITERAL(struct side_type_optional, _side_type_optional_define(SIDE_PARAM(_elem_type)))))
+#define _side_field_optional_literal(_name, _elem_type, _attr...)              \
+       _side_field(_name, _side_type_optional(SIDE_COMPOUND_LITERAL(struct side_type_optional, _side_type_optional_define(SIDE_PARAM(_elem_type), SIDE_DEFAULT_ATTR(_, ##_attr, side_attr_list())))))
 
 #define _side_type_array(_array)                               \
        {                                                       \
This page took 0.024839 seconds and 4 git commands to generate.