diff mbox series

[2/4] radix tree test suite: Add __must_be_array() support

Message ID 20210512184850.3526677-2-Liam.Howlett@Oracle.com (mailing list archive)
State New, archived
Headers show
Series [1/4] radix tree test suite: Add support for fallthrough attribute | expand

Commit Message

Liam R. Howlett May 12, 2021, 6:48 p.m. UTC
Copy __must_be_array() define from include/linux/compiler.h for use in
the radix tree test suite userspace compiles.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
---
 tools/testing/radix-tree/linux/kernel.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Matthew Wilcox May 12, 2021, 9:46 p.m. UTC | #1
On Wed, May 12, 2021 at 06:48:52PM +0000, Liam Howlett wrote:
> Copy __must_be_array() define from include/linux/compiler.h for use in
> the radix tree test suite userspace compiles.

We needed this earlier, but see commit
7487de534dcbe143e6f41da751dd3ffcf93b00ee

I bet if you revert this commit, it'll still build fine.

Also, I bet patch 1/4 is the same -- I see a definition of
fallthrough in tools/include/linux/compiler-gcc.h

> Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
> ---
>  tools/testing/radix-tree/linux/kernel.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/testing/radix-tree/linux/kernel.h b/tools/testing/radix-tree/linux/kernel.h
> index c400a27e544a..2c3771fff2c0 100644
> --- a/tools/testing/radix-tree/linux/kernel.h
> +++ b/tools/testing/radix-tree/linux/kernel.h
> @@ -30,4 +30,6 @@
>  # define fallthrough                    do {} while (0)  /* fallthrough */
>  #endif /* __has_attribute */
>  
> +#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
> +
>  #endif /* _KERNEL_H */
> -- 
> 2.30.2
Liam R. Howlett May 12, 2021, 10:13 p.m. UTC | #2
* Matthew Wilcox <willy@infradead.org> [210512 17:48]:
> On Wed, May 12, 2021 at 06:48:52PM +0000, Liam Howlett wrote:
> > Copy __must_be_array() define from include/linux/compiler.h for use in
> > the radix tree test suite userspace compiles.
> 
> We needed this earlier, but see commit
> 7487de534dcbe143e6f41da751dd3ffcf93b00ee
> 
> I bet if you revert this commit, it'll still build fine.
> 
> Also, I bet patch 1/4 is the same -- I see a definition of
> fallthrough in tools/include/linux/compiler-gcc.h

You are correct.  Please disregard patch 1 and 2.

Thanks,
Liam

> 
> > Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
> > ---
> >  tools/testing/radix-tree/linux/kernel.h | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/tools/testing/radix-tree/linux/kernel.h b/tools/testing/radix-tree/linux/kernel.h
> > index c400a27e544a..2c3771fff2c0 100644
> > --- a/tools/testing/radix-tree/linux/kernel.h
> > +++ b/tools/testing/radix-tree/linux/kernel.h
> > @@ -30,4 +30,6 @@
> >  # define fallthrough                    do {} while (0)  /* fallthrough */
> >  #endif /* __has_attribute */
> >  
> > +#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
> > +
> >  #endif /* _KERNEL_H */
> > -- 
> > 2.30.2
diff mbox series

Patch

diff --git a/tools/testing/radix-tree/linux/kernel.h b/tools/testing/radix-tree/linux/kernel.h
index c400a27e544a..2c3771fff2c0 100644
--- a/tools/testing/radix-tree/linux/kernel.h
+++ b/tools/testing/radix-tree/linux/kernel.h
@@ -30,4 +30,6 @@ 
 # define fallthrough                    do {} while (0)  /* fallthrough */
 #endif /* __has_attribute */
 
+#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
+
 #endif /* _KERNEL_H */