On Mon, 27 Apr 2020, Jaskaran Singh wrote:

> Add a test case for removing Parameter attributes. The test case checks
> correct removal of the attribute when it is:
>
> - before the parameter type.
> - after the parameter type and before the parameter identifier.
> - after the parameter identifier.
>
> Signed-off-by: Jaskaran Singh <[email protected]>
> ---
>  tests/remove_param_attrs.c     | 11 +++++++++++
>  tests/remove_param_attrs.cocci | 13 +++++++++++++
>  tests/remove_param_attrs.res   | 11 +++++++++++
>  3 files changed, 35 insertions(+)
>  create mode 100644 tests/remove_param_attrs.c
>  create mode 100644 tests/remove_param_attrs.cocci
>  create mode 100644 tests/remove_param_attrs.res
>
> diff --git a/tests/remove_param_attrs.c b/tests/remove_param_attrs.c
> new file mode 100644
> index 00000000..8ec1ffde
> --- /dev/null
> +++ b/tests/remove_param_attrs.c
> @@ -0,0 +1,11 @@
> +int func1(int x, __nocast int y) {
> +     return 0;
> +}
> +
> +int func2(int x, int __nocast y) {
> +     return 0;
> +}
> +
> +int func3(int x, int y __nocast) {
> +     return 0;
> +}
> diff --git a/tests/remove_param_attrs.cocci b/tests/remove_param_attrs.cocci
> new file mode 100644
> index 00000000..43f5a204
> --- /dev/null
> +++ b/tests/remove_param_attrs.cocci
> @@ -0,0 +1,13 @@
> +@@
> +type T,U;
> +attribute name __nocast;
> +identifier x,y;
> +@@
> +
> +T x(
> +    ...,
> +    U y
> +-    __nocast

So the idea is that the attribute is removed no matter where it occurs?

julia

> +    ,
> +    ...
> +  ) {...}
> diff --git a/tests/remove_param_attrs.res b/tests/remove_param_attrs.res
> new file mode 100644
> index 00000000..3705e814
> --- /dev/null
> +++ b/tests/remove_param_attrs.res
> @@ -0,0 +1,11 @@
> +int func1(int x, int y) {
> +     return 0;
> +}
> +
> +int func2(int x, int y) {
> +     return 0;
> +}
> +
> +int func3(int x, int y) {
> +     return 0;
> +}
> --
> 2.21.1
>
>
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to