Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 09 Feb 2011 21:54:51 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Missing stdint.h includes?
Message-ID:  <4D536F9B.6070809@bsdimp.com>
In-Reply-To: <87sjw1rfuo.fsf@gmail.com>
References:  <87vd0ys2no.fsf@gmail.com>	<AANLkTimS-Ue_HmZ-rbU7k0WnmCFU9hns2KSo_ZiESkgQ@mail.gmail.com>	<87fws2rqui.fsf@gmail.com>	<AANLkTinb49f6jq73BoxTiMOZhmS=Tc%2BdwP8juuv2%2BOt4@mail.gmail.com> <87sjw1rfuo.fsf@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 02/05/2011 20:39, Raphael Kubo da Costa wrote:
> Garrett Cooper<gcooper@FreeBSD.org>  writes:
>
>> On Sat, Feb 5, 2011 at 3:42 PM, Raphael Kubo da Costa<kubito@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>
>
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
>
>
>
committed.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D536F9B.6070809>