public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.5 patch] hdreg.h must include types.h
@ 2002-04-04  7:42 Adrian Bunk
  2002-04-04  9:18 ` Martin Dalecki
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Bunk @ 2002-04-04  7:42 UTC (permalink / raw)
  To: Linux Kernel

Hi,

while compiling 2.5.7-dj3 I got the following compile error:

<--  snip  -->

...
gcc -D__KERNEL__ -I/home/bunk/linux/kernel-2.5/linux-2.5.7/include -Wall
-Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing
-fno-common -pipe -mpreferred-stack-boundary=2 -march=k6   -DKBUILD_BASENAME=ide_pnp
-c -o ide-pnp.o ide-pnp.c
In file included from /home/bunk/linux/kernel-2.5/linux-2.5.7/include/linux/ide.h:10,
                 from ide-pnp.c:19:
/home/bunk/linux/kernel-2.5/linux-2.5.7/include/linux/hdreg.h:71: parse
error before `u8'

<--  snip  -->

The problem is that in 2.5.8-pre1 hdreg.h uses u8 but it doesn't include
types.h. I didn't tried it but since the code is the same I expect the
same problem in 2.5.8-pre1, too.

The fix is simple:

--- include/linux/hdreg.h.old	Thu Apr  4 09:33:48 2002
+++ include/linux/hdreg.h	Thu Apr  4 09:34:44 2002
@@ -1,6 +1,8 @@
 #ifndef _LINUX_HDREG_H
 #define _LINUX_HDREG_H

+#include <linux/types.h>
+
 /*
  * This file contains some defines for the AT-hd-controller.
  * Various sources.

cu
Adrian



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

* Re: [2.5 patch] hdreg.h must include types.h
  2002-04-04  7:42 [2.5 patch] hdreg.h must include types.h Adrian Bunk
@ 2002-04-04  9:18 ` Martin Dalecki
  2002-04-04 14:50   ` Adrian Bunk
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Dalecki @ 2002-04-04  9:18 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Linux Kernel

Adrian Bunk wrote:
> Hi,
> 
> while compiling 2.5.7-dj3 I got the following compile error:
> 
> <--  snip  -->
> 
> ...
> gcc -D__KERNEL__ -I/home/bunk/linux/kernel-2.5/linux-2.5.7/include -Wall
> -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing
> -fno-common -pipe -mpreferred-stack-boundary=2 -march=k6   -DKBUILD_BASENAME=ide_pnp
> -c -o ide-pnp.o ide-pnp.c
> In file included from /home/bunk/linux/kernel-2.5/linux-2.5.7/include/linux/ide.h:10,
>                  from ide-pnp.c:19:
> /home/bunk/linux/kernel-2.5/linux-2.5.7/include/linux/hdreg.h:71: parse
> error before `u8'
> 
> <--  snip  -->
> 
> The problem is that in 2.5.8-pre1 hdreg.h uses u8 but it doesn't include
> types.h. I didn't tried it but since the code is the same I expect the
> same problem in 2.5.8-pre1, too.
> 
> The fix is simple:
> 
> --- include/linux/hdreg.h.old	Thu Apr  4 09:33:48 2002
> +++ include/linux/hdreg.h	Thu Apr  4 09:34:44 2002
> @@ -1,6 +1,8 @@
>  #ifndef _LINUX_HDREG_H
>  #define _LINUX_HDREG_H
> 
> +#include <linux/types.h>
> +
>  /*
>   * This file contains some defines for the AT-hd-controller.
>   * Various sources.
> 
> cu
> Adrian
> 

The proper fix is to add linux/types.h in ide-pnp.c in front
of linux/hdreg.h inclusion. Nested includes are *nasty*.


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

* Re: [2.5 patch] hdreg.h must include types.h
  2002-04-04  9:18 ` Martin Dalecki
@ 2002-04-04 14:50   ` Adrian Bunk
  2002-04-09  7:37     ` Frank Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Bunk @ 2002-04-04 14:50 UTC (permalink / raw)
  To: Martin Dalecki; +Cc: Linux Kernel

On Thu, 4 Apr 2002, Martin Dalecki wrote:

> The proper fix is to add linux/types.h in ide-pnp.c in front
> of linux/hdreg.h inclusion. Nested includes are *nasty*.

Why are they nasty? My impression is that they give you a cleaner API in
the sense that you know that when you need something from e.g.
linux/hdreg.h you can simply include this file without bothering which
other header files are needed by this file. The only problem I'm currently
seeing is that circular dependencies between header files might be a
problem but it shouldn't be too hard to check that there are no circular
dependencies. Are there any other problems I don't see?

TIA
Adrian



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

* Re: [2.5 patch] hdreg.h must include types.h
  2002-04-04 14:50   ` Adrian Bunk
@ 2002-04-09  7:37     ` Frank Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Frank Schaefer @ 2002-04-09  7:37 UTC (permalink / raw)
  To: Linux Kernel

On Thu, 2002-04-04 at 16:50, Adrian Bunk wrote:
> On Thu, 4 Apr 2002, Martin Dalecki wrote:
> 
> > The proper fix is to add linux/types.h in ide-pnp.c in front
> > of linux/hdreg.h inclusion. Nested includes are *nasty*.
> 
> Why are they nasty? My impression is that they give you a cleaner API in
> the sense that you know that when you need something from e.g.
> linux/hdreg.h you can simply include this file without bothering which
> other header files are needed by this file. The only problem I'm currently
> seeing is that circular dependencies between header files might be a
> problem but it shouldn't be too hard to check that there are no circular
> dependencies. Are there any other problems I don't see?
> 

Agree,

and assuming that every header begins with sonething like
#ifndef HEADER_INCLUDED
we save a lot of typing and error prone-ness.

Frank


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

end of thread, other threads:[~2002-04-09  7:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-04  7:42 [2.5 patch] hdreg.h must include types.h Adrian Bunk
2002-04-04  9:18 ` Martin Dalecki
2002-04-04 14:50   ` Adrian Bunk
2002-04-09  7:37     ` Frank Schaefer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox