All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] EXN question
@ 2015-02-25  1:27 Stan Sieler
  2015-02-25  6:25 ` Julia Lawall
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Stan Sieler @ 2015-02-25  1:27 UTC (permalink / raw)
  To: cocci

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 ('');

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

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

end of thread, other threads:[~2015-03-04 16:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [Cocci] EXN question Julia Lawall
2015-03-04 11:48   ` [Cocci] Skipping of source code between preprocessor statements? 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

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.