Coccinelle archive on lore.kernel.org
 help / color / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: "Jürgen Groß" <jgross@suse.com>
Cc: cocci@systeme.lip6.fr
Subject: Re: [Cocci] macro parameters and expressions?
Date: Fri, 11 Oct 2019 22:00:51 +0200 (CEST)
Message-ID: <alpine.DEB.2.21.1910112200230.3284@hadrien> (raw)
In-Reply-To: <56e7bd73-5b50-ddeb-9a56-62daf93eb015@suse.com>

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



On Fri, 11 Oct 2019, Jürgen Groß wrote:

> Hi,
>
> I have a simple semantic patch:
>
>   virtual patch
>
>   @@
>   expression buf, val;
>   @@
>   - snprintf(buf, PAGE_SIZE, "%d\n", val)
>   + spgprintf_d(buf, val)
>
> This works nearly always as expected, but not in some macros. The cases
> where it is not working are those when "val" is using a parameter of the
> macro, e.g.:
>
>   #define MACRO(name)    snprintf(pg, PAGE_SIZE, %u\n", ptr->name)
>
> Is that on purpose? If yes, how can this be avoided?

I don't think it should be on purpose.  Could you send some C code that
illustrates the problem?

thanks,
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: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11  7:42 Jürgen Groß
2019-10-11 20:00 ` Julia Lawall [this message]
2019-10-13 13:37   ` Markus Elfring
     [not found]     ` <alpine.DEB.2.21.1910131806400.2565@hadrien>
2019-10-13 16:33       ` [Cocci] Adjusting macros with SmPL? Markus Elfring
2019-10-13 16:37         ` Julia Lawall
2019-10-13 16:50           ` Markus Elfring
2019-10-14  9:08           ` Markus Elfring
2019-10-14 10:24             ` Julia Lawall
2019-10-14 11:00               ` Markus Elfring
2019-10-15  8:20               ` Markus Elfring
     [not found]   ` <fb924870-4bc2-1ca0-4fa4-0ddbf7ebb9d2@suse.com>
2019-10-14 11:14     ` [Cocci] macro parameters and expressions? Julia Lawall
2019-10-14 11:50       ` Markus Elfring
2019-10-14 13:33       ` Jürgen Groß
2019-10-14 14:03         ` Julia Lawall
2019-10-13 13:28 ` Markus Elfring
2019-10-13 13:36   ` Julia Lawall
2019-10-13 14:22     ` [Cocci] Checking the influence of “virtual” SmPL variables Markus Elfring
2019-10-13 16:09       ` Julia Lawall
2019-10-13 16:39         ` Markus Elfring
2019-10-14 15:33 ` [Cocci] macro parameters and expressions? Markus Elfring
     [not found]   ` <alpine.DEB.2.21.1910141740580.2330@hadrien>
2019-10-14 16:05     ` Markus Elfring
2019-10-15  6:44     ` Markus Elfring
2019-10-15  6:54       ` Markus Elfring
2019-10-15  7:40       ` Markus Elfring
2019-10-15  8:05       ` Julia Lawall
2019-10-15  8:34         ` Markus Elfring
2019-10-15  9:07         ` Markus Elfring
2019-10-15  9:28           ` Julia Lawall

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.21.1910112200230.3284@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=jgross@suse.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

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

Example config snippet for mirrors

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