[dpdk-dev] examples/quota_watermark: fix gcc 8.0.1 cast between incompatible types

Message ID 1525865729-16086-2-git-send-email-reshma.pattan@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

Pattan, Reshma May 9, 2018, 11:35 a.m. UTC
  Gcc 8.0.1 reports incompatible cast between types i.e. from
`void (*)(void *)` to `(int (*)(void *)`.

Change the pipeline_stage prototype to retun int type
to fix the issue.

Fixes: a0ffcb257a ("examples/quota_watermark: correct code indentation")
CC: stable@dpdk.org

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
 examples/quota_watermark/qw/main.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
  

Comments

De Lara Guarch, Pablo May 11, 2018, 3:48 p.m. UTC | #1
> -----Original Message-----
> From: stable [mailto:stable-bounces@dpdk.org] On Behalf Of Reshma Pattan
> Sent: Wednesday, May 9, 2018 12:35 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Pattan, Reshma <reshma.pattan@intel.com>
> Subject: [dpdk-stable] [PATCH] examples/quota_watermark: fix gcc 8.0.1 cast
> between incompatible types
> 
> Gcc 8.0.1 reports incompatible cast between types i.e. from `void (*)(void *)` to
> `(int (*)(void *)`.
> 
> Change the pipeline_stage prototype to retun int type to fix the issue.
> 
> Fixes: a0ffcb257a ("examples/quota_watermark: correct code indentation")
> CC: stable@dpdk.org
> 
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
  
Thomas Monjalon May 13, 2018, 9:45 p.m. UTC | #2
09/05/2018 13:35, Reshma Pattan:
> Gcc 8.0.1 reports incompatible cast between types i.e. from
> `void (*)(void *)` to `(int (*)(void *)`.
> 
> Change the pipeline_stage prototype to retun int type
> to fix the issue.
> 
> Fixes: a0ffcb257a ("examples/quota_watermark: correct code indentation")
> CC: stable@dpdk.org
> 
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
>  			/* typecast is a workaround for GCC 4.3 bug */
> -			rte_eal_remote_launch((int (*)(void *))pipeline_stage,
> +			rte_eal_remote_launch(pipeline_stage,
>  					NULL, lcore_id);

The comment can be removed.

Applied with above fixed, thanks
  

Patch

diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c
index 313216f39..dda3e0a3e 100644
--- a/examples/quota_watermark/qw/main.c
+++ b/examples/quota_watermark/qw/main.c
@@ -181,7 +181,7 @@  receive_stage(__attribute__((unused)) void *args)
 	}
 }
 
-static void
+static int
 pipeline_stage(__attribute__((unused)) void *args)
 {
 	int i, ret;
@@ -243,9 +243,11 @@  pipeline_stage(__attribute__((unused)) void *args)
 			}
 		}
 	}
+
+	return 0;
 }
 
-static void
+static int
 send_stage(__attribute__((unused)) void *args)
 {
 	uint16_t nb_dq_pkts;
@@ -287,6 +289,8 @@  send_stage(__attribute__((unused)) void *args)
 			/* TODO: Check if nb_dq_pkts == nb_tx_pkts? */
 		}
 	}
+
+	return 0;
 }
 
 int
@@ -347,7 +351,7 @@  main(int argc, char **argv)
 					init_ring(lcore_id, port_id);
 
 			/* typecast is a workaround for GCC 4.3 bug */
-			rte_eal_remote_launch((int (*)(void *))pipeline_stage,
+			rte_eal_remote_launch(pipeline_stage,
 					NULL, lcore_id);
 		}
 	}