Coccinelle archive on lore.kernel.org
 help / color / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: Coccinelle <cocci@systeme.lip6.fr>
Subject: Re: [Cocci] Checking the “display” of last two statements in code blocks
Date: Fri, 12 Apr 2019 12:32:19 +0200 (CEST)
Message-ID: <alpine.DEB.2.20.1904121230480.4091@hadrien> (raw)
In-Reply-To: <e927e2b4-9ab3-81e2-80fc-e355bf608e06@web.de>

[-- Attachment #1: Type: text/plain, Size: 1951 bytes --]



On Fri, 12 Apr 2019, Markus Elfring wrote:

> >> @@ -3015,11 +2859,6 @@ static int init_slave(struct gbe_priv *g
> >>         }
> >>
> >>         if (of_property_read_u32(node, "link-interface",
> >> -                                &slave->link_interface)) {
> >> -               dev_warn(gbe_dev->dev,
> >> -                        "missing link-interface value defaulting to 1G mac-phy link\n");
> >> -               slave->link_interface = SGMII_LINK_MAC_PHY;
> >> -       }
> >>
> >>         slave->node = node;
> >>         slave->open = false;
> >> …
> >>
> >>
> >> Now I wonder about the suggested change for the if statement here.
> >> Should any more software adjustments be considered so that it will be avoided
> >> to delete only a questionable part from a function call within a condition check?
> >
> > I don't understand the problem.
>
> I suggest to take another look at the details in this test result.
>
>
> > You put *s on the { } and two statements, and you get - on the lines
> > that contain the { } and the two statements.
>
> This is the general analysis approach.
>
>
> > Nothing is being deleted anyway.  The -s are just a concise way to
> > indicate the lines on which you requested a match with the *s.
>
> I am using the asterisk functionality of the semantic patch language
> as usual.
>
> These minus characters indicate lines for possible deletions according to
> the diff format, don't they?
>
>
> I doubt that such code can be still compiled after an incomplete
> removal of the shown block would be applied because of the generated
> update suggestion.

The asterisk functionality has no goal of making code that compiles.  It's
goal is to show you the lines of interest.  If you use emacs, you can use
emacs diff mode to jump to those lines in the affected files.

If you want to actually remove the lines, then use - instead of asterisk.
- and + have the goal of making code that compiles.  * does not.

julia

[-- Attachment #2: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

  reply index

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12  9:42 Markus Elfring
2019-04-12  9:45 ` Julia Lawall
2019-04-12 10:28   ` Markus Elfring
2019-04-12 10:32     ` Julia Lawall [this message]
2019-04-12 10:42       ` [Cocci] Clarification for SmPL asterisk functionality Markus Elfring
2019-04-18 10:00 ` [Cocci] Searching for last two statements in code blocks Markus Elfring
2019-04-19 12:14 ` [Cocci] Checking the search for duplicate statements at the end of if branches Markus Elfring
2019-04-20  7:30   ` [Cocci] Checking execution environment for Python code in SmPL scripts Markus Elfring
2019-04-20  7:35     ` Julia Lawall
2019-04-20  7:51       ` Markus Elfring
2019-04-20  8:05         ` Julia Lawall
2019-04-20  8:11           ` Markus Elfring

Reply instructions:

You may reply publically 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=alpine.DEB.2.20.1904121230480.4091@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=Markus.Elfring@web.de \
    --cc=cocci@systeme.lip6.fr \
    /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

Coccinelle archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/cocci/0 cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ https://lore.kernel.org/cocci \
		cocci@systeme.lip6.fr cocci@archiver.kernel.org
	public-inbox-index cocci


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/fr.lip6.systeme.cocci


AGPL code for this site: git clone https://public-inbox.org/ public-inbox