From owner-svn-src-all@FreeBSD.ORG Tue May 19 14:03:04 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0E63393C; Tue, 19 May 2015 14:03:04 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D8CD81FA3; Tue, 19 May 2015 14:03:03 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-54-116-245.nwrknj.fios.verizon.net [173.54.116.245]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id BA4E0B989; Tue, 19 May 2015 10:03:02 -0400 (EDT) From: John Baldwin To: Pedro Giffuni Cc: Bruce Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r283088 - head/sys/ddb Date: Tue, 19 May 2015 09:45:49 -0400 Message-ID: <2053555.dpIzi23R03@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.1-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: References: <201505182227.t4IMRljx078812@svn.freebsd.org> <20150519135341.R2157@besplex.bde.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 19 May 2015 10:03:02 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 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: Tue, 19 May 2015 14:03:04 -0000 On Tuesday, May 19, 2015 12:28:05 AM Pedro Giffuni wrote: > >>>> Modified: head/sys/ddb/db_break.c > >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D > >>>> --- head/sys/ddb/db_break.c=09Mon May 18 22:14:06 2015=09(r28308= 7) > >>>> +++ head/sys/ddb/db_break.c=09Mon May 18 22:27:46 2015=09(r28308= 8) > >>>> @@ -155,12 +155,12 @@ db_find_breakpoint_here(db_addr_t addr) > >>>> =09return db_find_breakpoint(db_map_addr(addr), addr); > >>>> } > >>>>=20 > >>>> -static boolean_t=09db_breakpoints_inserted =3D TRUE; > >>>> +static boolean_t=09db_breakpoints_inserted =3D true; > >>>=20 > >>> This code hasn't been churned to use the boolean type. It still = uses > >>> boolean_t, which is plain int. TRUE and FALSE go with this type.= true > >>> and false go with the boolean type. This probably makes no diffe= rence, > >>> because TRUE happens to be implemented with the same value as tru= e and > >>> there are lots of implicit versions between the types. > >>=20 > >> Yes, I noticed the return types are still ints. It doesn=E2=80=99t= look difficult > >> to convert it to use a real boolean type. In any case, I would pr= efer to go > >> forward (using bool) instead of reverting this change. > >=20 > > That wuld be sideways. > >=20 > > I forgot to mention (again) in my previous reply that boolean_t is = a mistake > > by me. KNF code doesn't even use the ! operator, but uses explicit= > > comparison with 0. The boolean_t type and TRUE and FALSE are from = Mach. > > They were used mainly in ddb and vm, and are still almost never use= d in > > kern. I used to like typedefs and a typedef for boolean types, and= didn't > > know KNF very well, so in 1995 I moved the declaration of boolean_t= from > > Mach vm code to sys/types.h to try to popularize it. This was a mi= stake. > > Fortunately, it is still rarely used in core kernel code. > >=20 > > The boolean type is also almost never used for syscalls. In POSIX.= 1-2001, > > is inherited from C99, but is never used for any other = POSIX > > API. Using it for syscalls would mainly cause portability problems= . > >=20 >=20 > OK, I do understand the kernel wants to keep the C dialect somewhat l= imited, > and adding stdbool.h doesn=E2=80=99t buy us any type safety here. >=20 > I=E2=80=99ll revert the change (prob. tomorrow though). I will disagree with Bruce a bit and put my vote in for replacing boole= an_t with bool where it is used. I do think that logically (if not strictly= ) your commit is a type mismatch as TRUE/FALSE is for boolean_t and true/false= are for bool. I agree with Bruce that we probably don't want to use bool f= or system calls. However, I think using bool in the kernel itself is ok a= nd that we should replace boolean_t with bool. --=20 John Baldwin