From nobody Mon Feb 9 04:03:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1548083615516384.64716098895485; Mon, 21 Jan 2019 07:13:35 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 12948DB935; Mon, 21 Jan 2019 15:13:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C16B8104813D; Mon, 21 Jan 2019 15:13:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6E3F2180339C; Mon, 21 Jan 2019 15:13:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0LFDSnp024433 for ; Mon, 21 Jan 2019 10:13:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5E85E19747; Mon, 21 Jan 2019 15:13:28 +0000 (UTC) Received: from trick.home.annexia.org (ovpn-117-203.ams2.redhat.com [10.36.117.203]) by smtp.corp.redhat.com (Postfix) with ESMTP id D68421A92C for ; Mon, 21 Jan 2019 15:13:24 +0000 (UTC) From: "Richard W.M. Jones" To: libvir-list@redhat.com Date: Mon, 21 Jan 2019 15:13:21 +0000 Message-Id: <20190121151321.6259-3-rjones@redhat.com> In-Reply-To: <20190121151321.6259-1-rjones@redhat.com> References: <20190121151321.6259-1-rjones@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] tests: Avoid "jump skips variable initialization" with GCC 9. X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 21 Jan 2019 15:13:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" GCC 9 gives pages of errors like: qemumonitorjsontest.c: In function 'mymain': qemumonitorjsontest.c:2904:9: error: jump skips variable initialization [-W= error=3Djump-misses-init] 2904 | goto cleanup; | ^~~~ qemumonitorjsontest.c:3111:2: note: label 'cleanup' defined here 3111 | cleanup: | ^~~~~~~ qemumonitorjsontest.c:2920:54: note: '({anonymous})' declared here 2920 | simpleFunc =3D (testQemuMonitorJSONSimpleFuncData) {.xmlopt =3D= driver.xmlopt, \ | ^ qemumonitorjsontest.c:3008:5: note: in expansion of macro 'DO_TEST_GEN' 3008 | DO_TEST_GEN(qemuMonitorJSONBlockdevMediumInsert); | ^~~~~~~~~~~ By moving the cleanup section up near the top of the function we can avoid this. I think a better way might be to disable the warning. --- tests/qemumonitorjsontest.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 1a8a31717f..299c5f0cbe 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2900,8 +2900,12 @@ mymain(void) =20 if (!(qapiData.schema =3D testQEMUSchemaLoad())) { VIR_TEST_VERBOSE("failed to load qapi schema\n"); - ret =3D -1; - goto cleanup; + cleanup: + VIR_FREE(metaschemastr); + virJSONValueFree(metaschema); + virHashFree(qapiData.schema); + qemuTestDriverFree(&driver); + return -1; } =20 #define DO_TEST(name) \ @@ -3098,7 +3102,6 @@ mymain(void) if (!(metaschema =3D testQEMUSchemaGetLatest()) || !(metaschemastr =3D virJSONValueToString(metaschema, false))) { VIR_TEST_VERBOSE("failed to load latest qapi schema\n"); - ret =3D -1; goto cleanup; } =20 @@ -3108,7 +3111,6 @@ mymain(void) =20 #undef DO_TEST_QAPI_SCHEMA =20 - cleanup: VIR_FREE(metaschemastr); virJSONValueFree(metaschema); virHashFree(qapiData.schema); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list