* [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* [Cocci] EXN question
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
2 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2015-02-25 6:25 UTC (permalink / raw)
To: cocci
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 ('');
>
> 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"!
Coccinelle is supposed to skip what is under if 0. There has been a lot
of changes to the management of ifdefs recently, and so this flag may have
gotten inadvertently ignored. I'll look into it.
julia
> 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
>
^ permalink raw reply [flat|nested] 8+ messages in thread* [Cocci] Challenges around preprocessor statements?
2015-02-25 1:27 [Cocci] EXN question Stan Sieler
2015-02-25 6:25 ` Julia Lawall
@ 2015-02-25 8:05 ` SF Markus Elfring
2015-03-02 23:54 ` [Cocci] EXN question Julia Lawall
2 siblings, 0 replies; 8+ messages in thread
From: SF Markus Elfring @ 2015-02-25 8:05 UTC (permalink / raw)
To: cocci
> 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.
The Coccinelle software works on a different abstraction level.
There is another feature request for text skipping in the waiting queue.
https://github.com/coccinelle/coccinelle/issues/20
Are there any more use cases to consider?
Would you eventually like to adjust source code between preprocessor
statements?
Regards,
Markus
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Cocci] EXN question
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
2015-03-04 11:48 ` [Cocci] Skipping of source code between preprocessor statements? SF Markus Elfring
2 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2015-03-02 23:54 UTC (permalink / raw)
To: cocci
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
>
^ permalink raw reply [flat|nested] 8+ messages in thread* [Cocci] Skipping of source code between preprocessor statements?
2015-03-02 23:54 ` [Cocci] EXN question Julia Lawall
@ 2015-03-04 11:48 ` SF Markus Elfring
2015-03-04 12:08 ` Julia Lawall
0 siblings, 1 reply; 8+ messages in thread
From: SF Markus Elfring @ 2015-03-04 11:48 UTC (permalink / raw)
To: cocci
> Because the C lexer explicitly does parse ''
In which contexts does the syntax allow the use of single quotes
for the C programming language?
> and I tried a couple of examples and everything was fine.
How would you like to handle text within the construct "#if 0 / #endif"
by the analysis tool?
Regards,
Markus
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Cocci] Skipping of source code between preprocessor statements?
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
0 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2015-03-04 12:08 UTC (permalink / raw)
To: cocci
On Wed, 4 Mar 2015, SF Markus Elfring wrote:
> > Because the C lexer explicitly does parse ''
>
> In which contexts does the syntax allow the use of single quotes
> for the C programming language?
As far as I can tell, all.
>
>
> > and I tried a couple of examples and everything was fine.
>
> How would you like to handle text within the construct "#if 0 / #endif"
> by the analysis tool?
There is a flag for choosing whether to do this.
julia
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Cocci] Skipping of source code between preprocessor statements?
2015-03-04 12:08 ` Julia Lawall
@ 2015-03-04 13:13 ` SF Markus Elfring
2015-03-04 16:47 ` Julia Lawall
0 siblings, 1 reply; 8+ messages in thread
From: SF Markus Elfring @ 2015-03-04 13:13 UTC (permalink / raw)
To: cocci
>> In which contexts does the syntax allow the use of single quotes
>> for the C programming language?
>
> As far as I can tell, all.
Are they only valid within comments and string literals?
>> How would you like to handle text within the construct "#if 0 / #endif"
>> by the analysis tool?
>
> There is a flag for choosing whether to do this.
Do you refer to the undocumented command line parameter "noif0-passing"?
Regards,
Markus
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Cocci] Skipping of source code between preprocessor statements?
2015-03-04 13:13 ` SF Markus Elfring
@ 2015-03-04 16:47 ` Julia Lawall
0 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2015-03-04 16:47 UTC (permalink / raw)
To: cocci
On Wed, 4 Mar 2015, SF Markus Elfring wrote:
> >> In which contexts does the syntax allow the use of single quotes
> >> for the C programming language?
> >
> > As far as I can tell, all.
>
> Are they only valid within comments and string literals?
Coccinelle doesn't care if they are valid or not. Once the lexer accepts
'' as a character, no subsequent part of coccinelle should noitce.
> >> How would you like to handle text within the construct "#if 0 / #endif"
> >> by the analysis tool?
> >
> > There is a flag for choosing whether to do this.
>
> Do you refer to the undocumented command line parameter "noif0-passing"?
Undoubtedly.
julia
^ 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.