From owner-svn-src-all@freebsd.org Thu May 5 11:15:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F9D1B2E4DA; Thu, 5 May 2016 11:15:02 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id 130431AD3; Thu, 5 May 2016 11:15:01 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 693F43C472A; Thu, 5 May 2016 21:14:50 +1000 (AEST) Date: Thu, 5 May 2016 21:14:49 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: John Baldwin , Bruce Evans , Pedro Giffuni , "Ngie Cooper (yaneurabeya)" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r298933 - in head: share/man/man9 sys/amd64/include sys/dev/acpica sys/dev/drm2 sys/dev/drm2/i915 sys/kern sys/sys sys/x86/acpica sys/x86/x86 In-Reply-To: <20160505084222.GD2422@kib.kiev.ua> Message-ID: <20160505203633.Y2142@besplex.bde.org> References: <201605021800.u42I0cjK084243@repo.freebsd.org> <20160504031930.A3395@besplex.bde.org> <1928389.rOu33C1eaq@ralph.baldwin.cx> <2067797.hs1zGgLCXN@ralph.baldwin.cx> <20160505084222.GD2422@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=TuMb/2jh c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=ZiMdzixFXulCbZCmoCYA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2016 11:15:02 -0000 On Thu, 5 May 2016, Konstantin Belousov wrote: > On Wed, May 04, 2016 at 09:17:50PM -0700, John Baldwin wrote: >> ... >> How about this: >> ... >> diff --git a/sys/sys/_bitset.h b/sys/sys/_bitset.h >> index 26a8848..89dd7b6 100644 >> --- a/sys/sys/_bitset.h >> +++ b/sys/sys/_bitset.h >> @@ -36,26 +36,15 @@ >> * Macros addressing word and bit within it, tuned to make compiler >> * optimize cases when SETSIZE fits into single machine word. >> */ >> -#define _BITSET_BITS (sizeof(long) * NBBY) >> +#define _BITSET_BITS (sizeof(long) * 8) >> >> -#define __bitset_words(_s) (howmany(_s, _BITSET_BITS)) >> +#define _howmany(x, y) (((x) + ((y) - 1)) / (y)) > The _howmany symbol is still in the user namespace. Implementation-reserved > names are __.* and _[A-Z].* . The names _.* also are reserved at file scope. sys/select.h also uses _howmany(), and that is correct there since it is only used in inner scopes that the application cannot conflict with (except possibly via -Wshadow warnings). I haven't checked this in the patch yet, but it is probably the same. In select.h, the inner scopes are one inside a struct declaration and one inside a compound statement in a statement-like macro. I like to use minimal underscores since 2 underscores are uglier. select.h does this perfectly or almost perfectly. An example of this is the __fd_mask typedef. This is used in non-inner scopes so it needs 2 underscores. The above fixes the bogus underscore on _s. 1 underscore is also ugly, and this one shows lack of understanding of namespaces. Underscores are never needed for macro parameters since they create their their own namespace. Bruce