Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Nov 2015 23:11:03 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Bruce Evans <brde@optusnet.com.au>, Svatopluk Kraus <onwahe@gmail.com>,  "Conrad E. Meyer" <cem@freebsd.org>, src-committers@freebsd.org,  svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r290475 - in head: share/man/man9 sys/kern sys/sys
Message-ID:  <20151107225124.T1837@besplex.bde.org>
In-Reply-To: <20151107112149.GV2257@kib.kiev.ua>
References:  <201511070143.tA71h13k038232@repo.freebsd.org> <CAFHCsPUagzwtFZvJ10bAeEH8y8Lkz0N1WL99fbBiBKOb=Mk-rQ@mail.gmail.com> <20151107205927.P1514@besplex.bde.org> <20151107112149.GV2257@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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