[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Patch that breaks the gnumach build
From: |
Samuel Thibault |
Subject: |
Re: [PATCH] Patch that breaks the gnumach build |
Date: |
Thu, 5 Dec 2013 05:36:51 +0900 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Marin Ramesa, le Mon 02 Dec 2013 20:06:34 +0100, a écrit :
> On 02.12.2013 14:38:28, Samuel Thibault wrote:
> > Marin Ramesa, le Sun 01 Dec 2013 10:47:53 +0100, a écrit :
> > > I need some help. I'm trying to fix a GCC warning by modifying the
> > > struct dev_ops in device/conf.h. I need the definition of io_req_t
> > > to do that. But when I include device/io_req.h from device/conf.h
> > > the build breaks with this error message:
> > >
> > > In file included from ../vm/pmap.h:45:0,
> > > from ../vm/vm_object.h:49,
> > > from ../vm/vm_page.h:40,
> > > from ../device/io_req.h:41,
> > > from ../device/conf.h:35,
> > > from ../device/dev_hdr.h:64,
> > > from ./machine/io_perm.h:26,
> > > from ../i386/i386/tss.h:32,
> > > from ../i386/i386/thread.h:43,
> > > from ./machine/db_machdep.h:37,
> > > from ../ddb/db_access.c:34:
> > > ../kern/thread.h:81:2: error: unknown type name "pcb_t"
> > >
> > > gnumach has been configured with --enable-kdb.
> > >
> > > kern/thread.h already includes i386/i386/thread.h which defines the
> > > pcb_t, so I don't understand why GCC fails with this error message
> > > when everything is OK.
> > >
> > > Does anybody have any idea what is happening?
> >
> > An inclusion loop I guess?
>
> Yes it is: device/conf.h includes device/io_req.h, which includes
> device/dev_hdr.h, which includes device/conf.h, which includes device/
> io_req.h ... and it goes in a loop.
>
> I don't know how to fix this. I tried stopping it with ifndefs around
> includes, but that doesn't seem to work.
You can use forward structure declaration: instead of including a .h
file, you can predeclare the structures you need from it:
struct foo;
typedef struct foo *foo_t;
Provided that it's only used via a pointer, the compiler will be fine
with it.
Samuel