All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/msr: Fix build with older GCC versions
@ 2019-04-12 11:59 Daniel Kiper
  2019-04-12 13:33 ` Vladimir 'phcoder' Serbinenko
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Daniel Kiper @ 2019-04-12 11:59 UTC (permalink / raw)
  To: grub-devel; +Cc: adrian15sgd, eric.snowberg, glaubitz, jesusdf, list, phcoder

Some older GCC versions produce following error when x86 MSR modules are build:

  In file included from commands/i386/rdmsr.c:29:0:
  ../include/grub/i386/rdmsr.h:27:29: error: no previous prototype for ‘grub_msr_read’ [-Werror=missing-prototypes]
   extern inline grub_uint64_t grub_msr_read (grub_uint32_t msr_id)
                               ^
  cc1: all warnings being treated as errors

This is due to incorrect use of extern keyword. So, replace it with
static keyword.

Additionally, fix incorrect coding style.

Reported-by: Eric Snowberg <eric.snowberg@oracle.com>
Reported-by: adrian15 <adrian15sgd@gmail.com>
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 include/grub/i386/rdmsr.h | 3 ++-
 include/grub/i386/wrmsr.h | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/grub/i386/rdmsr.h b/include/grub/i386/rdmsr.h
index bddb7bbbb..c0a0c717a 100644
--- a/include/grub/i386/rdmsr.h
+++ b/include/grub/i386/rdmsr.h
@@ -24,7 +24,8 @@
  *       Accessing a reserved or unimplemented MSR address results in a GP#.
  */
 
-extern inline grub_uint64_t grub_msr_read (grub_uint32_t msr_id)
+static inline grub_uint64_t
+grub_msr_read (grub_uint32_t msr_id)
 {
   grub_uint32_t low, high;
 
diff --git a/include/grub/i386/wrmsr.h b/include/grub/i386/wrmsr.h
index e14d7807f..dea60aed1 100644
--- a/include/grub/i386/wrmsr.h
+++ b/include/grub/i386/wrmsr.h
@@ -24,7 +24,8 @@
  *       Accessing a reserved or unimplemented MSR address results in a GP#.
  */
 
-extern inline void grub_msr_write(grub_uint32_t msr_id, grub_uint64_t msr_value)
+static inline void
+grub_msr_write(grub_uint32_t msr_id, grub_uint64_t msr_value)
 {
   grub_uint32_t low = msr_value, high = msr_value >> 32;
 
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/msr: Fix build with older GCC versions
  2019-04-12 11:59 [PATCH] x86/msr: Fix build with older GCC versions Daniel Kiper
@ 2019-04-12 13:33 ` Vladimir 'phcoder' Serbinenko
  2019-04-13 10:54 ` adrian15
  2019-04-15 21:02 ` Eric Snowberg
  2 siblings, 0 replies; 7+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2019-04-12 13:33 UTC (permalink / raw)
  To: Daniel Kiper
  Cc: The development of GRUB 2, adrian15sgd, Eric Snowberg, glaubitz,
	jesusdf, Christian Hesse

LGTM.
Just a note: it's a correct usage of extern, just not consistent with
rest of codebase and not supported by old gcc

On Sat, Apr 13, 2019 at 12:02 AM Daniel Kiper <daniel.kiper@oracle.com> wrote:
>
> Some older GCC versions produce following error when x86 MSR modules are build:
>
>   In file included from commands/i386/rdmsr.c:29:0:
>   ../include/grub/i386/rdmsr.h:27:29: error: no previous prototype for ‘grub_msr_read’ [-Werror=missing-prototypes]
>    extern inline grub_uint64_t grub_msr_read (grub_uint32_t msr_id)
>                                ^
>   cc1: all warnings being treated as errors
>
> This is due to incorrect use of extern keyword. So, replace it with
> static keyword.
>
> Additionally, fix incorrect coding style.
>
> Reported-by: Eric Snowberg <eric.snowberg@oracle.com>
> Reported-by: adrian15 <adrian15sgd@gmail.com>
> Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
> ---
>  include/grub/i386/rdmsr.h | 3 ++-
>  include/grub/i386/wrmsr.h | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/include/grub/i386/rdmsr.h b/include/grub/i386/rdmsr.h
> index bddb7bbbb..c0a0c717a 100644
> --- a/include/grub/i386/rdmsr.h
> +++ b/include/grub/i386/rdmsr.h
> @@ -24,7 +24,8 @@
>   *       Accessing a reserved or unimplemented MSR address results in a GP#.
>   */
>
> -extern inline grub_uint64_t grub_msr_read (grub_uint32_t msr_id)
> +static inline grub_uint64_t
> +grub_msr_read (grub_uint32_t msr_id)
>  {
>    grub_uint32_t low, high;
>
> diff --git a/include/grub/i386/wrmsr.h b/include/grub/i386/wrmsr.h
> index e14d7807f..dea60aed1 100644
> --- a/include/grub/i386/wrmsr.h
> +++ b/include/grub/i386/wrmsr.h
> @@ -24,7 +24,8 @@
>   *       Accessing a reserved or unimplemented MSR address results in a GP#.
>   */
>
> -extern inline void grub_msr_write(grub_uint32_t msr_id, grub_uint64_t msr_value)
> +static inline void
> +grub_msr_write(grub_uint32_t msr_id, grub_uint64_t msr_value)
>  {
>    grub_uint32_t low = msr_value, high = msr_value >> 32;
>
> --
> 2.11.0
>


-- 
Regards
Vladimir 'phcoder' Serbinenko


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/msr: Fix build with older GCC versions
  2019-04-12 11:59 [PATCH] x86/msr: Fix build with older GCC versions Daniel Kiper
  2019-04-12 13:33 ` Vladimir 'phcoder' Serbinenko
@ 2019-04-13 10:54 ` adrian15
  2019-04-18 10:29   ` Daniel Kiper
  2019-04-15 21:02 ` Eric Snowberg
  2 siblings, 1 reply; 7+ messages in thread
From: adrian15 @ 2019-04-13 10:54 UTC (permalink / raw)
  To: Daniel Kiper, grub-devel; +Cc: eric.snowberg, glaubitz, jesusdf, list, phcoder

I confirm this patch applied over 2.04rc1 tag enables me to build grub
on my system.
Thank you very much!

adrian15

El 12/04/19 a las 13:59, Daniel Kiper escribió:
> Some older GCC versions produce following error when x86 MSR modules are build:
> 
>   In file included from commands/i386/rdmsr.c:29:0:
>   ../include/grub/i386/rdmsr.h:27:29: error: no previous prototype for ‘grub_msr_read’ [-Werror=missing-prototypes]
>    extern inline grub_uint64_t grub_msr_read (grub_uint32_t msr_id)
>                                ^
>   cc1: all warnings being treated as errors
> 
> This is due to incorrect use of extern keyword. So, replace it with
> static keyword.
> 
> Additionally, fix incorrect coding style.
> 
> Reported-by: Eric Snowberg <eric.snowberg@oracle.com>
> Reported-by: adrian15 <adrian15sgd@gmail.com>
> Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
> ---
>  include/grub/i386/rdmsr.h | 3 ++-
>  include/grub/i386/wrmsr.h | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/include/grub/i386/rdmsr.h b/include/grub/i386/rdmsr.h
> index bddb7bbbb..c0a0c717a 100644
> --- a/include/grub/i386/rdmsr.h
> +++ b/include/grub/i386/rdmsr.h
> @@ -24,7 +24,8 @@
>   *       Accessing a reserved or unimplemented MSR address results in a GP#.
>   */
>  
> -extern inline grub_uint64_t grub_msr_read (grub_uint32_t msr_id)
> +static inline grub_uint64_t
> +grub_msr_read (grub_uint32_t msr_id)
>  {
>    grub_uint32_t low, high;
>  
> diff --git a/include/grub/i386/wrmsr.h b/include/grub/i386/wrmsr.h
> index e14d7807f..dea60aed1 100644
> --- a/include/grub/i386/wrmsr.h
> +++ b/include/grub/i386/wrmsr.h
> @@ -24,7 +24,8 @@
>   *       Accessing a reserved or unimplemented MSR address results in a GP#.
>   */
>  
> -extern inline void grub_msr_write(grub_uint32_t msr_id, grub_uint64_t msr_value)
> +static inline void
> +grub_msr_write(grub_uint32_t msr_id, grub_uint64_t msr_value)
>  {
>    grub_uint32_t low = msr_value, high = msr_value >> 32;
>  
> 

-- 
Support free software. Donate to Super Grub Disk. Apoya el software
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/msr: Fix build with older GCC versions
  2019-04-12 11:59 [PATCH] x86/msr: Fix build with older GCC versions Daniel Kiper
  2019-04-12 13:33 ` Vladimir 'phcoder' Serbinenko
  2019-04-13 10:54 ` adrian15
@ 2019-04-15 21:02 ` Eric Snowberg
  2 siblings, 0 replies; 7+ messages in thread
From: Eric Snowberg @ 2019-04-15 21:02 UTC (permalink / raw)
  To: The development of GNU GRUB
  Cc: list, Vladimir 'phcoder' Serbinenko,
	Jesús Diéguez Fernández,
	John Paul Adrian Glaubitz, adrian15sgd, Daniel Kiper


> On Apr 12, 2019, at 5:59 AM, Daniel Kiper <daniel.kiper@oracle.com> wrote:
> 
> Some older GCC versions produce following error when x86 MSR modules are build:
> 
>  In file included from commands/i386/rdmsr.c:29:0:
>  ../include/grub/i386/rdmsr.h:27:29: error: no previous prototype for ‘grub_msr_read’ [-Werror=missing-prototypes]
>   extern inline grub_uint64_t grub_msr_read (grub_uint32_t msr_id)
>                               ^
>  cc1: all warnings being treated as errors
> 
> This is due to incorrect use of extern keyword. So, replace it with
> static keyword.
> 
> Additionally, fix incorrect coding style.
> 
> Reported-by: Eric Snowberg <eric.snowberg@oracle.com>
> Reported-by: adrian15 <adrian15sgd@gmail.com>
> Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>

Reviewed-by: Eric Snowberg <eric.snowberg@oracle.com>

> ---
> include/grub/i386/rdmsr.h | 3 ++-
> include/grub/i386/wrmsr.h | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/include/grub/i386/rdmsr.h b/include/grub/i386/rdmsr.h
> index bddb7bbbb..c0a0c717a 100644
> --- a/include/grub/i386/rdmsr.h
> +++ b/include/grub/i386/rdmsr.h
> @@ -24,7 +24,8 @@
>  *       Accessing a reserved or unimplemented MSR address results in a GP#.
>  */
> 
> -extern inline grub_uint64_t grub_msr_read (grub_uint32_t msr_id)
> +static inline grub_uint64_t
> +grub_msr_read (grub_uint32_t msr_id)
> {
>   grub_uint32_t low, high;
> 
> diff --git a/include/grub/i386/wrmsr.h b/include/grub/i386/wrmsr.h
> index e14d7807f..dea60aed1 100644
> --- a/include/grub/i386/wrmsr.h
> +++ b/include/grub/i386/wrmsr.h
> @@ -24,7 +24,8 @@
>  *       Accessing a reserved or unimplemented MSR address results in a GP#.
>  */
> 
> -extern inline void grub_msr_write(grub_uint32_t msr_id, grub_uint64_t msr_value)
> +static inline void
> +grub_msr_write(grub_uint32_t msr_id, grub_uint64_t msr_value)
> {
>   grub_uint32_t low = msr_value, high = msr_value >> 32;
> 
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/msr: Fix build with older GCC versions
  2019-04-13 10:54 ` adrian15
@ 2019-04-18 10:29   ` Daniel Kiper
  2019-04-19  7:19     ` adrian15
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Kiper @ 2019-04-18 10:29 UTC (permalink / raw)
  To: adrian15; +Cc: grub-devel, eric.snowberg, glaubitz, jesusdf, list, phcoder

On Sat, Apr 13, 2019 at 12:54:53PM +0200, adrian15 wrote:
> I confirm this patch applied over 2.04rc1 tag enables me to build grub
> on my system.
> Thank you very much!

May I add "Tested-by: adrian15 <adrian15sgd@gmail.com>" to this patch?

Daniel


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/msr: Fix build with older GCC versions
  2019-04-18 10:29   ` Daniel Kiper
@ 2019-04-19  7:19     ` adrian15
  2019-04-19 10:12       ` Daniel Kiper
  0 siblings, 1 reply; 7+ messages in thread
From: adrian15 @ 2019-04-19  7:19 UTC (permalink / raw)
  To: Daniel Kiper; +Cc: grub-devel, eric.snowberg, glaubitz, jesusdf, list, phcoder

El 18/04/19 a las 12:29, Daniel Kiper escribió:
> On Sat, Apr 13, 2019 at 12:54:53PM +0200, adrian15 wrote:
>> I confirm this patch applied over 2.04rc1 tag enables me to build grub
>> on my system.
>> Thank you very much!
> 
> May I add "Tested-by: adrian15 <adrian15sgd@gmail.com>" to this patch?
> 
> Daniel
No problem.

adrian15
-- 
Support free software. Donate to Super Grub Disk. Apoya el software
libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/msr: Fix build with older GCC versions
  2019-04-19  7:19     ` adrian15
@ 2019-04-19 10:12       ` Daniel Kiper
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Kiper @ 2019-04-19 10:12 UTC (permalink / raw)
  To: adrian15; +Cc: grub-devel, eric.snowberg, glaubitz, jesusdf, list, phcoder

On Fri, Apr 19, 2019 at 09:19:35AM +0200, adrian15 wrote:
> El 18/04/19 a las 12:29, Daniel Kiper escribió:
> > On Sat, Apr 13, 2019 at 12:54:53PM +0200, adrian15 wrote:
> >> I confirm this patch applied over 2.04rc1 tag enables me to build grub
> >> on my system.
> >> Thank you very much!
> >
> > May I add "Tested-by: adrian15 <adrian15sgd@gmail.com>" to this patch?
> >
> > Daniel
> No problem.

Thanks!

Daniel


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-04-19 10:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-12 11:59 [PATCH] x86/msr: Fix build with older GCC versions Daniel Kiper
2019-04-12 13:33 ` Vladimir 'phcoder' Serbinenko
2019-04-13 10:54 ` adrian15
2019-04-18 10:29   ` Daniel Kiper
2019-04-19  7:19     ` adrian15
2019-04-19 10:12       ` Daniel Kiper
2019-04-15 21:02 ` Eric Snowberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.