Re: [External] Re: [RFC 03/12] perf event action: Add parsing const integer expr support

Yang Jihong
2024-12-04T08:32:23Z

Hello,

On 11/29/24 04:25, Arnaldo Carvalho de Melo wrote:
> On Thu, Nov 28, 2024 at 09:35:44PM +0800, Yang Jihong wrote:
>> Support parsing of constant integer expression.
>>
>> Signed-off-by: Yang Jihong <yangjihong@bytedance.com>
>> ---
>> tools/perf/util/parse-action.c | 52 ++++++++++++++++++++++++++++++++++
>> tools/perf/util/parse-action.h | 1 +
>> tools/perf/util/parse-action.l | 19 +++++++++++++
>> tools/perf/util/parse-action.y | 13 ++++++++-
>> 4 files changed, 84 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/util/parse-action.c b/tools/perf/util/parse-action.c
>> index 391546bf3d73..3b10cf9f99b3 100644
>> --- a/tools/perf/util/parse-action.c
>> +++ b/tools/perf/util/parse-action.c
>> @@ -7,6 +7,7 @@
>> *
>> * Supported expressions:
>> * - constant:
>> + * - integer
>
> And now there are alignment differences and no : ?
This indicates that integer expression is a subclass of constant
expression, so integer is indented inside constant.
>
>> */
>>
>> #include "util/debug.h"
>> @@ -118,7 +119,58 @@ void event_actions__free(void)
>> (void)event_actions__for_each_expr_safe(do_action_free, NULL, false);
>> }
>>
>> +static int expr_const_int_new(struct evtact_expr *expr, void *data, int size)
>> +{
>> + if (data == NULL ||
>> + (size != sizeof(int)
>> + && size != sizeof(long) && size != sizeof(long long))) {
>
> && should be at the end of the previous line, just like you did with the
> || at the end of the first line
Okay, will fix in next version.

Thanks,
Yang