All of lore.kernel.org
 help / color / mirror / Atom feed
From: klammerj@a1.net (Johann Klammer)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Q: stdint format specifiers
Date: Thu, 04 Aug 2016 22:55:53 +0200	[thread overview]
Message-ID: <57A3ABD9.3090308@a1.net> (raw)
In-Reply-To: <alpine.DEB.2.10.1608041854360.7967@hadrien>

Mkay...

I tried.
> @r@
> {int8_t,int16_t,int32_t,int64_t,
> uint8_t,uint16_t,uint32_t,uint64_t} x;
> type T;
> T y;
> expression list[n] es;
> constant char[] c;
> identifier f;
> position p;
> @@
> 
> f(...,c at p,es,x at y,...)
> 
> @script:python s@
> T << r.T;  // the type of the argument of interest
> c << r.c;  // the format string
> n << r.n;  // the offset of the argument of interest, counted from 0
> c2;
> @@
fails with:

> ~/projects/FPGA/src/fpgatools/libs$ spatch --sp-file ../pri.sp ./*.c
> init_defs_builtins: /usr/lib/coccinelle/standard.h
> 5 11
> Fatal error: exception Failure("meta: parse error: \n = File \"../pri.sp\", line 2, column 1,  charpos = 5\n    around = 'int8_t', whole content = {int8_t,int16_t,int32_t,int64_t,\n")

looking at the main_grammar.pdf reveals that the typedefs are resolved....
Is there a way to match the original typename? 
If someone actually wrote long int, the lX is perfectly fine. 
if it's one of the stdints it'll change on different subarchs, so it needs the PRI*.

  reply	other threads:[~2016-08-04 20:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-04 16:30 [Cocci] Q: stdint format specifiers Johann Klammer
2016-08-04 16:33 ` Julia Lawall
2016-08-04 16:46   ` Johann Klammer
2016-08-04 17:10     ` Julia Lawall
2016-08-04 20:55       ` Johann Klammer [this message]
2016-08-04 21:11         ` Julia Lawall
2016-08-07 22:35           ` [Cocci] [Solved] " Johann Klammer
     [not found]             ` <alpine.DEB.2.10.1608080744490.3335@hadrien>
2016-08-08 10:48               ` Johann Klammer

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=57A3ABD9.3090308@a1.net \
    --to=klammerj@a1.net \
    --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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.