[dpdk-dev] examples/ip_pipeline: fix build with clang 3.6

Message ID 1432031834-12042-1-git-send-email-thomas.monjalon@6wind.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Thomas Monjalon May 19, 2015, 10:37 a.m. UTC
  This error is detected:
    examples/ip_pipeline/cmdline.c:272:15: error: address of array
          'params->file_path' will always evaluate to 'true'
            if (!params->file_path) {
                ~~~~~~~~~^~~~~~~~~

file_path is an array in a structure so it's unneeded to check it.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 examples/ip_pipeline/cmdline.c | 6 ------
 1 file changed, 6 deletions(-)
  

Comments

Cristian Dumitrescu May 19, 2015, 3:32 p.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Tuesday, May 19, 2015 11:37 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] examples/ip_pipeline: fix build with clang 3.6
> 
> This error is detected:
>     examples/ip_pipeline/cmdline.c:272:15: error: address of array
>           'params->file_path' will always evaluate to 'true'
>             if (!params->file_path) {
>                 ~~~~~~~~~^~~~~~~~~
> 
> file_path is an array in a structure so it's unneeded to check it.
> 
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> ---
>  examples/ip_pipeline/cmdline.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/examples/ip_pipeline/cmdline.c
> b/examples/ip_pipeline/cmdline.c
> index 152acb5..3173fd0 100644
> --- a/examples/ip_pipeline/cmdline.c
> +++ b/examples/ip_pipeline/cmdline.c
> @@ -268,12 +268,6 @@ cmd_run_file_parsed(
>  	struct cmdline *file_cl;
>  	int fd;
> 
> -	/* Check params */
> -	if (!params->file_path) {
> -		printf("Illegal value for file path (%s)\n", params->file_path);
> -		return;
> -	}
> -
>  	fd = open(params->file_path, O_RDONLY, 0);
>  	if (fd < 0) {
>  		printf("Illegal value for file path (%s)\n", params->file_path);
> --
> 2.4.0

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
  
Thomas Monjalon May 19, 2015, 3:46 p.m. UTC | #2
> > This error is detected:
> >     examples/ip_pipeline/cmdline.c:272:15: error: address of array
> >           'params->file_path' will always evaluate to 'true'
> >             if (!params->file_path) {
> >                 ~~~~~~~~~^~~~~~~~~
> > 
> > file_path is an array in a structure so it's unneeded to check it.
> > 
> > Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> 
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

Applied, thanks
  

Patch

diff --git a/examples/ip_pipeline/cmdline.c b/examples/ip_pipeline/cmdline.c
index 152acb5..3173fd0 100644
--- a/examples/ip_pipeline/cmdline.c
+++ b/examples/ip_pipeline/cmdline.c
@@ -268,12 +268,6 @@  cmd_run_file_parsed(
 	struct cmdline *file_cl;
 	int fd;
 
-	/* Check params */
-	if (!params->file_path) {
-		printf("Illegal value for file path (%s)\n", params->file_path);
-		return;
-	}
-
 	fd = open(params->file_path, O_RDONLY, 0);
 	if (fd < 0) {
 		printf("Illegal value for file path (%s)\n", params->file_path);