diff mbox

[1/3] fwts_framework.h: fix redefinition typedef warning

Message ID 1478005669-3752-1-git-send-email-ernunes@redhat.com
State Accepted
Headers show

Commit Message

Erico Nunes Nov. 1, 2016, 1:07 p.m. UTC
When building the current fwts release with an older gcc 4.4, we get
this redefinition typedef warning on struct fwts_framework, due to a
forward typedef declaration which is made in the beginning of the file:

  In file included from ../../../src/lib/include/fwts_binpaths.h:27,
                   from ../../../src/lib/include/fwts.h:54,
                   from fwts_ac_adapter.c:19:
  ../../../src/lib/include/fwts_framework.h:158: error: redefinition of
  typedef ‘fwts_framework’
  ../../../src/lib/include/fwts_framework.h:28: note: previous
  declaration of ‘fwts_framework’ was here

By removing the second typedef in the definition, we can get rid of the
warning and still build with every gcc version.
As there are still supported systems with older gcc versions, such as
RHEL6, it is interesting to have this fixed.

This has been built and tested with gcc 6.2.1, gcc 4.8.5 and gcc 4.4.7.

Signed-off-by: Erico Nunes <ernunes@redhat.com>
---
 src/lib/include/fwts_framework.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Colin Ian King Nov. 1, 2016, 1:12 p.m. UTC | #1
On 01/11/16 07:07, Erico Nunes wrote:
> When building the current fwts release with an older gcc 4.4, we get
> this redefinition typedef warning on struct fwts_framework, due to a
> forward typedef declaration which is made in the beginning of the file:
> 
>   In file included from ../../../src/lib/include/fwts_binpaths.h:27,
>                    from ../../../src/lib/include/fwts.h:54,
>                    from fwts_ac_adapter.c:19:
>   ../../../src/lib/include/fwts_framework.h:158: error: redefinition of
>   typedef ‘fwts_framework’
>   ../../../src/lib/include/fwts_framework.h:28: note: previous
>   declaration of ‘fwts_framework’ was here
> 
> By removing the second typedef in the definition, we can get rid of the
> warning and still build with every gcc version.
> As there are still supported systems with older gcc versions, such as
> RHEL6, it is interesting to have this fixed.
> 
> This has been built and tested with gcc 6.2.1, gcc 4.8.5 and gcc 4.4.7.
> 
> Signed-off-by: Erico Nunes <ernunes@redhat.com>
> ---
>  src/lib/include/fwts_framework.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lib/include/fwts_framework.h b/src/lib/include/fwts_framework.h
> index f7d5b69..ff01198 100644
> --- a/src/lib/include/fwts_framework.h
> +++ b/src/lib/include/fwts_framework.h
> @@ -108,7 +108,7 @@ static inline void fwts_framework_summate_results(fwts_results *total, fwts_resu
>  /*
>   *  Test framework context
>   */
> -typedef struct fwts_framework {
> +struct fwts_framework {
>  	uint32_t magic;				/* identify struct magic */
>  	fwts_log *results;			/* log for test results */
>  	char *results_logname;			/* filename of results log */
> @@ -155,7 +155,7 @@ typedef struct fwts_framework {
>  	fwts_pm_method pm_method;
>  	fwts_architecture host_arch;		/* arch FWTS was built for */
>  	fwts_architecture target_arch;		/* arch being tested */
> -} fwts_framework;
> +};
>  
>  typedef struct {
>  	char *opt;	/* option */
> 

Acked-by: Colin Ian King <colin.king@canonical.com>
Alex Hung Nov. 1, 2016, 6:21 p.m. UTC | #2
On 2016-11-01 06:07 AM, Erico Nunes wrote:
> When building the current fwts release with an older gcc 4.4, we get
> this redefinition typedef warning on struct fwts_framework, due to a
> forward typedef declaration which is made in the beginning of the file:
>
>   In file included from ../../../src/lib/include/fwts_binpaths.h:27,
>                    from ../../../src/lib/include/fwts.h:54,
>                    from fwts_ac_adapter.c:19:
>   ../../../src/lib/include/fwts_framework.h:158: error: redefinition of
>   typedef ‘fwts_framework’
>   ../../../src/lib/include/fwts_framework.h:28: note: previous
>   declaration of ‘fwts_framework’ was here
>
> By removing the second typedef in the definition, we can get rid of the
> warning and still build with every gcc version.
> As there are still supported systems with older gcc versions, such as
> RHEL6, it is interesting to have this fixed.
>
> This has been built and tested with gcc 6.2.1, gcc 4.8.5 and gcc 4.4.7.
>
> Signed-off-by: Erico Nunes <ernunes@redhat.com>
> ---
>  src/lib/include/fwts_framework.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/include/fwts_framework.h b/src/lib/include/fwts_framework.h
> index f7d5b69..ff01198 100644
> --- a/src/lib/include/fwts_framework.h
> +++ b/src/lib/include/fwts_framework.h
> @@ -108,7 +108,7 @@ static inline void fwts_framework_summate_results(fwts_results *total, fwts_resu
>  /*
>   *  Test framework context
>   */
> -typedef struct fwts_framework {
> +struct fwts_framework {
>  	uint32_t magic;				/* identify struct magic */
>  	fwts_log *results;			/* log for test results */
>  	char *results_logname;			/* filename of results log */
> @@ -155,7 +155,7 @@ typedef struct fwts_framework {
>  	fwts_pm_method pm_method;
>  	fwts_architecture host_arch;		/* arch FWTS was built for */
>  	fwts_architecture target_arch;		/* arch being tested */
> -} fwts_framework;
> +};
>
>  typedef struct {
>  	char *opt;	/* option */
>

Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox

Patch

diff --git a/src/lib/include/fwts_framework.h b/src/lib/include/fwts_framework.h
index f7d5b69..ff01198 100644
--- a/src/lib/include/fwts_framework.h
+++ b/src/lib/include/fwts_framework.h
@@ -108,7 +108,7 @@  static inline void fwts_framework_summate_results(fwts_results *total, fwts_resu
 /*
  *  Test framework context
  */
-typedef struct fwts_framework {
+struct fwts_framework {
 	uint32_t magic;				/* identify struct magic */
 	fwts_log *results;			/* log for test results */
 	char *results_logname;			/* filename of results log */
@@ -155,7 +155,7 @@  typedef struct fwts_framework {
 	fwts_pm_method pm_method;
 	fwts_architecture host_arch;		/* arch FWTS was built for */
 	fwts_architecture target_arch;		/* arch being tested */
-} fwts_framework;
+};
 
 typedef struct {
 	char *opt;	/* option */