From: Jacob Keller <jacob.e.keller@intel.com>
To: Markus Elfring <Markus.Elfring@web.de>, <cocci@inria.fr>
Cc: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Subject: Re: [cocci] behavior change in semantic patches since c36b51ffc889 …
Date: Fri, 7 Mar 2025 14:47:13 -0800 [thread overview]
Message-ID: <8bc6d266-cc33-4f77-93d8-b12f2086449e@intel.com> (raw)
In-Reply-To: <90c4769b-0247-492f-a137-fec1c970eaf5@intel.com>
On 3/7/2025 12:53 PM, Jacob Keller wrote:
>
>
> On 3/7/2025 2:47 AM, Markus Elfring wrote:
>>> I also noticed a behavior change in another patch:
>>>
>>>> @@
>>>> expression hw, ptr;
>>>> @@
>>>> (
>>>> - ice_free(hw, ptr);
>>>> + devm_kfree(ice_hw_to_dev(hw),ptr);
>>>> )
>>>
>>> This patch updates some code that used an internal wrapper function to
>>> use the appropriate kernel function directly.
>>
>> Would you like to experiment with another transformation approach?
>>
>>
>> @replacement@
>> expression hw;
>> @@
>> -ice_free
>> +devm_kfree
>> (
>> + ice_hw_to_dev(
>> hw
>> + )
>> , ...
>> );
>>
>
For what its worth, I was finally able to get things working pretty much
the same as before with the following semantic patches:
> @@
> expression hw;
> @@
> -ice_free
> +devm_kfree
> (
> +ice_hw_to_dev(
> hw
> +)
> , ...)
and
> @disable drop_cast@
> void * void_ptr;
> type T;
> @@
> -(T *)void_ptr
> +void_ptr
These seem to properly apply with both 1.2.0 and 1.3.0, and mostly
handle the white spacing properly. There were exactly 2 places where I
ended up having to re-arrange the original code slightly having to do
with constructions like:
type ptr =
(type)value
where the original version would have replaced the entire line and
cleaned things up to fit. These were easy enough to fix up on my end.
As a bonus, this caught several missed typecasts of function arguments,
as well as some assignments that the original hadn't caught for some reason.
I think this change should be acceptable on our end and we don't need to
worry about fixes to spatch. Again, I re-tested both 1.3.0 and 1.2.0 and
get the same behavior now.
Appreciate the suggestions and especially the work you guys do on this tool!
Thanks,
Jake
next prev parent reply other threads:[~2025-03-07 22:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 0:43 [cocci] behavior change in semantic patches since c36b51ffc889 ("don't drop down on single statement") Jacob Keller
2025-03-07 0:55 ` Julia Lawall
2025-03-07 20:24 ` Jacob Keller
2025-03-07 10:47 ` [cocci] behavior change in semantic patches since c36b51ffc889 … Markus Elfring
2025-03-07 20:53 ` Jacob Keller
2025-03-07 22:47 ` Jacob Keller [this message]
2025-03-08 9:07 ` Markus Elfring
2025-03-10 18:34 ` Jacob Keller
2025-03-11 9:10 ` Markus Elfring
2025-03-08 8:39 ` Markus Elfring
2025-03-10 18:27 ` Jacob Keller
2025-03-11 9:26 ` Przemek Kitszel
2025-03-08 9:45 ` [cocci] Evolution of transformation processes? Markus Elfring
2025-03-10 18:23 ` Jacob Keller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8bc6d266-cc33-4f77-93d8-b12f2086449e@intel.com \
--to=jacob.e.keller@intel.com \
--cc=Markus.Elfring@web.de \
--cc=cocci@inria.fr \
--cc=przemyslaw.kitszel@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.