X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fplugin%2Fcomponent-factory-internal.h;h=10a2b7872b77a7794784cec53dd4df77b10210e9;hb=cba174d597a5c4a47ab7fd040b5650e23dd0b52c;hp=9cb07ec22f526ea79ed3e809f49f1fc728768773;hpb=5c0f40f4b900e41630c0291468c50aa9a62db8b1;p=babeltrace.git diff --git a/include/babeltrace/plugin/component-factory-internal.h b/include/babeltrace/plugin/component-factory-internal.h index 9cb07ec2..10a2b787 100644 --- a/include/babeltrace/plugin/component-factory-internal.h +++ b/include/babeltrace/plugin/component-factory-internal.h @@ -36,6 +36,33 @@ #include #include +#define SECTION_BEGIN(_name) &__start_##_name +#define SECTION_END(_name) &__stop_##_name + +#define SECTION_ELEMENT_COUNT(_name) (SECTION_END(_name) - SECTION_BEGIN(_name)) + +#define DECLARE_SECTION(_type, _name) \ + extern _type const __start_##_name __attribute((weak)); \ + extern _type const __stop_##_name __attribute((weak)) + +#define DECLARE_PLUG_IN_SECTIONS \ + DECLARE_SECTION(bt_plugin_register_func, __plugin_register_funcs); \ + DECLARE_SECTION(const char *, __plugin_names); \ + DECLARE_SECTION(const char *, __plugin_authors); \ + DECLARE_SECTION(const char *, __plugin_licenses); \ + DECLARE_SECTION(const char *, __plugin_descriptions) + +#define PRINT_SECTION(_printer, _name) \ + _printer("Section " #_name " [%p - %p], (%zu elements)\n", \ + SECTION_BEGIN(_name), SECTION_END(_name), SECTION_ELEMENT_COUNT(_name)) + +#define PRINT_PLUG_IN_SECTIONS(_printer) \ + PRINT_SECTION(_printer, __plugin_register_funcs); \ + PRINT_SECTION(_printer, __plugin_names); \ + PRINT_SECTION(_printer, __plugin_authors); \ + PRINT_SECTION(_printer, __plugin_licenses); \ + PRINT_SECTION(_printer, __plugin_descriptions) + struct bt_component_factory { struct bt_object base; /** Array of pointers to struct bt_component_class */