Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1iVeQ1-0000Qg-F4 for mharc-qemu-trivial@gnu.org; Fri, 15 Nov 2019 11:25:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52337) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVePy-0000M2-H6 for qemu-trivial@nongnu.org; Fri, 15 Nov 2019 11:25:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iVePw-0000wH-Tp for qemu-trivial@nongnu.org; Fri, 15 Nov 2019 11:25:54 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:31537 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iVePw-0000vr-QJ for qemu-trivial@nongnu.org; Fri, 15 Nov 2019 11:25:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573835152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=otxzYIfpCWpsQYyEylcULtfWltAjZadyTN7OYl8t4YQ=; b=JIiHUIj777PwiMuRLoy/XHLTKOv/fbVI1ed3GfdPbsrfWJmoQf02czHvbdaWq3gFYrLTbl v82xsfufiGMuE8vYrOl3WKPgoB/1pSNwPeseGf7QOPSvA5VLxvX72DQm2q1UAyRbuow8hF fahX+JKQOzG5xBIAk15zZ3e0wRbFmfI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-384-_8dLqASWPEy5trTUSo89_Q-1; Fri, 15 Nov 2019 11:25:49 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D4CEB8C980E; Fri, 15 Nov 2019 16:25:47 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-84.ams2.redhat.com [10.36.117.84]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B815A1036C81; Fri, 15 Nov 2019 16:25:39 +0000 (UTC) Subject: Re: [PATCH for-4.2] hw/i386: Fix compiler warning when CONFIG_IDE_ISA is disabled To: Paolo Bonzini , Peter Maydell Cc: QEMU Developers , "Michael S. Tsirkin" , Marcel Apfelbaum , QEMU Trivial , =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , Eduardo Habkost References: <20191115145049.26868-1-thuth@redhat.com> <273a3123-9eef-c78e-5b83-833a21e3988c@redhat.com> From: Thomas Huth Message-ID: Date: Fri, 15 Nov 2019 17:13:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: _8dLqASWPEy5trTUSo89_Q-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-trivial@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Nov 2019 16:25:56 -0000 On 15/11/2019 17.13, Paolo Bonzini wrote: > On 15/11/19 16:54, Thomas Huth wrote: >> On 15/11/2019 16.54, Peter Maydell wrote: >>> On Fri, 15 Nov 2019 at 15:10, Thomas Huth wrote: >>>> >>>> When CONFIG_IDE_ISA is disabled, compilation currently fails: >>>> >>>> hw/i386/pc_piix.c: In function =E2=80=98pc_init1=E2=80=99: >>>> hw/i386/pc_piix.c:81:9: error: unused variable =E2=80=98i=E2=80=99 [-= Werror=3Dunused-variable] >>>> >>>> Move the variable declaration to the right code block to avoid >>>> this problem. >>>> >>>> Fixes: 4501d317b50e ("hw/i386/pc: Extract pc_i8259_create()") >>>> Signed-off-by: Thomas Huth >>>> --- >>>> hw/i386/pc_piix.c | 3 +-- >>>> 1 file changed, 1 insertion(+), 2 deletions(-) >>>> >>>> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c >>>> index 2aefa3b8df..d187db761c 100644 >>>> --- a/hw/i386/pc_piix.c >>>> +++ b/hw/i386/pc_piix.c >>>> @@ -78,7 +78,6 @@ static void pc_init1(MachineState *machine, >>>> X86MachineState *x86ms =3D X86_MACHINE(machine); >>>> MemoryRegion *system_memory =3D get_system_memory(); >>>> MemoryRegion *system_io =3D get_system_io(); >>>> - int i; >>>> PCIBus *pci_bus; >>>> ISABus *isa_bus; >>>> PCII440FXState *i440fx_state; >>>> @@ -253,7 +252,7 @@ static void pc_init1(MachineState *machine, >>>> } >>>> #ifdef CONFIG_IDE_ISA >>>> else { >>>> - for(i =3D 0; i < MAX_IDE_BUS; i++) { >>>> + for (int i =3D 0; i < MAX_IDE_BUS; i++) { >>>> ISADevice *dev; >>>> char busname[] =3D "ide.0"; >>>> dev =3D isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[= i], >>> >>> Don't put variable declarations inside 'for' statements, >>> please. They should go at the start of a {} block. >> >> Why? We're using -std=3Dgnu99 now, so this should not be an issue anymor= e. >=20 > For now I can squash the following while we discuss coding standards. :) >=20 > diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c > index fa62244f4d..0130b8fb4e 100644 > --- a/hw/i386/pc_piix.c > +++ b/hw/i386/pc_piix.c > @@ -244,7 +244,8 @@ static void pc_init1(MachineState *machine, > } > #ifdef CONFIG_IDE_ISA > else { > - for (int i =3D 0; i < MAX_IDE_BUS; i++) { > + int i; > + for (i =3D 0; i < MAX_IDE_BUS; i++) { > ISADevice *dev; > char busname[] =3D "ide.0"; > dev =3D isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], Yes, please do. I guess we won't update CODING_STYLE.rst during the hard freeze anymore ;-) Thomas