[Linux-kernel-mentees] [PATCH 22/23] tests: Add test case for removing parameter attributes
Jaskaran Singh
jaskaransingh7654321 at gmail.com
Tue Apr 28 12:43:39 UTC 2020
On Mon, 2020-04-27 at 19:31 +0200, Julia Lawall wrote:
>
> 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 <jaskaransingh7654321 at gmail.com>
> > ---
> > 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?
>
Yes, if the attribute occurs in the parameter.
Cheers,
Jaskaran.
> 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
> >
> >
More information about the Linux-kernel-mentees
mailing list