[dpdk-dev] Clang reporting a problem when adding another member initialization.

Wiles, Roger Keith keith.wiles at windriver.com
Fri Oct 3 23:05:36 CEST 2014


I run into a problem with Clang report problem when I tried to add another member to the static initializer of the following in file ixgbe_rxtx_vec.c

int
ixgbe_rxq_vec_setup(struct igb_rx_queue *rxq)
{
	static struct rte_mbuf mb_def = {
		.nb_segs = 1,
		.data_off = RTE_PKTMBUF_HEADROOM,
		.reserved2 = 0x5555,
#ifdef RTE_MBUF_REFCNT
		{ .refcnt = 1, }
#endif
	};

== Build lib/librte_pmd_ixgbe
  CC ixgbe_rxtx_vec.o
/home/keithw/projects/dpdk-code/dpdk/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c:739:5: error: designator in initializer for scalar type 'uint16_t' (aka 'unsigned short')
                { .refcnt = 1, }
                  ^~~~~~~~~~~
1 error generated.

I moved the ‘,’ in the { } to outside and still the same problem.

int
ixgbe_rxq_vec_setup(struct igb_rx_queue *rxq)
{
	static struct rte_mbuf mb_def = {
		.nb_segs = 1,
		.data_off = RTE_PKTMBUF_HEADROOM,
		.reserverd2 = (uint16_t)0x5555,
#ifdef RTE_MBUF_REFCNT
		{ .refcnt = 1 },
#endif
	};

== Build lib/librte_pmd_ixgbe
  CC ixgbe_rxtx_vec.o
/home/keithw/projects/dpdk-code/dpdk/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c:739:5: error: designator in initializer for scalar type 'uint16_t' (aka 'unsigned short')
                { .refcnt = 1 },
                  ^~~~~~~~~~~
1 error generated.

Without adding the ‘.reserved2 = 0x5555,’ it builds.

int
ixgbe_rxq_vec_setup(struct igb_rx_queue *rxq)
{
	static struct rte_mbuf mb_def = {
		.nb_segs = 1,
		.data_off = RTE_PKTMBUF_HEADROOM,
		.reserverd2 = (uint16_t)0x5555,
#ifdef RTE_MBUF_REFCNT
		.refcnt = 1,
#endif
	};

Then I removed the {} and it now builds. Is this a result of the changes to the mbuf structure and Clang being picky?

Should I submit a patch to remove the ‘{ }’ values?

Keith Wiles, Principal Technologist with CTO office, Wind River mobile 972-213-5533



More information about the dev mailing list