[dpdk-dev] examples/eventdev: fix build with GCC < 5

Message ID 20180121222135.26160-1-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Thomas Monjalon Jan. 21, 2018, 10:21 p.m. UTC
  Some errors were seen with GCC 4.8 and 4.9.
It looks to be a bug fixed in GCC 5.

examples/eventdev_pipeline/pipeline_worker_generic.c:474:4: error:
missing initializer for field 'queue_id' of 'struct <anonymous>'

examples/eventdev_pipeline/pipeline_worker_generic.c:475:3: error:
missing initializer for field 'priority' of 'struct <anonymous>'

examples/eventdev_pipeline/pipeline_worker_tx.c:630:2: error:
missing initializer for field 'queue_id' of 'struct <anonymous>'

The workaround is to not use initializer statement,
but to use memset and standard assignment.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 examples/eventdev_pipeline/pipeline_worker_generic.c | 8 ++++----
 examples/eventdev_pipeline/pipeline_worker_tx.c      | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)
  

Comments

Thomas Monjalon Jan. 21, 2018, 10:32 p.m. UTC | #1
Forgot the Fixes: tags,

21/01/2018 23:21, Thomas Monjalon:
> Some errors were seen with GCC 4.8 and 4.9.
> It looks to be a bug fixed in GCC 5.
> 
> examples/eventdev_pipeline/pipeline_worker_generic.c:474:4: error:
> missing initializer for field 'queue_id' of 'struct <anonymous>'
> 
> examples/eventdev_pipeline/pipeline_worker_generic.c:475:3: error:
> missing initializer for field 'priority' of 'struct <anonymous>'
> 
> examples/eventdev_pipeline/pipeline_worker_tx.c:630:2: error:
> missing initializer for field 'queue_id' of 'struct <anonymous>'
> 
> The workaround is to not use initializer statement,
> but to use memset and standard assignment.

Fixes: 84dde5de10a2 ("examples/eventdev: support Rx adapter")
Fixes: fa8054c8c889 ("examples/eventdev: add thread safe Tx worker pipeline")
 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
  
Ferruh Yigit Jan. 21, 2018, 10:40 p.m. UTC | #2
On 1/21/2018 10:32 PM, Thomas Monjalon wrote:
> Forgot the Fixes: tags,
> 
> 21/01/2018 23:21, Thomas Monjalon:
>> Some errors were seen with GCC 4.8 and 4.9.
>> It looks to be a bug fixed in GCC 5.
>>
>> examples/eventdev_pipeline/pipeline_worker_generic.c:474:4: error:
>> missing initializer for field 'queue_id' of 'struct <anonymous>'
>>
>> examples/eventdev_pipeline/pipeline_worker_generic.c:475:3: error:
>> missing initializer for field 'priority' of 'struct <anonymous>'
>>
>> examples/eventdev_pipeline/pipeline_worker_tx.c:630:2: error:
>> missing initializer for field 'queue_id' of 'struct <anonymous>'
>>
>> The workaround is to not use initializer statement,
>> but to use memset and standard assignment.
> 
> Fixes: 84dde5de10a2 ("examples/eventdev: support Rx adapter")
> Fixes: fa8054c8c889 ("examples/eventdev: add thread safe Tx worker pipeline")
>  
>> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
  
Thomas Monjalon Jan. 21, 2018, 10:41 p.m. UTC | #3
21/01/2018 23:40, Ferruh Yigit:
> On 1/21/2018 10:32 PM, Thomas Monjalon wrote:
> > Forgot the Fixes: tags,
> > 
> > 21/01/2018 23:21, Thomas Monjalon:
> >> Some errors were seen with GCC 4.8 and 4.9.
> >> It looks to be a bug fixed in GCC 5.
> >>
> >> examples/eventdev_pipeline/pipeline_worker_generic.c:474:4: error:
> >> missing initializer for field 'queue_id' of 'struct <anonymous>'
> >>
> >> examples/eventdev_pipeline/pipeline_worker_generic.c:475:3: error:
> >> missing initializer for field 'priority' of 'struct <anonymous>'
> >>
> >> examples/eventdev_pipeline/pipeline_worker_tx.c:630:2: error:
> >> missing initializer for field 'queue_id' of 'struct <anonymous>'
> >>
> >> The workaround is to not use initializer statement,
> >> but to use memset and standard assignment.
> > 
> > Fixes: 84dde5de10a2 ("examples/eventdev: support Rx adapter")
> > Fixes: fa8054c8c889 ("examples/eventdev: add thread safe Tx worker pipeline")
> >  
> >> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied
  

Patch

diff --git a/examples/eventdev_pipeline/pipeline_worker_generic.c b/examples/eventdev_pipeline/pipeline_worker_generic.c
index 2c51f4a30..c673160f5 100644
--- a/examples/eventdev_pipeline/pipeline_worker_generic.c
+++ b/examples/eventdev_pipeline/pipeline_worker_generic.c
@@ -468,10 +468,10 @@  init_rx_adapter(uint16_t nb_ports)
 		rte_exit(EXIT_FAILURE, "failed to create rx adapter[%d]",
 				cdata.rx_adapter_id);
 
-	struct rte_event_eth_rx_adapter_queue_conf queue_conf = {
-		.ev.sched_type = cdata.queue_type,
-		.ev.queue_id = cdata.qid[0],
-	};
+	struct rte_event_eth_rx_adapter_queue_conf queue_conf;
+	memset(&queue_conf, 0, sizeof(queue_conf));
+	queue_conf.ev.sched_type = cdata.queue_type;
+	queue_conf.ev.queue_id = cdata.qid[0];
 
 	for (i = 0; i < nb_ports; i++) {
 		uint32_t cap;
diff --git a/examples/eventdev_pipeline/pipeline_worker_tx.c b/examples/eventdev_pipeline/pipeline_worker_tx.c
index c0d1bd9fb..b254b03f7 100644
--- a/examples/eventdev_pipeline/pipeline_worker_tx.c
+++ b/examples/eventdev_pipeline/pipeline_worker_tx.c
@@ -625,9 +625,9 @@  init_rx_adapter(uint16_t nb_ports)
 		rx_p_conf.enqueue_depth = dev_info.max_event_port_enqueue_depth;
 
 
-	struct rte_event_eth_rx_adapter_queue_conf queue_conf = {
-		.ev.sched_type = cdata.queue_type,
-	};
+	struct rte_event_eth_rx_adapter_queue_conf queue_conf;
+	memset(&queue_conf, 0, sizeof(queue_conf));
+	queue_conf.ev.sched_type = cdata.queue_type;
 
 	for (i = 0; i < nb_ports; i++) {
 		uint32_t cap;