[Cocci] Compacting parameters into fewer lines

SF Markus Elfring elfring at users.sourceforge.net
Wed Aug 1 08:08:45 CEST 2018


>> @rule1@
>> expression x;
>> expression list y;
>> @@
>> -DBG_PRINTF
>> +NV_PRINTF
>>            (
>> -          (x),
>>             y);
> 
> This doesn't work:

Do you care if a macro (or function) parameter is optionally enclosed by parentheses?


> -        DBG_PRINTF((DBG_MODULE_OS, DEBUGLEVEL_ERRORS,
> -            "NVRM: x86emu: int $%d (eax = %08x)\n", num, M.x86.R_EAX));
> +        NV_PRINTF();

Does this test result need any further clarification for the desired
software behaviour on an other change granularity?


> I always appreciate optimization suggestions.

I have got another software development idea for this transformation approach.

How do you think about to improve the replacement specification a bit more
by combining the variants A  till D into a single SmPL rule which will use
a nested SmPL disjunction?

Regards,
Markus


More information about the Cocci mailing list