On Fri, 10 Jun 2022, Markus Elfring wrote: > > > The test of an expression's address does not necessarily represent the > > whole condition, it may only be a part of it. Also, an expression's > > address is likely to be non-zero in every test expression, not only in > > if statements. > > > > This change aims at detecting an address test in more complex conditions > > for every test expression. > > > > Signed-off-by: Jérémy Lefaure <jeremy.lefaure@xxxxxxxxxxx> > > --- > > v2 -> v3: Apply Julia's suggestion to have a more generic solution + adapt commit message and file > > name to this new solution. > > v1 -> v2: Moved disjunction on the condition itself instead of being on the > > if statements. > > > > scripts/coccinelle/misc/{ifaddr.cocci => test_addr.cocci} | 4 +--- > > 1 file changed, 1 insertion(+), 3 deletions(-) > > rename scripts/coccinelle/misc/{ifaddr.cocci => test_addr.cocci} (94%) > > > > diff --git a/scripts/coccinelle/misc/ifaddr.cocci b/scripts/coccinelle/misc/test_addr.cocci > > similarity index 94% > > rename from scripts/coccinelle/misc/ifaddr.cocci > > rename to scripts/coccinelle/misc/test_addr.cocci > > index fc92e8fcbfcb..2d0ec86d1701 100644 > > --- a/scripts/coccinelle/misc/ifaddr.cocci > > +++ b/scripts/coccinelle/misc/test_addr.cocci > > @@ -14,12 +14,10 @@ virtual context > > > > @r@ > > expression x; > > -statement S1,S2; > > position p; > > @@ > > > > -*if@p (&x) > > - S1 else S2 > > +*&x@p || ... > > > > @script:python depends on org@ > > p << r.p; > > A) > I would like to point out once more that no questionable places were marked > by the software “Coccinelle 1.1.1” (OCaml 4.14.0) in the following source code. > https://lore.kernel.org/cocci/da86bc36-36af-7bd7-6bee-861e160ba6a4@xxxxxx/ > https://sympa.inria.fr/sympa/arc/cocci/2022-06/msg00017.html > > > void check(void) > { > int s = 1; > bool t = (&s); > } > > > Thus I propose to add another case distinction by the means of > a SmPL disjunction. > > > *\( &x || ... \| &x \) > > > Will any more adjustments become helpful for the handling of optional code > according to SmPL ellipses? Did you actually try this? Because it will match every occurrence of &x. I don't think that your example represents a real problem. julia > > > > B) > I imagine that generated diff output should be wrapped by a source block > for the operation mode “org”. > https://orgmode.org/quickstart.html#blocks > > > Regards, > Markus >