Mentions légales du service

Skip to content

Improve handleability of __attribute__ in PLUS

LAWALL Julia requested to merge attr_decl into master

This patch improves the handleability of attribute in PLUS. The previous Coccinelle regarded attribute in PLUS as a comment and the comment was put just after an identifier without a space.

Example: $ cat /tmp/transformation.cocci @@ identifier p; type T; @@

  • T p attribute((myattr));
  • T p attribute((section(".shared")));

$ cat /tmp/file2.c char hello[30] attribute((myattr));

$ spatch -sp_file /tmp/transformation.cocci /tmp/file2.c init_defs_builtins: /root/hle/pub/coccinelle/standard.h HANDLING: /tmp/file2.c diff = --- /tmp/file2.c +++ /tmp/cocci-output-1812-cbec51-file2.c @@ -1 +1 @@ -char hello[30] attribute((myattr)); +char hello__attribute__((section(".shared")))[30];


This modification basically enables Coccinelle to handle the arrays with attribute in PLUS by regarding the arguments of attribute as an identifier (e.g. section(".shared") is an identifier).

However, since the parser for SmPL does not support the infix-style attribute like: char attribute hello;

this patch treats these style occurences of attribute specially as a comment, which is almost the same way as previously.

Signed-off-by: Keisuke Nishimura mumumu0722@gmail.com

Merge request reports