diff mbox

[RFC,05/16] kvm tools: don't bother including linux/compiler.h

Message ID 1352721450-11340-6-git-send-email-will.deacon@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Will Deacon Nov. 12, 2012, 11:57 a.m. UTC
linux/compiler.h will never give us a definition for __compiler_offsetof
because __KERNEL__ isn't defined, so just use the simple definition that
we have already.

This patch removes the redundant code.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 tools/kvm/include/linux/stddef.h |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

Comments

Pekka Enberg Nov. 13, 2012, 7:26 a.m. UTC | #1
On Mon, 12 Nov 2012, Will Deacon wrote:

> linux/compiler.h will never give us a definition for __compiler_offsetof
> because __KERNEL__ isn't defined, so just use the simple definition that
> we have already.
> 
> This patch removes the redundant code.
> 
> Signed-off-by: Will Deacon <will.deacon@arm.com>
> ---
>  tools/kvm/include/linux/stddef.h |    6 ------
>  1 files changed, 0 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/kvm/include/linux/stddef.h b/tools/kvm/include/linux/stddef.h
> index 60ea512..39da808 100644
> --- a/tools/kvm/include/linux/stddef.h
> +++ b/tools/kvm/include/linux/stddef.h
> @@ -1,16 +1,10 @@
>  #ifndef _LINUX_STDDEF_H
>  #define _LINUX_STDDEF_H
>  
> -#include <linux/compiler.h>
> -
>  #undef NULL
>  #define NULL ((void *)0)
>  
>  #undef offsetof
> -#ifdef __compiler_offsetof
> -#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
> -#else
>  #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
> -#endif
>  
>  #endif

I'm seeing the following breakage with this patch applied:

[penberg@tux kvm]$ make
  CC       hw/rtc.o
  CC       ioport.o
  CC       kvm-cpu.o
  CC       kvm.o
In file included from include/kvm/rbtree-interval.h:4:0,
                 from include/kvm/ioport.h:4,
                 from hw/rtc.c:3:
../../include/linux/rbtree_augmented.h:125:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
In file included from include/kvm/rbtree-interval.h:4:0,
                 from include/kvm/ioport.h:4,
                 from ioport.c:1:
../../include/linux/rbtree_augmented.h:125:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
make: *** [hw/rtc.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [ioport.o] Error 1
Will Deacon Nov. 16, 2012, 10:06 a.m. UTC | #2
[ apologies if you receive this twice -- my email is playing up ]

Hi Pekka,

On Tue, Nov 13, 2012 at 07:26:36AM +0000, Pekka Enberg wrote:
> On Mon, 12 Nov 2012, Will Deacon wrote:
> > diff --git a/tools/kvm/include/linux/stddef.h b/tools/kvm/include/linux/stddef.h
> > index 60ea512..39da808 100644
> > --- a/tools/kvm/include/linux/stddef.h
> > +++ b/tools/kvm/include/linux/stddef.h
> > @@ -1,16 +1,10 @@
> >  #ifndef _LINUX_STDDEF_H
> >  #define _LINUX_STDDEF_H
> >  
> > -#include <linux/compiler.h>
> > -
> >  #undef NULL
> >  #define NULL ((void *)0)
> >  
> >  #undef offsetof
> > -#ifdef __compiler_offsetof
> > -#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
> > -#else
> >  #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
> > -#endif
> >  
> >  #endif
> 
> I'm seeing the following breakage with this patch applied:
> 
> [penberg@tux kvm]$ make
>   CC       hw/rtc.o
>   CC       ioport.o
>   CC       kvm-cpu.o
>   CC       kvm.o
> In file included from include/kvm/rbtree-interval.h:4:0,
>                  from include/kvm/ioport.h:4,
>                  from hw/rtc.c:3:
> ../../include/linux/rbtree_augmented.h:125:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
> In file included from include/kvm/rbtree-interval.h:4:0,
>                  from include/kvm/ioport.h:4,
>                  from ioport.c:1:
> ../../include/linux/rbtree_augmented.h:125:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
> make: *** [hw/rtc.o] Error 1
> make: *** Waiting for unfinished jobs....
> make: *** [ioport.o] Error 1

I'm struggling to reproduce this with my tree. Can you confirm whether or
not you have commit 29fc7c5a4f51 ("rbtree: include linux/compiler.h for
definition of __always_inline") in your *kernel* sources please?

Cheers,

Will
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pekka Enberg Nov. 16, 2012, 10:01 p.m. UTC | #3
On Fri, 16 Nov 2012, Will Deacon wrote:
> > I'm seeing the following breakage with this patch applied:
> > 
> > [penberg@tux kvm]$ make
> >   CC       hw/rtc.o
> >   CC       ioport.o
> >   CC       kvm-cpu.o
> >   CC       kvm.o
> > In file included from include/kvm/rbtree-interval.h:4:0,
> >                  from include/kvm/ioport.h:4,
> >                  from hw/rtc.c:3:
> > ../../include/linux/rbtree_augmented.h:125:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
> > In file included from include/kvm/rbtree-interval.h:4:0,
> >                  from include/kvm/ioport.h:4,
> >                  from ioport.c:1:
> > ../../include/linux/rbtree_augmented.h:125:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
> > make: *** [hw/rtc.o] Error 1
> > make: *** Waiting for unfinished jobs....
> > make: *** [ioport.o] Error 1
> 
> I'm struggling to reproduce this with my tree. Can you confirm whether or
> not you have commit 29fc7c5a4f51 ("rbtree: include linux/compiler.h for
> definition of __always_inline") in your *kernel* sources please?

No, I don't. I can cherry-pick that to my tree if necessary.

			Pekka
Will Deacon Nov. 19, 2012, 10:33 a.m. UTC | #4
On Fri, Nov 16, 2012 at 10:01:01PM +0000, Pekka Enberg wrote:
> On Fri, 16 Nov 2012, Will Deacon wrote:
> > > I'm seeing the following breakage with this patch applied:
> > > 
> > > [penberg@tux kvm]$ make
> > >   CC       hw/rtc.o
> > >   CC       ioport.o
> > >   CC       kvm-cpu.o
> > >   CC       kvm.o
> > > In file included from include/kvm/rbtree-interval.h:4:0,
> > >                  from include/kvm/ioport.h:4,
> > >                  from hw/rtc.c:3:
> > > ../../include/linux/rbtree_augmented.h:125:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
> > > In file included from include/kvm/rbtree-interval.h:4:0,
> > >                  from include/kvm/ioport.h:4,
> > >                  from ioport.c:1:
> > > ../../include/linux/rbtree_augmented.h:125:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
> > > make: *** [hw/rtc.o] Error 1
> > > make: *** Waiting for unfinished jobs....
> > > make: *** [ioport.o] Error 1
> > 
> > I'm struggling to reproduce this with my tree. Can you confirm whether or
> > not you have commit 29fc7c5a4f51 ("rbtree: include linux/compiler.h for
> > definition of __always_inline") in your *kernel* sources please?
> 
> No, I don't. I can cherry-pick that to my tree if necessary.

Aha, that's probably the issue then since you won't have a definition of
__always_inline from linux/compiler.h. If you cherry-pick that patch, then
this one should work as intended. If you prefer, I can include that patch
in v2 of my series.

Cheers,

Will
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pekka Enberg Nov. 19, 2012, 11:42 a.m. UTC | #5
Hi Will,

On Mon, 19 Nov 2012, Will Deacon wrote:
> > > I'm struggling to reproduce this with my tree. Can you confirm whether or
> > > not you have commit 29fc7c5a4f51 ("rbtree: include linux/compiler.h for
> > > definition of __always_inline") in your *kernel* sources please?
> > 
> > No, I don't. I can cherry-pick that to my tree if necessary.
> 
> Aha, that's probably the issue then since you won't have a definition of
> __always_inline from linux/compiler.h. If you cherry-pick that patch, then
> this one should work as intended. If you prefer, I can include that patch
> in v2 of my series.

Please just include the patch in your series.

			Pekka
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tools/kvm/include/linux/stddef.h b/tools/kvm/include/linux/stddef.h
index 60ea512..39da808 100644
--- a/tools/kvm/include/linux/stddef.h
+++ b/tools/kvm/include/linux/stddef.h
@@ -1,16 +1,10 @@ 
 #ifndef _LINUX_STDDEF_H
 #define _LINUX_STDDEF_H
 
-#include <linux/compiler.h>
-
 #undef NULL
 #define NULL ((void *)0)
 
 #undef offsetof
-#ifdef __compiler_offsetof
-#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
-#else
 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
 
 #endif