svn commit: r290475 - in head: share/man/man9 sys/kern sys/sys

Bruce Evans brde at optusnet.com.au
Sat Nov 7 12:11:08 UTC 2015


On Sat, 7 Nov 2015, Konstantin Belousov wrote:

> On Sat, Nov 07, 2015 at 09:25:32PM +1100, Bruce Evans wrote:
>> ...
>> I put intptr_t in <sys/types.h> long ago, since it was more needed and
>> less magic than intmax_t.  This was obfuscated by moving it to
>> <sys/_stdint.h> and including that in various places.  intmax_t is
>> still only in <sys/stdint.h> which is much larger.  It and uintmax_t
>> should be together with intptr_t.  That is more polluting in theory
>> but less in practice.
>
> In other words, do you suggest the following change to fix the compilation ?
>
> diff --git a/sys/sys/_stdint.h b/sys/sys/_stdint.h
> index d0f9249..a0fe0ad 100644
> --- a/sys/sys/_stdint.h
> +++ b/sys/sys/_stdint.h
> @@ -78,5 +78,13 @@ typedef	__intptr_t		intptr_t;
> typedef	__uintptr_t		uintptr_t;
> #define	_UINTPTR_T_DECLARED
> #endif
> +#ifndef _INTMAX_T_DECLARED
> +typedef	__intmax_t		intmax_t;
> +#define	_INTMAX_T_DECLARED
> +#endif
> +#ifndef _UINTMAX_T_DECLARED
> +typedef	__uintmax_t		uintmax_t;
> +#define	_UINTMAX_T_DECLARED
> +#endif
>
> #endif /* !_SYS__STDINT_H_ */
> ...

Yes, but some source file is apparently not including <sys/systm.h>.
It is probably trying to be too smart and only including <sys/types.h>.
This bug was detected as a side effect of <sys/sysctl.h> growing a
dependency on <sys/systm.h>.

The most exotic type used in <sys/sysctl.h> is counter_u64_t.  The magic
for getting this defined without much namespace pollution seems to be
that it is only used in a macro that is only used by source files that
include <sys/counter.h>.  Macros often work like that.  Here intmax_t
is always needed since it is in an unconditional declaration.

Bruce


More information about the svn-src-all mailing list