Coccinelle archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Gaston Fernandez <gaston.fernandez@eclypsium.com>
Cc: cocci@inria.fr
Subject: Re: [cocci] Reordering of if/else branches with SmPL?
Date: Wed, 17 Sep 2025 15:07:48 +0200	[thread overview]
Message-ID: <3324d3c2-d9be-4e22-8fa3-611d1f53a68e@web.de> (raw)
In-Reply-To: <CAE0_PArbd-jaTHr8NR-mdP7pkDPsfHVSAAw_Xe16vvexx+eVrA@mail.gmail.com>

> Hi! I'm having some trouble with running a cocci pattern, and I would like to know if it's a mistake related to my pattern, or a coccinelle's limitation.
> 
> _### What the patch should do ###_
> - The patch *[if_else_swap.cocci]* should take every instance of if/else statements from the file *[test-nested.c]*, negate the condition and then swap its bodies. (A double negative)

I suggest to take another look at data processing consequences
also according to a known isomorphism like “neg_if”.
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/7674e29155d23846c41504948f4e4b1e796d07ec/standard.iso#L421-432

Would you eventually like to disable it for the mentioned transformation?

Regards,
Markus

      reply	other threads:[~2025-09-17 13:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03 14:04 [cocci] Help - Pattern with nested 'if' statements Gaston Fernandez
2025-09-17 13:07 ` Markus Elfring [this message]

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=3324d3c2-d9be-4e22-8fa3-611d1f53a68e@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@inria.fr \
    --cc=gaston.fernandez@eclypsium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).