Skip to contentSkip to conversation

Adding code after function return types with SmPL

Cocci Markus Elfring 1 participant 1 message Oct 7, 2019

lore
Share & tools
lore
#0 lore raw

Hello,

I would like to try the following transformation approach out with the software combination “Coccinelle 1.0.8-00004-g842075f7”.

@addition@
identifier f;
type rt != void;
@@
rt
+__must_check
f(...);

elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci use_must_check.cocci
init_defs_builtins: /usr/local/bin/../lib/coccinelle/standard.h
plus: parse error:
File "use_must_check.cocci", line 7, column 1, charpos = 64
around = 'f',
whole content = f(...);

@is_void@
identifier f;
position p;
@@
void f@p(...);

@addition@
identifier f;
position p != is_void.p;
type rt;
@@
rt
+__must_check
f@p(...);

elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci use_must_check2.cocci
init_defs_builtins: /usr/local/bin/../lib/coccinelle/standard.h
plus: parse error:
File "use_must_check2.cocci", line 14, column 1, charpos = 137
around = 'f',
whole content = f@p(...);

Will the addition of such an annotation in a function declaration become supported for the semantic patch language?

Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci