public inbox for cocci@systeme.lip6.fr
 help / color / mirror / Atom feed
From: itismohit@gmail.com (Mohit Gupta)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Mysterious parsing issue.
Date: Wed, 17 Oct 2012 17:33:17 +0000 (UTC)	[thread overview]
Message-ID: <loom.20121017T191721-59@post.gmane.org> (raw)

Hi,

I am trying to parse this c file containing macros. ( C file and the macro file
is pasted below.)  This parses fine, if I uncomment the first line "STATIC int
abc;" 

If I uncomment the line but change the order so as to make the first line as "
INT funcf ARGS((char *));" . Then again it gives parsing issues.

Is the parsing supposed to be dependent on order of statements or preclusion of
another statement ? Are we looking at a potential bug ?

Kindly help. 

Thanks,Mohit

Command : spatch --parse-c simple.c --macro-file simple_macro

// simple.c :

//STATIC int abc;

INT funcf ARGS((char *));

char *g ARGS((char *));

INT funcf (char *c)
{
        return 1;
}

char *g (char *c)
{
        return "junk";
}


//end of simple.c

//simple_macro
#define ARGS(m)   m

#define STATIC static

#define INT int
//end of simple_macro


//parsing error :

(ONCE) CPP-MACRO: found known macro = INT
(ONCE) CPP-MACRO: found known macro = ARGS
TYPEDEF:_handle_typedef=false. Not normal if dont come from exn
ERROR-RECOV: found sync col 0 at line 7
parsing pass4: try again
TYPEDEF:_handle_typedef=false. Not normal if dont come from exn
ERROR-RECOV: found sync col 0 at line 7
semantic error two or more data types: t ((((0, 2)))) ii [((("INT", 21, 5, 0,
"simple.c")), (0), ((0, 0, 0, 0)))]
typeD Tag8 ((["funcf"; ((("funcf", 25, 5, 4, "simple.c")), (0), ((0, 0, 0,
0)))]), 0) ii2 0

 =File "simple.c", line 5, column 15,  charpos = 36
    around = '(', whole content = INT funcf ARGS((char *));

             reply	other threads:[~2012-10-17 17:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-17 17:33 Mohit Gupta [this message]
2012-10-18  7:19 ` [Cocci] Mysterious parsing issue Julia Lawall
  -- strict thread matches above, loose matches on Subject: below --
2012-10-22 15:51 Christian Clausen

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=loom.20121017T191721-59@post.gmane.org \
    --to=itismohit@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox