From owner-svn-src-all@FreeBSD.ORG Tue May 19 05:57:03 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 26D91E1C; Tue, 19 May 2015 05:57:03 +0000 (UTC) Received: from mail-pa0-x22b.google.com (mail-pa0-x22b.google.com [IPv6:2607:f8b0:400e:c03::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E67C31EC4; Tue, 19 May 2015 05:57:02 +0000 (UTC) Received: by padbw4 with SMTP id bw4so9021989pad.0; Mon, 18 May 2015 22:57:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=dvx9mVNOMyM06e2VjTyMpZ8YZY507RjyttNsLTTO6/s=; b=FwD5wlwIoHZafhHcGaYMO7PyyarmZvfb3jENgJt+Pp6C46bQ978kVF22QCtbdp0wGf ihRhLWBa8zMpn7Pqz7EHbZ/mWtBUNswloIWOjA1rNoelcS4kLoBQGEU7KMVy6sR1jPa7 XBFaGl42fSHR36BE9zHjJY2Rxym5je9vpxiF/WlF4oW5kAA2vssi2FkHKJHZ+KJcSQc6 U7mOZYEvVeDenRpjKhkXGnBW0SvYAAHZWPVPr+/FQbfY3Ov2gVBfcCpQ3CcI6EWuR4gR PIYhMgSrKoOIb5HVCzXTbNCBNQ/azE/7abRswC4daRFhuDpKrn3i4m766lyglSGThA8y 6Irg== X-Received: by 10.68.219.1 with SMTP id pk1mr50386081pbc.18.1432015022571; Mon, 18 May 2015 22:57:02 -0700 (PDT) Received: from [192.168.169.90] (c-67-170-85-91.hsd1.wa.comcast.net. [67.170.85.91]) by mx.google.com with ESMTPSA id rx6sm10032079pbc.54.2015.05.18.22.57.01 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 May 2015 22:57:01 -0700 (PDT) References: <201505182227.t4IMRljx078812@svn.freebsd.org> <20150519113755.U1840@besplex.bde.org> <406A7AE3-1891-4B2C-B917-14C150EBBAB5@FreeBSD.org> <20150519135341.R2157@besplex.bde.org> Mime-Version: 1.0 (1.0) In-Reply-To: Message-Id: <161C0DB1-E570-4A92-A98B-4098C510E96B@gmail.com> Cc: Bruce Evans , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Mailer: iPhone Mail (12F70) From: Garrett Cooper Subject: Re: svn commit: r283088 - head/sys/ddb Date: Mon, 18 May 2015 22:56:31 -0700 To: Pedro Giffuni Content-Type: text/plain; charset=cp932 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 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 05:57:03 -0000 > On May 18, 2015, at 22:28, Pedro Giffuni wrote: >=20 >=20 >> Il giorno 18/mag/2015, alle ore 23:34, Bruce Evans = ha scritto: >>=20 >> On Mon, 18 May 2015, Pedro Giffuni wrote: >>=20 >>>> Il giorno 18/mag/2015, alle ore 20:48, Bruce Evans ha scritto: >>>>=20 >>>>> On Mon, 18 May 2015, Pedro F. Giffuni wrote: >>>>>=20 >>>>> Log: >>>>> ddb: stop boolean screaming. >>>>>=20 >>>>> TRUE --> true >>>>> FALSE--> false >>>>>=20 >>>>> Hinted by: NetBSD >>>>=20 >>>> This is not just churn to a style regression, but a type mismatch. >>>=20 >>> It is an attempt to reduce differences with NetBSD. >>=20 >> For that, apply the reverse change to NetBSD. >=20 > Actually, the NetBSD code uses bool. (I hate CVS, commits are not atomic.)= >=20 >>> One of the complaints of hear from newcomers to the ddb code is that >>> the format is old-fashioned (it still had pre-ANSI headers not long ago)= >>> and unmaintained. >>=20 >> It is fairly well maintained (not churned to unimprove its portability). >> Why would newcomers want too look at it? >=20 > Unrelated fun: last year a student started adding support for CTF and pret= ty printing of the kernel structures. I think the NetBSD guys have been havi= ng fun with Lua. >=20 >=20 >>>>> 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 Mon May 18 22:14:06 2015 (r2= 83087) >>>>> +++ head/sys/ddb/db_break.c Mon May 18 22:27:46 2015 (r2= 83088) >>>>> @@ -155,12 +155,12 @@ db_find_breakpoint_here(db_addr_t addr) >>>>> return db_find_breakpoint(db_map_addr(addr), addr); >>>>> } >>>>>=20 >>>>> -static boolean_t db_breakpoints_inserted =3D TRUE; >>>>> +static boolean_t db_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 difference,= >>>> because TRUE happens to be implemented with the same value as true and >>>> there are lots of implicit versions between the types. >>>=20 >>> Yes, I noticed the return types are still ints. It doesn=81ft look diffi= cult >>> to convert it to use a real boolean type. In any case, I would prefer t= o 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 mist= ake >> 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 used 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 mistake.= >> 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 > OK, I do understand the kernel wants to keep the C dialect somewhat limite= d, > and adding stdbool.h doesn=81ft buy us any type safety here. >=20 > I=81fll revert the change (prob. tomorrow though). Too bad. You could just convert bool to an enum, add a compile-time assert, a= nd chase down all of the -Werrors with clang... ... Nevermind. Not fun :(..=