From patchwork Thu Sep 12 07:38:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 827790 Delivered-To: patch@linaro.org Received: by 2002:adf:ab1c:0:b0:367:895a:4699 with SMTP id q28csp1141751wrc; Thu, 12 Sep 2024 00:40:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWmngGpsqhb69BKkBTP6UpSyrXdQxylA5Cjk5fsSR92SySDvJmBJduLnj89t1ed0GPdWoqb2g==@linaro.org X-Google-Smtp-Source: AGHT+IF2BvF5piJaL9ILB8TOoz64Biz9b3gHFSmPGL4QawzfLB5tYv5rWem1LekzqqjM28o5XKrj X-Received: by 2002:a05:622a:42:b0:447:ed76:259f with SMTP id d75a77b69052e-45860366b95mr23421261cf.35.1726126829348; Thu, 12 Sep 2024 00:40:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726126829; cv=none; d=google.com; s=arc-20240605; b=bWYb/mLIay3Eh2STNsB5fKfyEPqiWspA7XQkbnTrhT+MdjBp+GoST/gnIqZeRwozw4 X/fiEFd+wVcyMSBdGcLBMpVoCiw8JtAv7r3LhTFpdnQ1sm5C5EKnCXZEIKUAVCyYo676 JBWwzXH0lhViUFJbdnYZIrggZ/intjg8SfUO/DoQn3EO8tELwRICV6BcsrdAf19e6aOj JlLngQFv9X2cBPpgTuHSk96smx6BM7ihuqp7ZJ76N2uYvhafVJf6TlrX+4D4YXgd31cn mM3w300m03f9B47uhjQcZFX7+4Cskg1HZuDlU99ZkW17zp7qaYCLqbKc/D1RiIguufxy rfFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=6KTOZZpVPdK9NLch9CdYyKy3h5bRy7LFaAKYeIfSuvw=; fh=9lXHm2cv0EOsvaESlQxkp+iopfNbpS2ZXLeBYSea/ko=; b=G//xte9NTDJm6cCO1IAZWdGlFHyT0S9XXjxGMaZ/0obgNfDVQLPhLQB+GLy1M4FZxt PTH9vv9F6To6CVjurJXZEpYDD4aJr0a9OdVJnfUu2gyPN2vpon+HmuMLcwvCvXvBCMZS EVMX5EfN8TZ9EFzroDcbz5q1+p99IZSzTGdUtUaBjT3ws8OQJuU1nqb8qC1yLlomCTBn XWx45/38SAgrQg5QC2pOn4KW4t7722QeRAWhqycV54QFxcK214jWG6QGHheLV4KgaJb4 aFUO1w8/m7Ontu3cADdZCu2wLYI9jkrKA9zX28G5AJ/Qxntu/yUZHeaHyJN6JRpznOxG Z+AA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=U6mk9qEl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=fail header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4582301ef89si122449901cf.730.2024.09.12.00.40.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Sep 2024 00:40:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=U6mk9qEl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=fail header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soeQP-0000rd-89; Thu, 12 Sep 2024 03:39:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soeQN-0000qg-9x for qemu-devel@nongnu.org; Thu, 12 Sep 2024 03:39:31 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1soeQL-00005v-6n for qemu-devel@nongnu.org; Thu, 12 Sep 2024 03:39:31 -0400 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-7d4f85766f0so627704a12.2 for ; Thu, 12 Sep 2024 00:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726126766; x=1726731566; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=6KTOZZpVPdK9NLch9CdYyKy3h5bRy7LFaAKYeIfSuvw=; b=U6mk9qEls+idLS73qlrnb67artgNF9fY3Hg3mvoBoRJCyfGbJYKrUaNWHiT6AfNRh9 YNMJ/P+5wwwoUhdrtym4vqRMD5CBJH6/W+Ou7ccRGd2BbLyIiVVkFjILIYz0tt1uVIqX JqH/vpOGRAKQuE0Qh7s2K6CU3LkZ6tG4ZaPEhehFv3kiM7lgu9dSUIPKQCtvWSw82aCE kmFjxHioNSl6BwoiqCoD3vPhJXyxvdzwbPuQ3B93+4nHPMTOzuRJIU6j1DkWyaRgAIbA FTCMRkHU5vWkiOmiL1DpHyY6fBSbyq89zG7MwxDCs6VlTkiL3OxA0pWkSReyDfK7fqy9 HsMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726126766; x=1726731566; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6KTOZZpVPdK9NLch9CdYyKy3h5bRy7LFaAKYeIfSuvw=; b=LtXGDZCW/IlqM65IX+SMvpJsllB1ZNUtSWptZtF7+L9zxQFxY48VN/wo+HCGzrLtkz l4rZcyAGO4Tt/J3TF1O18HWpChwrde7q8ZFz4oUUCI7LFGMcdD6Na/QW2YUJuJvDyqfA nwZhtFZz0Gt01WZJ39TNi2gQ+fN7xwyT5NWGy/2Q6obbCB52Khki/lSnkbx3IHvSFsN8 BAP1ZrvzB31Xj3qEyxGO+XcrGgQlGpzKveBLHPoAT7/aYR1kIJ9qOIJ3okjvU8+z1+Sm YALQPViRbO53Wb7nH/r21eMvT0HDvadAqQOeTf35ioGsT/LLALCkwuU5Oad941G1BgPM mBlg== X-Gm-Message-State: AOJu0Yz9vxczfIIdRwzuuqVF8V98lTuxEe3NQ86Tvjd7ceTLLtMa9O8l p+xaJmuHYwz8FqMJqdW/hEV9vKL7Mzn28wEqeUDKF0cMK5uDXaZMcLcTaE0iR0cdHrVsg5uNMHg BRogc/KvK X-Received: by 2002:a05:6a21:114d:b0:1cc:ce91:8459 with SMTP id adf61e73a8af0-1cf75ea2351mr2933012637.5.1726126766203; Thu, 12 Sep 2024 00:39:26 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00::9633]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7db1fb9ad87sm983458a12.6.2024.09.12.00.39.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Sep 2024 00:39:25 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Jason Wang , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , Marcelo Tosatti , Nicholas Piggin , Klaus Jensen , WANG Xuerui , Halil Pasic , Rob Herring , Michael Rolnik , Zhao Liu , Peter Maydell , Richard Henderson , Fabiano Rosas , Corey Minyard , Keith Busch , Thomas Huth , "Maciej S. Szmigiero" , Harsh Prateek Bora , Kevin Wolf , Paolo Bonzini , Jesper Devantier , Hyman Huang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , qemu-s390x@nongnu.org, Laurent Vivier , qemu-riscv@nongnu.org, "Richard W.M. Jones" , Liu Zhiwei , Aurelien Jarno , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Marcel Apfelbaum , kvm@vger.kernel.org, Christian Borntraeger , Akihiko Odaki , Daniel Henrique Barboza , Hanna Reitz , Ani Sinha , qemu-ppc@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Alistair Francis , Bin Meng , "Michael S. Tsirkin" , Helge Deller , Peter Xu , Daniel Henrique Barboza , Dmitry Fleytman , Nina Schoetterl-Glausch , Yanan Wang , qemu-arm@nongnu.org, Igor Mammedov , Jean-Christophe Dubois , Eric Farman , Sriram Yagnaraman , qemu-block@nongnu.org, Stefan Berger , Joel Stanley , Eduardo Habkost , David Gibson , Fam Zheng , Weiwei Li , Markus Armbruster , Pierrick Bouvier Subject: [PATCH v2 00/48] Use g_assert_not_reached instead of (g_)assert(0, false) Date: Thu, 12 Sep 2024 00:38:33 -0700 Message-Id: <20240912073921.453203-1-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pg1-x52f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This series cleans up all usages of assert/g_assert who are supposed to stop execution of QEMU. We replace those by g_assert_not_reached(). It was suggested recently when cleaning codebase to build QEMU with gcc and tsan: https://lore.kernel.org/qemu-devel/54bb02a6-1b12-460a-97f6-3f478ef766c6@linaro.org/. In more, cleanup useless break and return after g_assert_not_reached(); And finally, ensure with scripts/checkpatch.pl that we don't reintroduce (g_)assert(false) in the future. New commits (removing return) need review. Tested that it build warning free with gcc and clang. v2 - align backslashes for some changes - add summary in all commits message - remove redundant comment v1 https://lore.kernel.org/qemu-devel/20240910221606.1817478-1-pierrick.bouvier@linaro.org/T/#t Pierrick Bouvier (48): docs/spin: replace assert(0) with g_assert_not_reached() hw/acpi: replace assert(0) with g_assert_not_reached() hw/arm: replace assert(0) with g_assert_not_reached() hw/char: replace assert(0) with g_assert_not_reached() hw/core: replace assert(0) with g_assert_not_reached() hw/net: replace assert(0) with g_assert_not_reached() hw/watchdog: replace assert(0) with g_assert_not_reached() migration: replace assert(0) with g_assert_not_reached() qobject: replace assert(0) with g_assert_not_reached() system: replace assert(0) with g_assert_not_reached() target/ppc: replace assert(0) with g_assert_not_reached() tests/qtest: replace assert(0) with g_assert_not_reached() tests/unit: replace assert(0) with g_assert_not_reached() include/hw/s390x: replace assert(false) with g_assert_not_reached() block: replace assert(false) with g_assert_not_reached() hw/hyperv: replace assert(false) with g_assert_not_reached() hw/net: replace assert(false) with g_assert_not_reached() hw/nvme: replace assert(false) with g_assert_not_reached() hw/pci: replace assert(false) with g_assert_not_reached() hw/ppc: replace assert(false) with g_assert_not_reached() migration: replace assert(false) with g_assert_not_reached() target/i386/kvm: replace assert(false) with g_assert_not_reached() tests/qtest: replace assert(false) with g_assert_not_reached() accel/tcg: remove break after g_assert_not_reached() block: remove break after g_assert_not_reached() hw/acpi: remove break after g_assert_not_reached() hw/gpio: remove break after g_assert_not_reached() hw/misc: remove break after g_assert_not_reached() hw/net: remove break after g_assert_not_reached() hw/pci-host: remove break after g_assert_not_reached() hw/scsi: remove break after g_assert_not_reached() hw/tpm: remove break after g_assert_not_reached() target/arm: remove break after g_assert_not_reached() target/riscv: remove break after g_assert_not_reached() tests/qtest: remove break after g_assert_not_reached() ui: remove break after g_assert_not_reached() fpu: remove break after g_assert_not_reached() tcg/loongarch64: remove break after g_assert_not_reached() include/qemu: remove return after g_assert_not_reached() hw/hyperv: remove return after g_assert_not_reached() hw/net: remove return after g_assert_not_reached() hw/pci: remove return after g_assert_not_reached() hw/ppc: remove return after g_assert_not_reached() migration: remove return after g_assert_not_reached() qobject: remove return after g_assert_not_reached() qom: remove return after g_assert_not_reached() tests/qtest: remove return after g_assert_not_reached() scripts/checkpatch.pl: emit error when using assert(false) docs/spin/aio_notify_accept.promela | 6 +++--- docs/spin/aio_notify_bug.promela | 6 +++--- include/hw/s390x/cpu-topology.h | 2 +- include/qemu/pmem.h | 1 - accel/tcg/plugin-gen.c | 1 - block/qcow2.c | 2 +- block/ssh.c | 1 - hw/acpi/aml-build.c | 3 +-- hw/arm/highbank.c | 2 +- hw/char/avr_usart.c | 2 +- hw/core/numa.c | 2 +- hw/gpio/nrf51_gpio.c | 1 - hw/hyperv/hyperv_testdev.c | 7 +++---- hw/hyperv/vmbus.c | 15 ++++++--------- hw/misc/imx6_ccm.c | 1 - hw/misc/mac_via.c | 2 -- hw/net/e1000e_core.c | 4 +--- hw/net/i82596.c | 2 +- hw/net/igb_core.c | 4 +--- hw/net/net_rx_pkt.c | 3 +-- hw/net/vmxnet3.c | 1 - hw/nvme/ctrl.c | 8 ++++---- hw/pci-host/gt64120.c | 2 -- hw/pci/pci-stub.c | 6 ++---- hw/ppc/ppc.c | 1 - hw/ppc/spapr_events.c | 3 +-- hw/scsi/virtio-scsi.c | 1 - hw/tpm/tpm_spapr.c | 1 - hw/watchdog/watchdog.c | 2 +- migration/dirtyrate.c | 3 +-- migration/migration-hmp-cmds.c | 2 +- migration/postcopy-ram.c | 21 +++++++-------------- migration/ram.c | 8 +++----- qobject/qlit.c | 2 +- qobject/qnum.c | 12 ++++-------- qom/object.c | 1 - system/rtc.c | 2 +- target/arm/hyp_gdbstub.c | 1 - target/i386/kvm/kvm.c | 4 ++-- target/ppc/dfp_helper.c | 8 ++++---- target/ppc/mmu_helper.c | 2 +- target/riscv/monitor.c | 1 - tests/qtest/acpi-utils.c | 1 - tests/qtest/ipmi-bt-test.c | 2 +- tests/qtest/ipmi-kcs-test.c | 4 ++-- tests/qtest/migration-helpers.c | 1 - tests/qtest/numa-test.c | 10 +++++----- tests/qtest/rtl8139-test.c | 2 +- tests/unit/test-xs-node.c | 4 ++-- ui/qemu-pixman.c | 1 - fpu/softfloat-parts.c.inc | 2 -- target/riscv/insn_trans/trans_rvv.c.inc | 2 -- tcg/loongarch64/tcg-target.c.inc | 1 - scripts/checkpatch.pl | 3 +++ 54 files changed, 72 insertions(+), 120 deletions(-)