Em Thu, 28 Sep 2017 18:28:32 +0200
Markus Heiser <markus.hei...@darmarit.de> escreveu:

> Hi Mauro,
> 
> > Am 27.09.2017 um 23:10 schrieb Mauro Carvalho Chehab 
> > <mche...@s-opensource.com>:

> > +It is possible to document nested structs unions, like::
> > +
> > +      /**
> > +       * struct nested_foobar - a struct with nested unions and structs
> > +       * @arg1: - first argument of anonymous union/anonymous struct
> > +       * @arg2: - second argument of anonymous union/anonymous struct
> > +       * @arg3: - third argument of anonymous union/anonymous struct
> > +       * @arg4: - fourth argument of anonymous union/anonymous struct
> > +       * @bar.st1.arg1 - first argument of struct st1 on union bar
> > +       * @bar.st1.arg2 - second argument of struct st1 on union bar
> > +       * @bar.st2.arg1 - first argument of struct st2 on union bar
> > +       * @bar.st2.arg2 - second argument of struct st2 on union bar  
> 
> Sorry, this example is totally broken --> below I attached a more
> elaborate example. 
> 
> /* parse-SNIP: my_struct */
> /**
> * struct my_struct - a struct with nested unions and structs
> * @arg1: first argument of anonymous union/anonymous struct
> * @arg2: second argument of anonymous union/anonymous struct
> * @arg3: third argument of anonymous union/anonymous struct
> * @arg4: fourth argument of anonymous union/anonymous struct
> * @bar.st1.arg1: first argument of struct st1 on union bar
> * @bar.st1.arg2: second argument of struct st1 on union bar
> * @bar.st2.arg1: first argument of struct st2 on union bar
> * @bar.st2.arg2: second argument of struct st2 on union bar
> * @bar.st3.arg2: second argument of struct st3 on union bar
> */
> struct my_struct {
>    /* Anonymous union/struct*/
>    union {
>       struct {
>           __u8 arg1 : 1;
>           __u8 arg2 : 3;
>       };
>        struct {
>            int arg1;
>            int arg2;
>        };

I added a:

        #define __u8 char

In order to compile the above. As reported by gcc 7, this is broken:

test2.h:22:16: error: duplicate member ‘arg1’
            int arg1;
                ^~~~
test2.h:23:16: error: duplicate member ‘arg2’
            int arg2;
                ^~~~

You can't have two symbols with the same name on different anonymous
structs.


Thanks,
Mauro

Reply via email to