Re: [Cocci] [PATCH 42/43] tests: Add test case to match meta attribute

2020-07-26 Thread Markus Elfring
… > +++ b/tests/metaattr.cocci > @@ -0,0 +1,9 @@ > +@@ > +attribute name __attr__; > +attribute a; > +identifier b; > +@@ > + > +-int > ++char > + b a = 1; I have got understanding difficulties for this test SmPL script. I interpret such SmPL code in the way that the metavariable

Re: [Cocci] [PATCH 42/43] tests: Add test case to match meta attribute

2020-07-26 Thread Markus Elfring
… > +++ b/tests/metaattr.c > @@ -0,0 +1,5 @@ > +int main() { > + int b __attr__ = 1; > + int b = 1; > + return 0; > +} * Should such test code really work with a repeated definition of the variable “b”? * Would you like to test here if the identifier “b” should be handled as an

[Cocci] [PATCH 30/43] parsing_cocci: visitor_ast: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Visit it in the SmPL AST visitor. Signed-off-by: Jaskaran Singh --- parsing_cocci/visitor_ast.ml | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/parsing_cocci/visitor_ast.ml b/parsing_cocci/visitor_ast.ml index

[Cocci] [PATCH 23/43] parsing_cocci: compute_lines: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in compute_lines.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/compute_lines.ml | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/parsing_cocci/compute_lines.ml b/parsing_cocci/compute_lines.ml

[Cocci] [PATCH 38/43] parsing_cocci: unify_ast: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in unify_ast.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/unify_ast.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/parsing_cocci/unify_ast.ml b/parsing_cocci/unify_ast.ml index 98e2ab1dd..811c91f30 100644 ---

[Cocci] [PATCH 36/43] parsing_cocci: pretty_print_cocci: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in pretty_print_cocci.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/pretty_print_cocci.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/parsing_cocci/pretty_print_cocci.ml b/parsing_cocci/pretty_print_cocci.ml index

[Cocci] [PATCH 42/43] tests: Add test case to match meta attribute

2020-07-26 Thread Jaskaran Singh
Meta attributes are added to SmPL. Add test case to match and detect a meta attribute in C code. Signed-off-by: Jaskaran Singh --- tests/metaattr.c | 5 + tests/metaattr.cocci | 9 + tests/metaattr.res | 5 + 3 files changed, 19 insertions(+) create mode 100644

[Cocci] [PATCH 40/43] engine: cocci_vs_c: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in cocci_vs_c.ml. Signed-off-by: Jaskaran Singh --- engine/cocci_vs_c.ml | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/engine/cocci_vs_c.ml b/engine/cocci_vs_c.ml index ed91a4785..0b698287d

[Cocci] [PATCH 43/43] tests: Add test case to remove a meta attribute

2020-07-26 Thread Jaskaran Singh
Meta attributes are added to SmPL. Add a test case to match and remove a meta attribute from C code. Signed-off-by: Jaskaran Singh --- tests/remove_metaattr.c | 5 + tests/remove_metaattr.cocci | 9 + tests/remove_metaattr.res | 5 + 3 files changed, 19 insertions(+)

[Cocci] [PATCH 39/43] parsing_c: unparse_cocci: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in unparse_cocci.ml. Signed-off-by: Jaskaran Singh --- parsing_c/unparse_cocci.ml | 6 ++ 1 file changed, 6 insertions(+) diff --git a/parsing_c/unparse_cocci.ml b/parsing_c/unparse_cocci.ml index e544336d0..7be18bf1c 100644 ---

[Cocci] [PATCH 32/43] parsing_cocci: free_vars: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in free_vars.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/free_vars.ml | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/parsing_cocci/free_vars.ml b/parsing_cocci/free_vars.ml

[Cocci] [PATCH 34/43] parsing_cocci: get_constants2: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in get_constants2.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/get_constants2.ml | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/parsing_cocci/get_constants2.ml b/parsing_cocci/get_constants2.ml

[Cocci] [PATCH 31/43] parsing_cocci: cleanup_rules: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in cleanup_rules.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/cleanup_rules.ml | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/parsing_cocci/cleanup_rules.ml b/parsing_cocci/cleanup_rules.ml index

[Cocci] [PATCH 41/43] tools: spgen: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in spgen. Signed-off-by: Jaskaran Singh --- tools/spgen/source/meta_variable.ml | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/spgen/source/meta_variable.ml b/tools/spgen/source/meta_variable.ml

[Cocci] [PATCH 37/43] parsing_cocci: safe_for_multi_decls: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in safe_for_multi_decls.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/safe_for_multi_decls.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/parsing_cocci/safe_for_multi_decls.ml b/parsing_cocci/safe_for_multi_decls.ml

[Cocci] [PATCH 28/43] parsing_cocci: unparse_ast0: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in unparse_ast0.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/unparse_ast0.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/parsing_cocci/unparse_ast0.ml b/parsing_cocci/unparse_ast0.ml index 875282fb0..e2556cb80 100644

[Cocci] [PATCH 33/43] parsing_cocci: get_constants: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in get_constants.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/get_constants.ml | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/parsing_cocci/get_constants.ml b/parsing_cocci/get_constants.ml index

[Cocci] [PATCH 16/43] ocaml: ocamlcocci_aux: Reflect MetaAttributeVal

2020-07-26 Thread Jaskaran Singh
MetaAttributeVal is added to the C AST. Reflect these changes in ocamlcocci_aux.ml. Signed-off-by: Jaskaran Singh --- ocaml/ocamlcocci_aux.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ocaml/ocamlcocci_aux.ml b/ocaml/ocamlcocci_aux.ml index 7ec3a964f..ccbf6858e 100644 ---

[Cocci] [PATCH 08/43] ocaml: coccilib: Reflect MetaAttribute & MetaAttributeDecl

2020-07-26 Thread Jaskaran Singh
MetaAttribute and MetaAttributeDecl are added to the SmPL AST. Reflect these changes in coccilib.mli. Signed-off-by: Jaskaran Singh --- ocaml/coccilib.mli | 4 1 file changed, 4 insertions(+) diff --git a/ocaml/coccilib.mli b/ocaml/coccilib.mli index 19f1512cd..3960d1046 100644 ---

[Cocci] [PATCH 29/43] parsing_cocci: ast0toast: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in ast0toast.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/ast0toast.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/parsing_cocci/ast0toast.ml b/parsing_cocci/ast0toast.ml index b4b7600ed..16a2ffd30

[Cocci] [PATCH 26/43] parsing_cocci: arity: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in arity.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/arity.ml | 29 +++-- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/parsing_cocci/arity.ml b/parsing_cocci/arity.ml index

[Cocci] [PATCH 10/43] parsing_c: ast_c: Add MetaAttributeVal

2020-07-26 Thread Jaskaran Singh
Add the MetaAttributeVal constructor to the C AST. Signed-off-by: Jaskaran Singh --- parsing_c/ast_c.ml | 1 + parsing_c/ast_c.mli | 1 + 2 files changed, 2 insertions(+) diff --git a/parsing_c/ast_c.ml b/parsing_c/ast_c.ml index 645f9e183..2c682fe21 100644 --- a/parsing_c/ast_c.ml +++

[Cocci] [PATCH 05/43] parsing_cocci: iso_pattern: Reflect MetaAttribute & MetaAttributeDecl

2020-07-26 Thread Jaskaran Singh
MetaAttribute and MetaAttributeDecl are added to the SmPL AST. Reflect these changes in iso_pattern.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/iso_pattern.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/parsing_cocci/iso_pattern.ml b/parsing_cocci/iso_pattern.ml index

[Cocci] [PATCH 06/43] parsing_c: unparse_hrule: Reflect MetaAttribute & MetaAttributeDecl

2020-07-26 Thread Jaskaran Singh
MetaAttribute and MetaAttributeDecl are added to the SmPL AST. Reflect these changes in unparse_hrule.ml. Signed-off-by: Jaskaran Singh --- parsing_c/unparse_hrule.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/parsing_c/unparse_hrule.ml b/parsing_c/unparse_hrule.ml index

[Cocci] [PATCH 22/43] parsing_cocci: context_neg: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in context_neg.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/context_neg.ml | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/parsing_cocci/context_neg.ml b/parsing_cocci/context_neg.ml

[Cocci] [PATCH 09/43] ocaml: yes_prepare_ocamlcocci: Reflect MetaAttribute & MetaAttributeDecl

2020-07-26 Thread Jaskaran Singh
MetaAttribute and MetaAttributeDecl are added to the SmPL AST. Reflect these changes in yes_prepare_ocamlcocci.ml. Signed-off-by: Jaskaran Singh --- ocaml/yes_prepare_ocamlcocci.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/ocaml/yes_prepare_ocamlcocci.ml

[Cocci] [PATCH 13/43] engine: pattern_c: Reflect MetaAttributeVal

2020-07-26 Thread Jaskaran Singh
MetaAttributeVal is added to the C AST. Reflect these changes in pattern_c.ml. Signed-off-by: Jaskaran Singh --- engine/pattern_c.ml | 6 ++ 1 file changed, 6 insertions(+) diff --git a/engine/pattern_c.ml b/engine/pattern_c.ml index 821a5900e..7d9a2dcc1 100644 --- a/engine/pattern_c.ml

[Cocci] [PATCH 14/43] engine: pretty_print_engine: Add MetaAttributeVal

2020-07-26 Thread Jaskaran Singh
MetaAttributeVal is added to the C AST. Reflect these changes in pretty_print_engine.ml. Signed-off-by: Jaskaran Singh --- engine/pretty_print_engine.ml | 1 + parsing_c/pretty_print_c.ml | 12 parsing_c/pretty_print_c.mli | 5 + 3 files changed, 18 insertions(+) diff

[Cocci] [PATCH 35/43] parsing_cocci: index: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in index.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/index.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/parsing_cocci/index.ml b/parsing_cocci/index.ml index cb3ac7ecd..ca54bc85d 100644 ---

[Cocci] [PATCH 07/43] parsing_cocci: pretty_print_cocci: Reflect MetaAttribute & MetaAttributeDecl

2020-07-26 Thread Jaskaran Singh
MetaAttribute and MetaAttributeDecl are added to the SmPL AST. Reflect these changes in pretty_print_cocci.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/pretty_print_cocci.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/parsing_cocci/pretty_print_cocci.ml

[Cocci] [PATCH 21/43] parsing_cocci: adjust_pragmas: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in adjust_pragmas.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/adjust_pragmas.ml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/parsing_cocci/adjust_pragmas.ml b/parsing_cocci/adjust_pragmas.ml index

[Cocci] [PATCH 19/43] parsing_cocci: visitor_ast0: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Visit meta attributes in the SmPL AST0 visitor. Signed-off-by: Jaskaran Singh --- parsing_cocci/visitor_ast0.ml | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parsing_cocci/visitor_ast0.ml b/parsing_cocci/visitor_ast0.ml index

[Cocci] [PATCH 27/43] parsing_cocci: unitary_ast0: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in unitary_ast0.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/unitary_ast0.ml | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/parsing_cocci/unitary_ast0.ml b/parsing_cocci/unitary_ast0.ml index

[Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL

2020-07-26 Thread Jaskaran Singh
This patch series aims to add support for meta attributes in SmPL. Currently, only meta attributes in context and minus code are supported. Changes include adding the MetaAttribute and MetaAttributeDecl constructors to the SmPL ASTs and the MetaAttributeVal constructor to the C AST. Two test

[Cocci] [PATCH 02/43] parsing_cocci: parser: Parse meta attributes and metaattr decls

2020-07-26 Thread Jaskaran Singh
Introduce changes to parse meta attributes and meta attribute declarations in SmPL rules. Currently, meta attributes are only parsed in context and minus code. Signed-off-by: Jaskaran Singh --- parsing_cocci/data.ml | 1 + parsing_cocci/data.mli| 1 +

[Cocci] [PATCH 04/43] parsing_cocci: ast_cocci: Add MetaAttribute & MetaAttributeDecl

2020-07-26 Thread Jaskaran Singh
Add the MetaAttribute and MetaAttributeDecl consturctors the SmPL AST. Signed-off-by: Jaskaran Singh --- parsing_cocci/ast_cocci.ml | 3 +++ parsing_cocci/ast_cocci.mli | 2 ++ 2 files changed, 5 insertions(+) diff --git a/parsing_cocci/ast_cocci.ml b/parsing_cocci/ast_cocci.ml index

[Cocci] [PATCH 11/43] parsing_c: unparse_hrule: Reflect MetaAttributeVal

2020-07-26 Thread Jaskaran Singh
MetaAttributeVal is added to the C AST. Reflect these changes in unparse_hrule.ml. Signed-off-by: Jaskaran Singh --- parsing_c/unparse_hrule.ml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/parsing_c/unparse_hrule.ml b/parsing_c/unparse_hrule.ml index 4d7ba93cc..9d6421f31 100644 ---

[Cocci] [PATCH 18/43] python: pycocci_aux: Reflect MetaAttributeVal

2020-07-26 Thread Jaskaran Singh
MetaAttributeVal is added to the C AST. Reflect these changes in pycocci_aux.ml. Signed-off-by: Jaskaran Singh --- python/pycocci_aux.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/pycocci_aux.ml b/python/pycocci_aux.ml index d83059455..85a8eefe3 100644 ---

[Cocci] [PATCH 12/43] engine: cocci_vs_c: Reflect MetaAttributeVal

2020-07-26 Thread Jaskaran Singh
MetaAttributeVal is added to the C AST. Reflect these changes in cocci_vs_c.ml. Signed-off-by: Jaskaran Singh --- engine/cocci_vs_c.ml| 8 ++-- parsing_c/lib_parsing_c.ml | 3 +++ parsing_c/lib_parsing_c.mli | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git

[Cocci] [PATCH 20/43] parsing_cocci: check_meta: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in check_meta.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/check_meta.ml | 27 +++ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/parsing_cocci/check_meta.ml

[Cocci] [PATCH 17/43] ocaml: run_ocamlcocci: Reflect MetaAttributeVal

2020-07-26 Thread Jaskaran Singh
MetaAttributeVal is added to the C AST. Reflect these changes in run_ocamlcocci.ml. Signed-off-by: Jaskaran Singh --- ocaml/run_ocamlcocci.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/ocaml/run_ocamlcocci.ml b/ocaml/run_ocamlcocci.ml index 065428391..14decf886 100644 ---

[Cocci] [PATCH 15/43] ocaml: coccilib: Reflect MetaAttributeVal

2020-07-26 Thread Jaskaran Singh
MetaAttributeVal is added to the C AST. Reflect these changes in coccilib.ml and coccilib.mli. Signed-off-by: Jaskaran Singh --- ocaml/coccilib.ml | 1 + ocaml/coccilib.mli | 3 +++ 2 files changed, 4 insertions(+) diff --git a/ocaml/coccilib.ml b/ocaml/coccilib.ml index 0a7e0eb98..459f4c6be

[Cocci] [PATCH 24/43] parsing_cocci: iso_pattern: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in iso_pattern.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/iso_pattern.ml | 44 +++- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/parsing_cocci/iso_pattern.ml

[Cocci] [PATCH 03/43] parsing_cocci: parse_cocci: Reflect MetaAttribute & MetaAttributeDecl

2020-07-26 Thread Jaskaran Singh
MetaAttribute and MetaAttributeDecl are added to the SmPL AST. Reflect these changes in parse_cocci.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/parse_cocci.ml | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/parsing_cocci/parse_cocci.ml

[Cocci] [PATCH 25/43] parsing_cocci: function_prototypes: Reflect MetaAttribute

2020-07-26 Thread Jaskaran Singh
MetaAttribute is added to the SmPL AST. Reflect these changes in function_prototypes.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/function_prototypes.ml | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/parsing_cocci/function_prototypes.ml

[Cocci] [PATCH 01/43] parsing_cocci: ast0_cocci: Add MetaAttribute & MetaAttributeDecl

2020-07-26 Thread Jaskaran Singh
Add the MetaAttribute and MetaAttributeDecl variants to AST0 of SmPL. Signed-off-by: Jaskaran Singh --- parsing_cocci/ast0_cocci.ml | 1 + parsing_cocci/ast0_cocci.mli | 1 + 2 files changed, 2 insertions(+) diff --git a/parsing_cocci/ast0_cocci.ml b/parsing_cocci/ast0_cocci.ml index