On Wed, 8 Jun 2022, Jérémy LEFAURE wrote: > > I don't really understand the above, but it made me realize that actually > > the following is sufficient: > > > > @@ > > expression x; > > @@ > > > > *&x || ... > > > > This forces &x to appear as a test expression. There can be 0 or more > > occurrences of ||, so eg &x && y is also matched. > > That's indeed better because it allows to catch issues in tests that > are not in if statements (such as loops). Is it ok to rename this file > to test_addr.cocci in the next version of the patch to give it a more > appropriated name? That seems like a good idea, thanks. > > It also gives a better line indication for conditions split on several > lines. > > I also noticed that with this change the semantic patch catches tests of > addresses in if statements when likely/unlikely is used, for example > if (likely(&a)). This was not the case with my previous patch nor with > the current semantic patch version on master even though the isomorphism > unlikely(E) <=> likely(E) => E is in the standard.iso file. I don't get > this behavior change, do you have any idea why it didn't work? Isomorphisms apply to the semantic patch, not to the code. You see the arrow only going to the right that reaches E. If it were going to the left, then Coccinellewould take every expression and try to wrap likely and unlikely around it, which would obviously be undesirable. julia