From owner-svn-src-head@FreeBSD.ORG Fri Nov 16 17:24:23 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 13DC988D; Fri, 16 Nov 2012 17:24:23 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx06.syd.optusnet.com.au (fallbackmx06.syd.optusnet.com.au [211.29.132.8]) by mx1.freebsd.org (Postfix) with ESMTP id 93EEF8FC12; Fri, 16 Nov 2012 17:24:22 +0000 (UTC) Received: from mail17.syd.optusnet.com.au (mail17.syd.optusnet.com.au [211.29.132.198]) by fallbackmx06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qAGHOFJL028439; Sat, 17 Nov 2012 04:24:15 +1100 Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail17.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qAGHO6e2005420 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 17 Nov 2012 04:24:07 +1100 Date: Sat, 17 Nov 2012 04:24:06 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov Subject: Re: svn commit: r243134 - head/sys/sys In-Reply-To: <20121116160539.GN73505@kib.kiev.ua> Message-ID: <20121117040901.I3439@besplex.bde.org> References: <201211160625.qAG6PLd2032062@svn.freebsd.org> <20121116160539.GN73505@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-Cloudmark-Score: 0 X-Optus-Cloudmark-Analysis: v=2.0 cv=eqGHVfVX c=1 sm=1 a=zCgzHOi_n5gA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=FSHVhTTuonsA:10 a=6I5d2MoRAAAA:8 a=lhpCGoIDFwqhNO8tG2kA:9 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: svn-src-head@freebsd.org, mdf@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org 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, 16 Nov 2012 17:24:23 -0000 On Fri, 16 Nov 2012, Konstantin Belousov wrote: > On Fri, Nov 16, 2012 at 08:02:39AM -0800, mdf@FreeBSD.org wrote: >> On Thu, Nov 15, 2012 at 10:25 PM, Konstantin Belousov wrote: >>> Author: kib >>> Date: Fri Nov 16 06:25:20 2012 >>> New Revision: 243134 >>> URL: http://svnweb.freebsd.org/changeset/base/243134 >>> >>> Log: >>> Alphabetically reorder the forward-declarations of the structures. >>> Add the declaration for enum idtype, to be used later. >> >> Forward declarations of enums isn't an ISO C feature, but a gcc >> extension. While the kernel uses many gcc extensions, it hides most >> under a #define so unsupported compilers can continue along. This >> unsupported feature can't be hidden. Ugh. We discussed the unportability of enums in APIs when cleaning this up. kib said that the size of an enum type is an ABI standard for i386 and amd64. I don't quite agree for i386, and we didn't discuss other arches. The size of an enum type must be fixed for the gcc extension to be possible. gcc -std=c99 -pedantic generates a warning for forward enum declaration. Long ago, I routinely tested with -pedantic and committed fixes for all the things that it found if they were not too hard to fix. >> Does the forward declaration prevent another warning? > > It allows to prevent the namespace pollution from sys/wait.h idtype_t, needed > due to the kern_wait6() declaration. syscallsubr.h and especially sysproto.h have lots of other namespace pollution. My version of sysproto.h reduces the pollution to just using 6 #define hacks and 1 clean #include change to reduce 5 polluting headers and 1 non-polluting one to 1 different non-polluting one. The #define hacks can't work for enums. When I worked on reducing the pollution in sysproto.h in its automatic generation, I got it down to and not much more. because available later, but -current still has the full pollution of and much more. Non-auto-generated headers like syscallsubr.h are easier to clean. Bruce