On 10/5/18 8:49 AM, Alex Bennée wrote:
> +def generate_h_begin(events, group):
> + for event in events:
> + # prototype for plugin event
> + out('bool _plugin_%(api)s(%(args)s);',
> + api=event.api(),
> + args=event.args)
> + # prototype for plugin fn
> + out("typedef bool (* _plugin_%(api)s_fn)(%(args)s);",
> + api=event.api(),
> + args=event.args)
Do you really want the _fn typedef to be a pointer?
Not doing that would allow declarations like
_plugin_apis_fn _plugin_apis;
> +def generate_h(event, group):
> + out(' if (!_plugin_%(api)s(%(args)s)) {',
> + ' return;',
> + ' };',
Extra ;
> + # Forst the pre-amble, bail early if the event is not enabled and
First.
> + # if it is but no plugin is enabled let the reset of the events proceed.
> +
> + out('',
> + ' if (!%(cond)s) {',
> + ' return false;',
> + ' }',
> + '',
> + ' uintptr_t fp = trace_event_get_plugin(&_%(event)s_EVENT);',
Declaration in the middle of a block.
Which, honestly, we should just allow via -std=gnu99 or gnu01.
But until then...
> + out('',
> + ' _plugin_%(api)s_fn plug_fn = (_plugin_%(api)s_fn) fp;',
Likewise.
r~