Missing stdint.h includes?
Raphael Kubo da Costa
kubito at gmail.com
Sun Feb 6 03:40:01 UTC 2011
Garrett Cooper <gcooper at FreeBSD.org> writes:
> On Sat, Feb 5, 2011 at 3:42 PM, Raphael Kubo da Costa <kubito at gmail.com> wrote:
>> As for devinfo.h, shouldn't it just include stdint.h, sys/types.h or
>> sys/param.h?
>
> sys/types.h should suffice, even though POSIX says it should be in
> inttypes.h: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/inttypes.h.html#tag_13_20
>
> Kind of odd why they're redefined there (in sys/types.h) to be honest,
> esp because POSIX doesn't say that they should be defined there.
> Probably some pollution introduced that would widely break compiles
> because sys/types.h is used everywhere, not inttypes.h.
>
>> What's the best way for me to help with this, PR-wise?
>
> I would honestly not go create more PR fodder. Just find a (doc?)
> developer with a commit bit who's interested in cleaning up
> incorrectness.
I've inlined two patches below:
* The first one should correct the documentation for rman(9). I'm sure
there are problems with other headers, but I haven't checked yet. It
adds sys/types.h to the man page -- I'm not sure if inttypes.h would
be better (DragonFly just adds sys/param.h, FWIW).
* The second one makes devinfo.h include sys/types.h instead of
sys/_types.h -- I still think devinfo.h users should not need to
explicitly include whateverdefinesuint32_t.h, as this, IMHO, is an
implementation detail. It also adds the include to devinfo_var.h,
which, although not installed, should be self-contained. Feedback
very welcome.
As a sidenote, what is the purpose of having both types.h and _types.h?
Thanks!
Patch 1:
Index: stable/8/share/man/man9/rman.9
===================================================================
--- stable/8/share/man/man9/rman.9 (revision 218362)
+++ stable/8/share/man/man9/rman.9 (working copy)
@@ -55,6 +55,7 @@
.Nm rman_get_rid
.Nd resource management functions
.Sh SYNOPSIS
+.In sys/types.h
.In sys/rman.h
.Ft int
.Fn rman_activate_resource "struct resource *r"
Patch 2:
Index: stable/8/lib/libdevinfo/devinfo.h
===================================================================
--- stable/8/lib/libdevinfo/devinfo.h (revision 218362)
+++ stable/8/lib/libdevinfo/devinfo.h (working copy)
@@ -31,7 +31,7 @@
#define _DEVINFO_H_INCLUDED
#include <sys/cdefs.h>
-#include <sys/_types.h>
+#include <sys/types.h>
typedef __uintptr_t devinfo_handle_t;
#define DEVINFO_ROOT_DEVICE ((devinfo_handle_t)0)
Index: stable/8/lib/libdevinfo/devinfo_var.h
===================================================================
--- stable/8/lib/libdevinfo/devinfo_var.h (revision 218362)
+++ stable/8/lib/libdevinfo/devinfo_var.h (working copy)
@@ -27,6 +27,7 @@
* $FreeBSD$
*/
+#include <sys/types.h>
#include <sys/rman.h>
#include <sys/bus.h>
More information about the freebsd-hackers
mailing list