Skip to contentSkip to conversation

Removing pointer declaration

Cocci Wolfram Sang 3 participants 5 messages Jun 8, 2013 – Jun 10, 2013

lore
Share & tools
lore
#0 lore raw

Hi,

This spatch:

@@
int *p;
@@

- int *p;

with this code:

int main()

{
	int *a;

	return 0;
}

results in:

Fatal error: exception Failure("minus: parse error:
= File "test.cocci", line 5, column 7, charpos = 22

    around = 'p', whole content = -	int *p;

")

using:

spatch version 1.0.0-rc15 with Python support and with PCRE support (although dpkg says it is rc16)

Am I doing something wrong?

Thanks,

Wolfram
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20130608/353b5d59/attachment.asc>

#1 lore raw
Quoted 6 lines · Wolfram Sang

Hi,

This spatch:

@@
int *p;

This should be "identifier p".

julia

Quoted 32 lines

@@

(quoted diff) +0 -1
-	int *p;

with this code:

int main()

{
	int *a;

	return 0;
}

results in:

Fatal error: exception Failure("minus: parse error:
= File "test.cocci", line 5, column 7, charpos = 22

    around = 'p', whole content = -	int *p;

")

using:

spatch version 1.0.0-rc15 with Python support and with PCRE support (although dpkg says it is rc16)

Am I doing something wrong?

Thanks,

Wolfram

#2 lore raw

Hi Julia,

Quoted 10 lines · Julia Lawall
Quoted 6 lines · Wolfram Sang

Hi,

This spatch:

@@
int *p;

This should be "identifier p".

I noticed meanwhile. Is it because the type cannot be checked because the pointer has not been declared yet? And, in general, can I get some more info about what went wrong besides "parse error" somehow? --debug didn't help.

Thanks!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20130608/837973f5/attachment.asc>

#3 lore raw
Quoted 12 lines · Wolfram Sang

Hi Julia,

Quoted 9 lines · Julia Lawall
Quoted 6 lines · Wolfram Sang

Hi,

This spatch:

@@
int *p;

Quoted 6 lines
Quoted 1 line

This should be "identifier p".

I noticed meanwhile. Is it because the type cannot be checked because the pointer has not been declared yet? And, in general, can I get some more info about what went wrong besides "parse error" somehow? --debug didn't help.

It is an identifier because it is a name. Not an int like 32.

Unfortunately, it is hard to get a yacc-like parser to generate helpful error messages. The code that one writes doesn't know about the context that it is in.

julia

#4 lore raw
In reply to Wolfram Sang
Quoted 4 lines · Wolfram Sang

using:

spatch version 1.0.0-rc15 with Python support and with PCRE support (although dpkg says it is rc16)

Yeah, coccinelle rc17 reports as version 1.0.0-rc15 too.

bye
michael