…
> +++ 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
…
> +++ 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
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
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
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
---
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
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
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
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(+)
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
---
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
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
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
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
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
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
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
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
---
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
---
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
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
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
+++
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
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
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
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
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
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
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
---
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
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
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
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
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
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 +
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
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
---
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
---
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
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
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
---
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
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
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
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
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
46 matches
Mail list logo