Coccinelle archive on lore.kernel.org
 help / color / Atom feed
* [Cocci] Checking the “display” of last two statements in code blocks
@ 2019-04-12  9:42 Markus Elfring
  2019-04-12  9:45 ` Julia Lawall
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Markus Elfring @ 2019-04-12  9:42 UTC (permalink / raw)
  To: Coccinelle

Hello,

I have tried another small SmPL script out.


@display@
identifier work;
statement s1, s2;
type T;
@@
 T work(...)
 {
 ... when any
*{
    ... when any
*   s1
*   s2
*}
 ... when any
 }


I have observed then that the following diff hunk was generated.


elfring@Sonne:~/Projekte/Linux/next-patched> spatch ~/Projekte/Coccinelle/janitor/show_last_two_statements_in_a_block.cocci drivers/net/ethernet/ti/netcp_ethss.c|less
…
@@ -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?

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, back to index

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-12  9:42 [Cocci] Checking the “display” of last two statements in code blocks Markus Elfring
2019-04-12  9:45 ` Julia Lawall
2019-04-12 10:28   ` Markus Elfring
2019-04-12 10:32     ` Julia Lawall
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

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