[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.
Signature · 3 lines
/* Copyright (C) 2003, SCO, Inc. This is valuable Intellectual Property. */
#define say(x) lie(x)drivers/input/mouse/psmouse.h:40: error: field `ps2dev' has incomplete type
drivers/input/mouse/psmouse.h renamed from drivers/input/mouse/psmouse.h.orig +2 -0
@@ -1,6 +1,8 @@#ifndef _PSMOUSE_H#define _PSMOUSE_H +#include <linux/libps2.h> +#define PSMOUSE_CMD_SETSCALE11 0x00e6#define PSMOUSE_CMD_SETSCALE21 0x00e7#define PSMOUSE_CMD_SETRES 0x10e8
Quoted 5 lines · Paweł Sikora
Hi,
Attched patch fixes gcc error:
drivers/input/mouse/psmouse.h:40: error: fieldps2dev' has incomplete type`
What file fails compilation? As far as I can see all users of psmouse.h do #include <linux/libps2.h> first.
Signature · 1 line
Dmitry
Quoted 8 lines · Dmitry Torokhov
Quoted 5 lines · Paweł Sikora
Hi,
Attched patch fixes gcc error:
drivers/input/mouse/psmouse.h:40: error: fieldps2dev' has incomplete type`What file fails compilation?
custom patch for trackpoint device.
Quoted 2 lines
As far as I can see all users of
psmouse.hdo
#include <linux/libps2.h> first.
IMHO each header (e.g. psmouse.h) should include headers for types it uses.
Signature · 3 lines
/* Copyright (C) 2003, SCO, Inc. This is valuable Intellectual Property. */
#define say(x) lie(x)Quoted 8 lines · Paweł Sikora
Quoted 7 lines · Dmitry Torokhov
Quoted 5 lines · Paweł Sikora
Hi,
Attched patch fixes gcc error:
drivers/input/mouse/psmouse.h:40: error: fieldps2dev' has incomplete type`
Quoted 9 lines
Quoted 1 line
What file fails compilation?
custom patch for trackpoint device.
Quoted 2 lines
As far as I can see all users of
psmouse.hdo
#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.
Signature · 1 line
Dmitry
Dmitry, responding to Pawe__:
Quoted 4 lines
Quoted 2 lines
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.
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.650.933.1373, 1.925.600.0401