I also have this problem in centos.

I try it, remove "-std=gnu99" for gcc is worked.

[root@vNetCI ~]# gcc lgs.c
[root@vNetCI ~]#
[root@vNetCI ~]# gcc -std=gnu99 lgs.c
lgs.c:9:15: error: initializer element is not constant
     = (struct eth_addr) { { .ea =  { 0x00, 0x23, 0x20, 0x00, 0x00, 0x01 } } };

this is my code:

struct eth_addr {
    union {
        char ea[6];
        int be16[3];
    };
};
static const struct eth_addr eth_addr_bfd
    = (struct eth_addr) { { .ea =  { 0x00, 0x23, 0x20, 0x00, 0x00, 0x01 } } };

Hi Ben,

I faced following error while compiling OVS master on Ubuntu. I am not sure, if 
I am missing some compiler directive.

./include/openvswitch/types.h:173:41: error: initializer element is not constant
  #define ETH_ADDR_C(A,B,C,D,E,F) (struct eth_addr) \
                                          ^
lib/packets.h:179:7: note: in expansion of macro 'ETH_ADDR_C'
      = ETH_ADDR_C(ff,ff,ff,ff,ff,ff);
        ^

By removing the typecast from types.h file worked.

--old--
#define ETH_ADDR_C(A,B,C,D,E,F) (struct eth_addr) \
      { { .ea = { 0x##A, 0x##B, 0x##C, 0x##D, 0x##E, 0x##F } } }

--new--
#define ETH_ADDR_C(A,B,C,D,E,F) \
      { { .ea = { 0x##A, 0x##B, 0x##C, 0x##D, 0x##E, 0x##F } } }

Warm Regards,
Vishal

-----Original Message-----
From: [email protected] [mailto:[email protected]] 
On Behalf Of Ben Pfaff
Sent: Thursday, November 30, 2017 2:59 AM
To: Mark Michelson <[email protected]>
Cc: [email protected]
Subject: Re: [ovs-dev] [PATCH] types: New macros ETH_ADDR_C and ETH_ADDR64_C.

On Wed, Nov 29, 2017 at 08:30:07PM +0000, Mark Michelson wrote:
On Tue, Nov 28, 2017 at 5:33 PM Ben Pfaff <[email protected]> wrote:

These macros expand to constants of type struct eth_addr and struct
eth_addr64, respectively, and make it more convenient to initialize
or assign to an Ethernet address object.

Signed-off-by: Ben Pfaff <[email protected]>

Acked-by: Mark Michelson <[email protected]>
Thanks, applied to master.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to