Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MpGBq-0003MI-4G for mharc-grub-devel@gnu.org; Sun, 20 Sep 2009 02:46:30 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MpGBo-0003Lz-Az for grub-devel@gnu.org; Sun, 20 Sep 2009 02:46:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MpGBn-0003Ln-Cf for grub-devel@gnu.org; Sun, 20 Sep 2009 02:46:27 -0400 Received: from [199.232.76.173] (port=42144 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MpGBn-0003Lk-64 for grub-devel@gnu.org; Sun, 20 Sep 2009 02:46:27 -0400 Received: from fg-out-1718.google.com ([72.14.220.155]:61639) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MpGBm-0007ur-7o for grub-devel@gnu.org; Sun, 20 Sep 2009 02:46:26 -0400 Received: by fg-out-1718.google.com with SMTP id e21so534363fga.12 for ; Sat, 19 Sep 2009 23:46:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=ZlKvqqiqOYyyE9euhNt7daE3snmbDEI/urhxubxxNp4=; b=PrTyKwujHO1kYJwUE0KP1cnTa/bkJgHedCehLykegTVEhs9KvW4Kyt9ig5Rt6fL7aU CGSCxVmfnKzYa/3JcI80Jnc+xb1QHoTjqDiXMGYr6nMcC9Cd9IzuitgLBGi2w1HzniMK Sx4866HoeSwha6c0oGKlwp8Rc0N6KL7XE4rWw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=nF2tnA8/7aKd7ox077TdbMZ/vGWDVEI7C05+0cIGc9ka4sqzSPN4sug0HATOO3insd 7WdJ3ngwtBCVzgB+Ut0W8n0fwuimUI971RcGW8fxuG0VYsU8dbkGen+EufJ7TeWX2rk8 /OEQKPr5zc+LVay3oVVX7izwoAVCBAECNjuMs= MIME-Version: 1.0 Received: by 10.239.183.22 with SMTP id s22mr259879hbg.6.1253429185055; Sat, 19 Sep 2009 23:46:25 -0700 (PDT) In-Reply-To: <4AB4E6EB.4010307@gmail.com> References: <20090916194214.GA22363@thorin> <4AB4E6EB.4010307@gmail.com> Date: Sun, 20 Sep 2009 01:46:25 -0500 Message-ID: <2e59e6970909192346h16fc71a2tc29d4441b951f7d3@mail.gmail.com> From: "richardvoigt@gmail.com" To: The development of GRUB 2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: rmh@aybabtu.com Subject: Re: -Werror and --disable-werror X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Sep 2009 06:46:28 -0000 On Sat, Sep 19, 2009 at 9:12 AM, Vladimir 'phcoder' Serbinenko wrote: > Robert Millan wrote: >> Hi, >> >> -Werror is not in effect. =C2=A0This will help ensuring that all new cod= e is >> checked to be warning-free before commit (incidentally, I found a newly >> introduced bug thanks to this just minutes before enabling it). >> >> > If you mean this change: > > + =C2=A0/* Any value different than `p.offset' will satisfy the check dur= ing > + =C2=A0 =C2=A0 first loop. =C2=A0*/ > + =C2=A0lastaddr =3D !p.offset; > + > > Then there was no bug here. > =C2=A0 =C2=A0 =C2=A0if (labeln && lastaddr =3D=3D p.offset) > =C2=A0 =C2=A0 =C2=A0 =C2=A0return grub_error (GRUB_ERR_BAD_PART_TABLE, "l= oop detected"); > > =C2=A0 =C2=A0 =C2=A0labeln++; > =C2=A0 =C2=A0 =C2=A0if ((labeln & (labeln - 1)) =3D=3D 0) This is a check for being an integral power of 2 (or 0), i.e. having a single bit set. Was that the intent? It's probably worth an explanatory comment for the sake of those who aren't familiar with the test. > =C2=A0 =C2=A0 =C2=A0 =C2=A0lastaddr =3D p.offset; > > labeln is 0 during first loop run and then lastaddr is set. I explicitly > omitted initing variables to have smaller loop detector I suspect initializing lastaddr, which takes place outside the loop, is less expensive than testing labeln on every iteration. >> Since -Werror may be a problem in some situations, I've added a >> --disable-werror switch, which does the obvious thing. >> >> > > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel >