[09/10] app/test-pipeline: fix global variable multiple definitions

Message ID 20190905145315.19395-10-ferruh.yigit@intel.com (mailing list archive)
State Rejected, archived
Delegated to: David Marchand
Headers
Series fix global variable multiple definitions |

Checks

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

Commit Message

Ferruh Yigit Sept. 5, 2019, 2:53 p.m. UTC
  'app' global variable is defined in multiple .c files, fixed it by
marking one copy as 'extern'

Issue has been detected by '-fno-common' gcc flag.

Fixes: 48f31ca50cc4 ("app/pipeline: packet framework benchmark")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 app/test-pipeline/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Cristian Dumitrescu Sept. 5, 2019, 3:01 p.m. UTC | #1
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Thursday, September 5, 2019 3:53 PM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH 09/10] app/test-pipeline: fix global variable multiple
> definitions
> 
> 'app' global variable is defined in multiple .c files, fixed it by
> marking one copy as 'extern'
> 
> Issue has been detected by '-fno-common' gcc flag.
> 
> Fixes: 48f31ca50cc4 ("app/pipeline: packet framework benchmark")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
>  app/test-pipeline/config.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test-pipeline/config.c b/app/test-pipeline/config.c
> index 28ac9fcc0..42c6ed9b2 100644
> --- a/app/test-pipeline/config.c
> +++ b/app/test-pipeline/config.c
> @@ -42,7 +42,7 @@
> 
>  #include "main.h"
> 
> -struct app_params app;
> +extern struct app_params app;
> 
>  static const char usage[] = "\n";
> 
> --
> 2.21.0

The global variable "app" is already declared as extern in the main.h file, which is included into config.c file, so please remove this "app" definition in config.c altogether.

Thanks,
Cristian
  
Ferruh Yigit Sept. 5, 2019, 3:19 p.m. UTC | #2
On 9/5/2019 4:01 PM, Dumitrescu, Cristian wrote:
> 
> 
>> -----Original Message-----
>> From: Yigit, Ferruh
>> Sent: Thursday, September 5, 2019 3:53 PM
>> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
>> Cc: dev@dpdk.org; stable@dpdk.org
>> Subject: [PATCH 09/10] app/test-pipeline: fix global variable multiple
>> definitions
>>
>> 'app' global variable is defined in multiple .c files, fixed it by
>> marking one copy as 'extern'
>>
>> Issue has been detected by '-fno-common' gcc flag.
>>
>> Fixes: 48f31ca50cc4 ("app/pipeline: packet framework benchmark")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> ---
>>  app/test-pipeline/config.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/app/test-pipeline/config.c b/app/test-pipeline/config.c
>> index 28ac9fcc0..42c6ed9b2 100644
>> --- a/app/test-pipeline/config.c
>> +++ b/app/test-pipeline/config.c
>> @@ -42,7 +42,7 @@
>>
>>  #include "main.h"
>>
>> -struct app_params app;
>> +extern struct app_params app;
>>
>>  static const char usage[] = "\n";
>>
>> --
>> 2.21.0
> 
> The global variable "app" is already declared as extern in the main.h file, which is included into config.c file, so please remove this "app" definition in config.c altogether.

Right, I will remove in next version.

> 
> Thanks,
> Cristian
>
  

Patch

diff --git a/app/test-pipeline/config.c b/app/test-pipeline/config.c
index 28ac9fcc0..42c6ed9b2 100644
--- a/app/test-pipeline/config.c
+++ b/app/test-pipeline/config.c
@@ -42,7 +42,7 @@ 
 
 #include "main.h"
 
-struct app_params app;
+extern struct app_params app;
 
 static const char usage[] = "\n";