From owner-svn-src-head@FreeBSD.ORG Fri May 6 08:38:03 2011 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43295106564A; Fri, 6 May 2011 08:38:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id BF7C08FC0A; Fri, 6 May 2011 08:38:02 +0000 (UTC) Received: from c122-106-155-58.carlnfd1.nsw.optusnet.com.au (c122-106-155-58.carlnfd1.nsw.optusnet.com.au [122.106.155.58]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p468bwK5023533 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 6 May 2011 18:38:00 +1000 Date: Fri, 6 May 2011 18:37:58 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "David E. O'Brien" In-Reply-To: <201105051445.p45EjPL2004080@svn.freebsd.org> Message-ID: <20110506180643.C1014@besplex.bde.org> References: <201105051445.p45EjPL2004080@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r221502 - in head: lib/libutil sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2011 08:38:03 -0000 On Thu, 5 May 2011, David E. O'Brien wrote: > Log: > Don't duplicate define the stdint types. This is a regression. The [_]stdint.h files were correctly structured before. The stdint types weren't duplicate-defined (modulo bugs), but their definitions were repeated as necessary inside ifdfs. Using an omnibus header like sys/_stdint.h gives uncontrollable namespace pollution. > head/sys/sys/_stdint.h > - copied, changed from r221139, head/sys/sys/stdint.h sys/_stdint.h was intentionally left out, since it can only be used to increase namespace pollution (unlike machine/_stdint.h, which exists to avoid namespace pollution). > Modified: head/lib/libutil/libutil.h > ============================================================================== > --- head/lib/libutil/libutil.h Thu May 5 14:43:35 2011 (r221501) > +++ head/lib/libutil/libutil.h Thu May 5 14:45:24 2011 (r221502) > @@ -41,22 +41,13 @@ > > #include > #include > +#include This also unsorts the includes. > #ifndef _GID_T_DECLARED > typedef __gid_t gid_t; > #define _GID_T_DECLARED > #endif > > -#ifndef _INT64_T_DECLARED > -typedef __int64_t int64_t; > -#define _INT64_T_DECLARED > -#endif > - > -#ifndef _UINT64_T_DECLARED > -typedef __uint64_t uint64_t; > -#define _UINT64_T_DECLARED > -#endif > - It used to define only 2 application types from . Hopefully precisely the ones that it used. Now it defines all the application types defined in , and it can't control pollution bloat if the latter is expanded. > #ifndef _PID_T_DECLARED > typedef __pid_t pid_t; > #define _PID_T_DECLARED > > Copied and modified: head/sys/sys/_stdint.h (from r221139, head/sys/sys/stdint.h) > ============================================================================== > --- head/sys/sys/stdint.h Wed Apr 27 20:42:30 2011 (r221139, copy source) > +++ head/sys/sys/_stdint.h Thu May 5 14:45:24 2011 (r221502) > @@ -1,4 +1,5 @@ > /*- > + * Copyright (c) 2011 David E. O'Brien > * Copyright (c) 2001 Mike Barcroft > * All rights reserved. > * > @@ -26,13 +27,8 @@ > * $FreeBSD$ > */ > > -#ifndef _SYS_STDINT_H_ > -#define _SYS_STDINT_H_ > - > -#include > -#include > - > -#include > +#ifndef _SYS__STDINT_H_ > +#define _SYS__STDINT_H_ > > #ifndef _INT8_T_DECLARED > typedef __int8_t int8_t; > @@ -74,33 +70,13 @@ typedef __uint64_t uint64_t; > #define _UINT64_T_DECLARED > #endif > > -typedef __int_least8_t int_least8_t; > -typedef __int_least16_t int_least16_t; > -typedef __int_least32_t int_least32_t; > -typedef __int_least64_t int_least64_t; > - > -typedef __uint_least8_t uint_least8_t; > -typedef __uint_least16_t uint_least16_t; > -typedef __uint_least32_t uint_least32_t; > -typedef __uint_least64_t uint_least64_t; > - > -typedef __int_fast8_t int_fast8_t; > -typedef __int_fast16_t int_fast16_t; > -typedef __int_fast32_t int_fast32_t; > -typedef __int_fast64_t int_fast64_t; > - > -typedef __uint_fast8_t uint_fast8_t; > -typedef __uint_fast16_t uint_fast16_t; > -typedef __uint_fast32_t uint_fast32_t; > -typedef __uint_fast64_t uint_fast64_t; > - > -typedef __intmax_t intmax_t; > -typedef __uintmax_t uintmax_t; > - > #ifndef _INTPTR_T_DECLARED > typedef __intptr_t intptr_t; > -typedef __uintptr_t uintptr_t; > #define _INTPTR_T_DECLARED > #endif > +#ifndef _UINTPTR_T_DECLARED > +typedef __uintptr_t uintptr_t; > +#define _UINTPTR_T_DECLARED > +#endif > > -#endif /* !_SYS_STDINT_H_ */ > +#endif /* !_SYS__STDINT_H_ */ > > Modified: head/sys/sys/stdint.h > ============================================================================== > --- head/sys/sys/stdint.h Thu May 5 14:43:35 2011 (r221501) > +++ head/sys/sys/stdint.h Thu May 5 14:45:24 2011 (r221502) > @@ -33,46 +33,7 @@ > #include > > #include > - > -#ifndef _INT8_T_DECLARED > -typedef __int8_t int8_t; > -#define _INT8_T_DECLARED > -#endif > - > -#ifndef _INT16_T_DECLARED > -typedef __int16_t int16_t; > -#define _INT16_T_DECLARED > -#endif > - > -#ifndef _INT32_T_DECLARED > -typedef __int32_t int32_t; > -#define _INT32_T_DECLARED > -#endif > - > -#ifndef _INT64_T_DECLARED > -typedef __int64_t int64_t; > -#define _INT64_T_DECLARED > -#endif > - > -#ifndef _UINT8_T_DECLARED > -typedef __uint8_t uint8_t; > -#define _UINT8_T_DECLARED > -#endif > - > -#ifndef _UINT16_T_DECLARED > -typedef __uint16_t uint16_t; > -#define _UINT16_T_DECLARED > -#endif > - > -#ifndef _UINT32_T_DECLARED > -typedef __uint32_t uint32_t; > -#define _UINT32_T_DECLARED > -#endif > - > -#ifndef _UINT64_T_DECLARED > -typedef __uint64_t uint64_t; > -#define _UINT64_T_DECLARED > -#endif > +#include > > typedef __int_least8_t int_least8_t; > typedef __int_least16_t int_least16_t; > @@ -94,13 +55,13 @@ typedef __uint_fast16_t uint_fast16_t; > typedef __uint_fast32_t uint_fast32_t; > typedef __uint_fast64_t uint_fast64_t; > > +#ifndef _INTMAX_T_DECLARED > typedef __intmax_t intmax_t; > +#define _INTMAX_T_DECLARED > +#endif > +#ifndef _UINTMAX_T_DECLARED > typedef __uintmax_t uintmax_t; > - > -#ifndef _INTPTR_T_DECLARED > -typedef __intptr_t intptr_t; > -typedef __uintptr_t uintptr_t; > -#define _INTPTR_T_DECLARED > +#define _UINTMAX_T_DECLARED > #endif > > #endif /* !_SYS_STDINT_H_ */ sys/stdint.h (= ) is obfuscated by putting its main definitions in sys/_types.h and sys/_stdint.h. Its bad enough that its basic definitions are not visible. Hmm, why does it use sys/_types.h? That only declares POSIX-related typedefs, but cannot declare any POSIX-related types. > Modified: head/sys/sys/types.h > ============================================================================== > --- head/sys/sys/types.h Thu May 5 14:43:35 2011 (r221501) > +++ head/sys/sys/types.h Thu May 5 14:45:24 2011 (r221502) > @@ -60,51 +60,7 @@ typedef unsigned int uint; /* Sys V com > /* > * XXX POSIX sized integrals that should appear only in . > */ As the XXX comment says, it is a bug for these to be declared here at all. Applications must include if they want to use the types in it. Some of the types that should be declared only in are declared here for historical reasons. The pollution has been here so long (together with other pollution), that it is now very hard to clean up. Probably the kernel was the main abuser of the pollution here. here. But now the kernel is even more polluted by default, so the pollution here has almost no effect on the kernel, since was polluted to include mainly for the convenience of casting things to intmax_t, etc., in printfs. > -#ifndef _INT8_T_DECLARED > -typedef __int8_t int8_t; > -#define _INT8_T_DECLARED > -#endif > - > -#ifndef _INT16_T_DECLARED > -typedef __int16_t int16_t; > -#define _INT16_T_DECLARED > -#endif > - > -#ifndef _INT32_T_DECLARED > -typedef __int32_t int32_t; > -#define _INT32_T_DECLARED > -#endif > - > -#ifndef _INT64_T_DECLARED > -typedef __int64_t int64_t; > -#define _INT64_T_DECLARED > -#endif > - > -#ifndef _UINT8_T_DECLARED > -typedef __uint8_t uint8_t; > -#define _UINT8_T_DECLARED > -#endif > - > -#ifndef _UINT16_T_DECLARED > -typedef __uint16_t uint16_t; > -#define _UINT16_T_DECLARED > -#endif > - > -#ifndef _UINT32_T_DECLARED > -typedef __uint32_t uint32_t; > -#define _UINT32_T_DECLARED > -#endif > - > -#ifndef _UINT64_T_DECLARED > -typedef __uint64_t uint64_t; > -#define _UINT64_T_DECLARED > -#endif > - > -#ifndef _INTPTR_T_DECLARED > -typedef __intptr_t intptr_t; > -typedef __uintptr_t uintptr_t; > -#define _INTPTR_T_DECLARED > -#endif > +#include Declaring the pollution in another header expands the bug and makes it harder to see how large it is. > > typedef __uint8_t u_int8_t; /* unsigned integrals (deprecated) */ > typedef __uint16_t u_int16_t; > Bruce