All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Jacob Keller <jacob.e.keller@intel.com>, 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 11:47:01 +0100	[thread overview]
Message-ID: <c3991582-ecb1-4b7a-b2d9-057a6be1d7fd@web.de> (raw)
In-Reply-To: <67642477-5f3e-4b2a-914d-579a54f48cbd@intel.com>

> 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
+ )
  , ...
 );


> When the function is inside a block like this, it is transformed to
> include braces. This often violates our style guide as braces around
> single line if or other scopes are not desired.

I became also curious how the support can be improved for source code
analyses and transformations according to compound statements.


> I ran a git bisect to determine when these changes broke, and both
> changes appear to occur due to the following change:

Would you like to share any commands and related background information?


> I was using spatch --parse-cocci and saw some warnings about the patch
> file, and refactored it to:
>
> @disable drop_cast@
> void * void_ptr;
> type T;
> T * typed_ptr;
> @@
>  typed_ptr =
> -(T *)
>  void_ptr

I find it interesting that you tried also an SmPL script variant out
with a better change precision.


> This fixed so that the patch does find all the typecasts, but has often
> left us with undesirable white spacing, …

Will development interests grow for topics like the following?

* Advanced data processing for whitespace characters
  2016-01-12
  https://github.com/coccinelle/coccinelle/issues/58

* Fix indentation algorithm for Linux coding style
  2016-08-29
  https://github.com/coccinelle/coccinelle/issues/75

* Fix usage of white-space characters at two places for Linux coding style
  2016-08-29
  https://github.com/coccinelle/coccinelle/issues/76

* Preserve selected whitespace characters (for Linux coding style)
  2025-02-28
  https://github.com/coccinelle/coccinelle/issues/392


Regards,
Markus

  parent reply	other threads:[~2025-03-07 10: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 ` Markus Elfring [this message]
2025-03-07 20:53   ` [cocci] behavior change in semantic patches since c36b51ffc889 … Jacob Keller
2025-03-07 22:47     ` Jacob Keller
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=c3991582-ecb1-4b7a-b2d9-057a6be1d7fd@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@inria.fr \
    --cc=jacob.e.keller@intel.com \
    --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.