[dpdk-dev] [EXT] RE: [PATCH v3] ethdev: add tm support for shaper config in pkt mode

Dumitrescu, Cristian cristian.dumitrescu at intel.com
Wed Apr 22 14:01:38 CEST 2020


> > The softnic changes logically belong to a separate patch. I understand you
> are getting some build warnings, but it does not make sense to me. Are you
> sure there is no other way to avoid them?
> I see error only because of v3 changes in node cap. There seems to be some
> gcc
> issue with order of initializations only when next field is union. I tried both
> gcc 4.8.5 and 7.3.1
> 
> struct test {
>         int a;
>         char b;
>         int c;
>         union {
>                 int d;
>         };
> 
> };
> 
> struct test ds1 = {
>         .a = 10,
>         .b = 20,
>         {
>                 .d = 40,
>         }
> };
> 
> int main(void)
> {
>         printf("ds1.a %d\n", ds1.a);
> }
> [root at hyd1588t430 dpdk]# make a
> cc     a.c   -o a
> a.c:20:2: warning: braces around scalar initializer [enabled by default]
>   {
>   ^
> a.c:20:2: warning: (near initialization for ‘ds1.c’) [enabled by default]
> a.c:21:3: error: field name not in record or union initializer
>    .d = 40,
>    ^
> a.c:21:3: error: (near initialization for ‘ds1.c’)
> make: *** [a] Error 1
> 
> I don't see any issue if 'd' is not inside a union.
> 
> Similar issue is reported in kernel and similar fix was applied of initializing all
> the fields.
> https://patchwork.kernel.org/patch/3033041/
> 
>

Sure, I can live with softnic changes in the same patch if no other option is identified.


More information about the dev mailing list