[dpdk-dev] test: fix incorrect cast in pipeline unit test

Message ID 20180510073815.76926-1-david.hunt@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

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

Commit Message

Hunt, David May 10, 2018, 7:38 a.m. UTC
  New warning with gcc 8.1:
The table_action_stub_miss() function was incorrectly
declared as returning a typedef of
rte_pipeline_table_action_handler_miss, instead of what it
should have been, an int.
Changed this to declare the function as returning an int, and
now when the action_handler_miss is set to table_action_stub_miss
(cast as rte_pipeline_table_action_handler_miss), gcc 8.1 no
longer complains about the cast.

Fixes: 5205954791cb ("app/test: packet framework unit tests")

Signed-off-by: David Hunt <david.hunt@intel.com>
---
 test/test/test_table_pipeline.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Pattan, Reshma May 10, 2018, 3:25 p.m. UTC | #1
Hi,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of David Hunt
> Sent: Thursday, May 10, 2018 8:38 AM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Hunt, David
> <david.hunt@intel.com>
> Subject: [dpdk-dev] [PATCH] test: fix incorrect cast in pipeline unit test
> 
> New warning with gcc 8.1:
> The table_action_stub_miss() function was incorrectly declared as returning a
> typedef of rte_pipeline_table_action_handler_miss, instead of what it should
> have been, an int.
> Changed this to declare the function as returning an int, and now when the
> action_handler_miss is set to table_action_stub_miss (cast as
> rte_pipeline_table_action_handler_miss), gcc 8.1 no longer complains about
> the cast.
> 
> Fixes: 5205954791cb ("app/test: packet framework unit tests")
> 
> Signed-off-by: David Hunt <david.hunt@intel.com>

Looks ok to me.
Reviewed-by: Reshma Pattan <reshma.pattan@intel.com>
  
De Lara Guarch, Pablo May 11, 2018, 3:42 p.m. UTC | #2
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of David Hunt
> Sent: Thursday, May 10, 2018 8:38 AM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Hunt, David
> <david.hunt@intel.com>
> Subject: [dpdk-dev] [PATCH] test: fix incorrect cast in pipeline unit test
> 
> New warning with gcc 8.1:
> The table_action_stub_miss() function was incorrectly declared as returning a
> typedef of rte_pipeline_table_action_handler_miss, instead of what it should
> have been, an int.
> Changed this to declare the function as returning an int, and now when the
> action_handler_miss is set to table_action_stub_miss (cast as
> rte_pipeline_table_action_handler_miss), gcc 8.1 no longer complains about the
> cast.
> 
> Fixes: 5205954791cb ("app/test: packet framework unit tests")
> 
> Signed-off-by: David Hunt <david.hunt@intel.com>

Missing "Cc: stable@dpdk.org".

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
  
Thomas Monjalon May 13, 2018, 9:25 p.m. UTC | #3
> > New warning with gcc 8.1:
> > The table_action_stub_miss() function was incorrectly declared as returning a
> > typedef of rte_pipeline_table_action_handler_miss, instead of what it should
> > have been, an int.
> > Changed this to declare the function as returning an int, and now when the
> > action_handler_miss is set to table_action_stub_miss (cast as
> > rte_pipeline_table_action_handler_miss), gcc 8.1 no longer complains about the
> > cast.
> > 
> > Fixes: 5205954791cb ("app/test: packet framework unit tests")
> > 
> > Signed-off-by: David Hunt <david.hunt@intel.com>
> 
> Missing "Cc: stable@dpdk.org".
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied, thanks
  

Patch

diff --git a/test/test/test_table_pipeline.c b/test/test/test_table_pipeline.c
index 055a1a4e7..5ec4c5244 100644
--- a/test/test/test_table_pipeline.c
+++ b/test/test/test_table_pipeline.c
@@ -69,7 +69,7 @@  rte_pipeline_table_action_handler_hit
 table_action_stub_hit(struct rte_pipeline *p, struct rte_mbuf **pkts,
 	uint64_t pkts_mask, struct rte_pipeline_table_entry **entry, void *arg);
 
-rte_pipeline_table_action_handler_miss
+static int
 table_action_stub_miss(struct rte_pipeline *p, struct rte_mbuf **pkts,
 	uint64_t pkts_mask, struct rte_pipeline_table_entry **entry, void *arg);
 
@@ -101,7 +101,7 @@  table_action_stub_hit(__attribute__((unused)) struct rte_pipeline *p,
 	return 0;
 }
 
-rte_pipeline_table_action_handler_miss
+static int
 table_action_stub_miss(struct rte_pipeline *p,
 	__attribute__((unused)) struct rte_mbuf **pkts,
 	uint64_t pkts_mask,