g++ doesn't like the syntax used for assigning structures in the plugin
macros:
/tmp/babeltrace/include/babeltrace2/plugin/plugin-dev.h:599:3: error: expected primary-expression before ‘.’ token
.value._attr_name = _x, \
^
/tmp/babeltrace/include/babeltrace2/plugin/plugin-dev.h:871:2: note: in expansion of macro ‘__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE’
__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(source_msg_iter_init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_INIT_METHOD, _id, _comp_class_id, source, _x)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/babeltrace/include/babeltrace2/plugin/plugin-dev.h:1356:2: note: in expansion of macro ‘BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_WITH_ID’
BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_WITH_ID(auto, _name, _x)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
can.cpp:829:1: note: in expansion of macro ‘BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD’
BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD(CANSource, can_iter_init);
^
Changing
.value._attr_name = _x
to
.value = { ._attr_name = _x }
makes it work. There are a few instances of this, I changed all I found.
Built-tested with gcc 7.4.0 and clang-9, and verified that a plugin compiled
with g++ 7.4.0 works.
Change-Id: I17cb4edf1082003dc0bb9d0fae906c391daf3da4
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1964
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
.plugin_descriptor = &__bt_plugin_descriptor_##_id, \
.type_name = #_attr_name, \
.type = _attr_type, \
.plugin_descriptor = &__bt_plugin_descriptor_##_id, \
.type_name = #_attr_name, \
.type = _attr_type, \
- .value._attr_name = _x, \
+ .value = { ._attr_name = _x }, \
}; \
static struct __bt_plugin_descriptor_attribute const * const __bt_plugin_descriptor_attribute_##_id##_##_attr_name##_ptr __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_ATTRS = &__bt_plugin_descriptor_attribute_##_id##_##_attr_name
}; \
static struct __bt_plugin_descriptor_attribute const * const __bt_plugin_descriptor_attribute_##_id##_##_attr_name##_ptr __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_ATTRS = &__bt_plugin_descriptor_attribute_##_id##_##_attr_name
*/
#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _msg_iter_next_method) \
static struct __bt_plugin_component_class_descriptor __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id = { \
*/
#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _msg_iter_next_method) \
static struct __bt_plugin_component_class_descriptor __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id = { \
- .plugin_descriptor = &__bt_plugin_descriptor_##_id, \
- .name = _name, \
- .type = BT_COMPONENT_CLASS_TYPE_SOURCE, \
- .methods.source = { \
- .msg_iter_next = _msg_iter_next_method, \
- }, \
- }; \
+ .plugin_descriptor = &__bt_plugin_descriptor_##_id, \
+ .name = _name, \
+ .type = BT_COMPONENT_CLASS_TYPE_SOURCE, \
+ .methods = { .source = { .msg_iter_next = _msg_iter_next_method } }, \
+ }; \
static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id
/*
static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id
/*
*/
#define BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _msg_iter_next_method) \
static struct __bt_plugin_component_class_descriptor __bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id = { \
*/
#define BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _msg_iter_next_method) \
static struct __bt_plugin_component_class_descriptor __bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id = { \
- .plugin_descriptor = &__bt_plugin_descriptor_##_id, \
- .name = _name, \
- .type = BT_COMPONENT_CLASS_TYPE_FILTER, \
- .methods.filter = { \
- .msg_iter_next = _msg_iter_next_method, \
- }, \
- }; \
+ .plugin_descriptor = &__bt_plugin_descriptor_##_id, \
+ .name = _name, \
+ .type = BT_COMPONENT_CLASS_TYPE_FILTER, \
+ .methods = { .filter = { .msg_iter_next = _msg_iter_next_method } }, \
+ }; \
static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id
/*
static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id
/*
.plugin_descriptor = &__bt_plugin_descriptor_##_id, \
.name = _name, \
.type = BT_COMPONENT_CLASS_TYPE_SINK, \
.plugin_descriptor = &__bt_plugin_descriptor_##_id, \
.name = _name, \
.type = BT_COMPONENT_CLASS_TYPE_SINK, \
- .methods.sink = { \
- .consume = _consume_method, \
- }, \
+ .methods = { .sink = { .consume = _consume_method } }, \
}; \
static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id
}; \
static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id
.comp_class_descriptor = &__bt_plugin_##_type##_component_class_descriptor_##_id##_##_comp_class_id, \
.type_name = #_attr_name, \
.type = _attr_type, \
.comp_class_descriptor = &__bt_plugin_##_type##_component_class_descriptor_##_id##_##_comp_class_id, \
.type_name = #_attr_name, \
.type = _attr_type, \
- .value._attr_name = _x, \
+ .value = { ._attr_name = _x }, \
}; \
static struct __bt_plugin_component_class_descriptor_attribute const * const __bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS = &__bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name
}; \
static struct __bt_plugin_component_class_descriptor_attribute const * const __bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS = &__bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name