>> Will the addition of such an annotation in a function declaration
>> become supported for the semantic patch language?
>
> Perhaps some day.

The desired modification for a known preprocessor symbol like “__must_check”
points software development challenges out.

But the following SmPL script variant gets accepted.

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


Can further improvements become easier also for another transformation approach?

@replacement@
@@
-__attribute__ ((warn_unused_result))
+__must_check


elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci 
use_must_check5.cocci
init_defs_builtins: /usr/local/bin/../lib/coccinelle/standard.h
File "use_must_check5.cocci", line 3, column 1, charpos = 18
  around = '__attribute__',
  whole content = -__attribute__ ((warn_unused_result))


Would any additional error information be helpful here?

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

Reply via email to