Coccinelle Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: julia.lawall@lip6.fr (Julia Lawall)
To: cocci@systeme.lip6.fr
Subject: [Cocci] EXN question
Date: Mon, 2 Mar 2015 17:54:11 -0600 (CST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1503021753060.2763@hadrien> (raw)
In-Reply-To: <F3E7ABF7-5E64-4AEF-B9CF-AE8CA0CE458B@allegro.com>

On Tue, 24 Feb 2015, Stan Sieler wrote:

> Hi,
>
> I'm new to coccinelle.  I've just run spatch over about 300,000 lines of compiling C programs.
> and was curious what the following meant:
>
>    ...
>    HANDLING: ./misc/pasnet.c
>    EXN:Failure("lexing: empty token")
>    ...
>
> I did a binary search exercise :) ... and got the error down to one line:
>
>    foo ('');

Hello,

If you still have it, could you send me a program that produces the
problem?  Because the C lexer explicitly does parse '' and I tried a
couple of examples and everything was fine.

julia

> where foo was not declared (and had not been used earlier).
>
> So, why was this code in there?  (I.e., how could it compile in C?)
>
> Because it was within "#if 0 / #endif"!
>
> It was Pascal code that was still to be translated to C.
> Thus, it was "commented out" (not actually a comment, of course, but similar effect).
>
> We were quite surprised that spatch / coccinelle isn't ignoring stuff
> (I won't say "code", because it's often non-code English text)
> within "#if 0 / #endif" blocks, and feel this is a design flaw.
>
> (BTW, I'm not referring to a macro that happens to evaluate to 0 ...
> it's the five characters "#", "i", "f", " ", "0")
>
> So far, I've only tested for the "!E & C" case, and it caught none (until I injected one as a test ... it properly caught that).
>
> thanks,
>
> Stan Sieler
> sieler at allegro.com
>
> _______________________________________________
> Cocci mailing list
> Cocci at systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>

  parent reply	other threads:[~2015-03-02 23:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-25  1:27 [Cocci] EXN question Stan Sieler
2015-02-25  6:25 ` Julia Lawall
2015-02-25  8:05 ` [Cocci] Challenges around preprocessor statements? SF Markus Elfring
2015-03-02 23:54 ` Julia Lawall [this message]
2015-03-04 11:48   ` [Cocci] Skipping of source code between " SF Markus Elfring
2015-03-04 12:08     ` Julia Lawall
2015-03-04 13:13       ` SF Markus Elfring
2015-03-04 16:47         ` Julia Lawall

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=alpine.DEB.2.10.1503021753060.2763@hadrien \
    --to=julia.lawall@lip6.fr \
    --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