From owner-cvs-src@FreeBSD.ORG Mon Jan 30 18:36:51 2006 Return-Path: X-Original-To: cvs-src@freebsd.org Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 58C8F16A420; Mon, 30 Jan 2006 18:36:51 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id B4F6843D62; Mon, 30 Jan 2006 18:36:49 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from [192.168.254.11] (junior.samsco.home [192.168.254.11]) (authenticated bits=0) by pooker.samsco.org (8.13.4/8.13.4) with ESMTP id k0UIam5d008727; Mon, 30 Jan 2006 11:36:48 -0700 (MST) (envelope-from scottl@samsco.org) Message-ID: <43DE5CC5.7020406@samsco.org> Date: Mon, 30 Jan 2006 11:36:53 -0700 From: Scott Long User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20051230 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Peter Jeremy References: <200601292048.k0TKmPSM000635@repoman.freebsd.org> <20060130092205.GB702@turion.vk2pj.dyndns.org> In-Reply-To: <20060130092205.GB702@turion.vk2pj.dyndns.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=3.8 tests=ALL_TRUSTED autolearn=failed version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on pooker.samsco.org Cc: cvs-src@freebsd.org, src-committers@freebsd.org, Scott Long , cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/kern kern_rwlock.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2006 18:36:51 -0000 Peter Jeremy wrote: > On Sun, 2006-Jan-29 20:48:25 +0000, Scott Long wrote: > >> gcc can't >> figure out the order of operations at line 519, and neither can I, but this >> is my best guess. Also correct a number of typos and syntax errors. >> >> Revision Changes Path >> 1.3 +4 -4 src/sys/kern/kern_rwlock.c > > > - if (rw->rw_lock == RW_UNLOCKED || > - !(rw->rw_lock & RW_LOCK_READ) && (what == RW_RLOCKED || > - RW_OWNER(rw) != (uintptr_t)curthread)) > is perfectly well defined in C. Simplifying names/macros/casts: > if (a == b || !(a & c) && (d == e || f != g)) > (partial) precedence rules from operator(7): > () [] -> . left to right > ! ~ ++ -- - (type) * & sizeof right to left > == != left to right > & left to right > && left to right > || left to right > parenthesising to avoid the bottom 4 precedence rules: > if ((a == b) || (!(a & c) && ((d == e) || (f != g)))) > Note that this is different to your patch: > + if ((rw->rw_lock == RW_UNLOCKED || > + !(rw->rw_lock & RW_LOCK_READ)) && (what == RA_RLOCKED || > + (rw_owner(rw) != curthread))) > which turns into: > if ((a == b || !(a & c)) && (d == e || (f != g))) > > If it's just a matter of silencing gcc, I believe that what is wanted > is (with grouping wraps and indents): > * if (rw->rw_lock == RW_UNLOCKED || > * (!(rw->rw_lock & RW_LOCK_READ) && > * (what == RW_RLOCKED || rw_owner(rw) != curthread))) > > Note that the behaviour in 1.2 and 1.3 is different if > (rw->rw_lock == RW_UNLOCKED) > If that's the right logic then please commit it. I was just trying to make the tree compile so that snapshots could be generated. Scott