To be direct: please switch to a supported compiler. Making a large number of 
trivial changes to accommodate gcc-4 is the tip of the iceberg.

After that, you’ll notice that certain files take minutes to compile, and that 
the object code isn’t the best, either.

D.

From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of xyxue
Sent: Thursday, May 3, 2018 10:53 PM
To: vpp-dev <vpp-dev@lists.fd.io>
Subject: [vpp-dev] gcc version 4.3.3 use, compile error appear

Hi guys,

There is a union in fib_prefix_t but without a name, and the use of the union 
in 'add_port_range_adjacency' is shown below:
     union {
          ip46_address_t fp_addr;
          struct {
                     mpls_label_t fp_label;
                     mpls_eos_bit_t fp_eos;
                     dpo_proto_t fp_payload_proto;
           };

     fib_prefix_t pfx =
     {
        .fp_proto = FIB_PROTOCOL_IP4,
        .fp_len = length,
        .fp_addr =
        {
            .ip4 = *address,
        },
    };
When we use the gcc(version 4.3.3). There is some error info:
/home/vpp/build-data/../src/vnet/ip/ip4_source_and_port_range_check.c: In 
function 'add_port_range_adjacency':
/home/vpp/build-data/../src/vnet/ip/ip4_source_and_port_range_check.c:935: 
error: unknown field 'fp_addr' specified in initializer
/home/vpp/build-data/../src/vnet/ip/ip4_source_and_port_range_check.c:935: 
warning: braces around scalar initializer
/home/vpp/build-data/../src/vnet/ip/ip4_source_and_port_range_check.c:935: 
warning: (near initialization for 'pfx.fp_proto')
/home/vpp/build-data/../src/vnet/ip/ip4_source_and_port_range_check.c:936: 
error: field name not in record or union initializer
/home/vpp/build-data/../src/vnet/ip/ip4_source_and_port_range_check.c:936: 
error: (near initialization for 'pfx.fp_proto')
/home/vpp/build-data/../src/vnet/ip/ip4_source_and_port_range_check.c:936: 
error: incompatible types in initialization

We fix this problem by the method below,but it seems not a good method , 
because there are too many similar definitions in VPP.
Do you have any suggestion to solve it without updating the gcc version?

 fib_prefix_t pfx;
    memset(&pfx,0,sizeof(fib_prefix_t));
    pfx.fp_proto = FIB_PROTOCOL_IP4;
    pfx.fp_len = length;
    pfx.fp_addr.ip4 = *address;


Thanks,
Xyxue
________________________________

Reply via email to