From owner-svn-src-head@FreeBSD.ORG Fri Apr 12 08:46:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0EBB82EB; Fri, 12 Apr 2013 08:46:46 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id A13181798; Fri, 12 Apr 2013 08:46:45 +0000 (UTC) Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r3C8kSE5031870 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 12 Apr 2013 18:46:30 +1000 Date: Fri, 12 Apr 2013 18:46:28 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Garrett Cooper Subject: Re: svn commit: r249355 - head/lib/libkvm In-Reply-To: <6ABB36AE-A7AB-4A06-82B9-5E3F07F18AAC@gmail.com> Message-ID: <20130412182135.M1222@besplex.bde.org> References: <201304110730.r3B7Uo6d067302@svn.freebsd.org> <20130411175308.Q1435@besplex.bde.org> <5166FD40.6040102@freebsd.org> <6ABB36AE-A7AB-4A06-82B9-5E3F07F18AAC@gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=HfxM1V48 c=1 sm=1 a=YIxocstYFt4A:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=RPTfz7_hRNcA:10 a=61DczPY8zHOY0A7g9e8A:9 a=CjuIK1q_8ugA:10 a=HZS-E-n1ygOHqO4r:21 a=uEd-T1FI1J5-Rb3g:21 a=TEtd8y5WR3g2ypngnwZWYw==:117 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Gleb Smirnoff , src-committers@freebsd.org, Colin Percival X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 12 Apr 2013 08:46:46 -0000 On Thu, 11 Apr 2013, Garrett Cooper wrote: > On Apr 11, 2013, at 11:13 AM, Colin Percival wrote: > >> On 04/11/13 00:59, Bruce Evans wrote: >>>> Log: >>>> Include types.h for C99 uintXX_t types. >>> >>> This adds namespace pollution that was carefully left out. >> >> ... and as a developer, I wish we left out such namespace pollution more often. >> >> I write code on FreeBSD which I then publish with the intention that people will >> be able to use it on any POSIX-compliant system, and I've lost count of the >> number of times I've been hit by "this won't build on OS X or Linux because you >> forgot to #include ". Declaring uint64_t and a few other stdint types in does tend to give bugs like that. And the pollution is pointless for the kernel (which was originally the only place that used it), since is now polluted with an include of -- a change that I disagee with. I also disagree with the existence of so many foo/[_]stdint.h headers. There is a machine/_stdint.h and a sys/_stdint.h, a sys/stdint.h and of course a plain stdint.h. At least sys/_stdint.h shouldn't exist. All it does is avoid repeatung the ifdefs for the stdint pollution in sys/types.h. But it was created long after the much larger pollution in sys/systm.h, so it does nothing for the kernel. For userland, it gives the above problem, but it has been there for so long that it is very hard to untangle. sys/types.h still has a comment saying that it shoudn't do this. I have only fixed bugs in this comment and a few nearby things: @ Index: types.h @ =================================================================== @ RCS file: /home/ncvs/src/sys/sys/types.h,v @ retrieving revision 1.90 @ diff -u -2 -r1.90 types.h @ --- types.h 19 Jun 2004 17:58:32 -0000 1.90 @ +++ types.h 20 Jun 2004 02:03:26 -0000 @ @@ -40,8 +40,7 @@ @ @ #include @ +#include @ @ -/* Machine type dependent parameters. */ @ #include @ -#include @ @ #if __BSD_VISIBLE Sort includes and remove wrong comment. machine/endian.h doesn't contain type parameters. sys/_types.h contains typedefs, not parameters. @ @@ -57,5 +56,5 @@ @ @ /* @ - * XXX POSIX sized integrals that should appear only in . @ + * XXX C99 integer types that should appear only in . @ */ @ #ifndef _INT8_T_DECLARED These types have nothing to do with POSIX, > Funny this would be mentioned. I've seen the converse a lot with Linux devs because they fail to understand that headers on Linux #include a lot more crud than they need to.. > Devs in general don't read the [POSIX] manpages like they should to figure out what needs to be #include'd in order to get function/constant definitions. Third party devs are usually the worst offenders. That's a bit surprising, since glibc tries much harder than FreeBSD to avoid namespace pollution. It has labyrinth includes, partly to avoid namespace pollution and partly to handle machine dependencies. This makes even simple headers unreadable. E.g., fcntl.h. Bruce