Re: [PATCH v3 1/6] perf tools: Derive trigger class from auxtrace_snapshot
From: Jiri Olsa
Date: Sun Apr 17 2016 - 07:52:40 EST
On Fri, Apr 15, 2016 at 06:20:15PM +0000, Wang Nan wrote:
SNIP
> +
> +#define __TRIGGER_VAR(n) n##_state
> +#define __DEF_TRIGGER_VOID_FUNC(n, op) \
> +static inline void n##_##op(void) {trigger_##op(&__TRIGGER_VAR(n)); }
> +
> +#define __DEF_TRIGGER_FUNC(n, type, op) \
> +static inline type n##_##op(void) {return trigger_##op(&__TRIGGER_VAR(n)); }
> +
> +#define DEFINE_TRIGGER(n, def) \
> +struct trigger n##_state = {.state = TRIGGER_##def, .error = false,};\
> +__DEF_TRIGGER_VOID_FUNC(n, on) \
> +__DEF_TRIGGER_VOID_FUNC(n, release) \
> +__DEF_TRIGGER_VOID_FUNC(n, toggle) \
> +__DEF_TRIGGER_VOID_FUNC(n, colddown) \
> +__DEF_TRIGGER_VOID_FUNC(n, off) \
> +__DEF_TRIGGER_VOID_FUNC(n, error) \
> +__DEF_TRIGGER_FUNC(n, bool, is_released) \
> +__DEF_TRIGGER_FUNC(n, bool, is_toggled) \
> +__DEF_TRIGGER_FUNC(n, bool, is_error)
hum, it gets the impression that __DEF_TRIGGER_FUNC is generic
but it's not, right? __DEF_TRIGGER_BOOL_FUNC might suit better
without the bool type as an argument
thanks,
jirka