2005-03-13 13:20:25

by Paweł Sikora

[permalink] [raw]
Subject: [2.6.11.3] gcc4 / psmouse.h - compilation fix.

Hi,

Attched patch fixes gcc error:
`drivers/input/mouse/psmouse.h:40: error: field `ps2dev' has incomplete type`

Please apply.

--
/* Copyright (C) 2003, SCO, Inc. This is valuable Intellectual Property. */

#define say(x) lie(x)


Attachments:
(No filename) (260.00 B)
2.6.11.3-gcc4-psmouse.patch (452.00 B)
Download all attachments

2005-03-13 16:48:54

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [2.6.11.3] gcc4 / psmouse.h - compilation fix.

On Sunday 13 March 2005 08:20, Paweł Sikora wrote:
> Hi,
>
> Attched patch fixes gcc error:
> `drivers/input/mouse/psmouse.h:40: error: field `ps2dev' has incomplete type`
>

What file fails compilation? As far as I can see all users of psmouse.h do
#include <linux/libps2.h> first.

--
Dmitry

2005-03-13 16:54:38

by Paweł Sikora

[permalink] [raw]
Subject: Re: [2.6.11.3] gcc4 / psmouse.h - compilation fix.

On Sunday 13 of March 2005 17:48, Dmitry Torokhov wrote:
> On Sunday 13 March 2005 08:20, Paweł Sikora wrote:
> > Hi,
> >
> > Attched patch fixes gcc error:
> > `drivers/input/mouse/psmouse.h:40: error: field `ps2dev' has incomplete
> > type`
>
> What file fails compilation?

custom patch for trackpoint device.

> As far as I can see all users of psmouse.h do
> #include <linux/libps2.h> first.

IMHO each header (e.g. psmouse.h) should include headers for types it uses.

--
/* Copyright (C) 2003, SCO, Inc. This is valuable Intellectual Property. */

#define say(x) lie(x)

2005-03-13 17:30:15

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [2.6.11.3] gcc4 / psmouse.h - compilation fix.

On Sunday 13 March 2005 11:54, Paweł Sikora wrote:
> On Sunday 13 of March 2005 17:48, Dmitry Torokhov wrote:
> > On Sunday 13 March 2005 08:20, Paweł Sikora wrote:
> > > Hi,
> > >
> > > Attched patch fixes gcc error:
> > > `drivers/input/mouse/psmouse.h:40: error: field `ps2dev' has incomplete
> > > type`
> >
> > What file fails compilation?
>
> custom patch for trackpoint device.
>
> > As far as I can see all users of psmouse.h do
> > #include <linux/libps2.h> first.
>
> IMHO each header (e.g. psmouse.h) should include headers for types it uses.
>

Hmm, I thought it was other way around to make it easier to track all users
of a particular header file.

--
Dmitry

2005-03-13 21:39:18

by Paul Jackson

[permalink] [raw]
Subject: Re: [2.6.11.3] gcc4 / psmouse.h - compilation fix.

Dmitry, responding to Pawe__:
> > IMHO each header (e.g. psmouse.h) should include headers for types it uses.
> >
>
> Hmm, I thought it was other way around

I tend to agree with Pawe__ here.

There are two extremes here that I would avoid. Do not try to include
in source files every header that is directly or indirectly needed, nor
try to minimize inclusions in header files by relying on every possible
prerequisite inclusion by the includers of that header.

Rather - think about the interface presented and used.

A source file should include headers for everything that it manifestly
makes use of (even if that means it happened to include something that
was also indirectly included elsewhere). And no more.

A header file should provide all the inclusions that its users
(includers) will need to make use of what is in that header file,
without presuming that any user will already have included something
else. And no less.

In this case, it seems that the header drivers/input/mouse/psmouse.h
requires the size of a struct ps2dev. So I would think that psmouse.h
should include linux/libps2.h, as this patch provides for. The users
of psmouse.h should not have to know of this dependency.

Respect the interfaces. They are one of the means whereby we partial
out responsibility for keeping code sane, in the face of rapid,
conflicting changes from many developers across many architectures and
drivers, where no one individual can test all possible configurations.

A user of psmouse.h should not be required to include the libps2.h
header, because someday a user of psmouse.h that didn't do this, but was
working anyway because it happened to get libps2.h from some other
indirect inclusion, will get broken when someone working in a quite
different area happens to deprive our hapless psmouse.h user of its
libps2.h.

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.650.933.1373, 1.925.600.0401