[PATCH 04/64] stddef: Introduce struct_group() helper macro

Rasmus Villemoes linux at rasmusvillemoes.dk
Sat Jul 31 05:24:44 UTC 2021


On Sat, Jul 31, 2021, 04:59 Kees Cook <keescook at chromium.org> wrote:

> On Fri, Jul 30, 2021 at 10:19:20PM +0000, Williams, Dan J wrote:
> > On Wed, 2021-07-28 at 14:59 -0700, Kees Cook wrote:
>
> >  /**
> >   * struct_group(NAME, MEMBERS)
> >   *
> > @@ -67,7 +73,10 @@ enum {
> >   * @NAME: The name of the mirrored sub-struct
> >   * @MEMBERS: The member declarations for the mirrored structs
> >   */
> > -#define struct_group(NAME, MEMBERS)    \
> > +#define struct_group(NAME, MEMBERS...) \
> >         struct_group_attr(NAME, /* no attrs */, MEMBERS)
> >
> > +#define struct_group_typed(TYPE, NAME, MEMBERS...) \
> > +       struct_group_attr_typed(TYPE, NAME, /* no attrs */, MEMBERS)
> > +
> >  #endif
>
> Awesome! My instinct is to expose the resulting API as:
>
> __struct_group(type, name, attrs, members...)
>
> struct_group(name, members...)
> struct_group_attr(name, attrs, members...)
> struct_group_typed(type, name, members...)
>

Bikeshed: can we use proper nomenclature please. s/type/tag/,
s/typed/tagged.

Rasmus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20210731/7a5ace44/attachment-0001.htm>


More information about the dri-devel mailing list