[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 00/34] Use g_assert_not_reached instead of (g_)assert(0, false
From: |
Pierrick Bouvier |
Subject: |
[PATCH v3 00/34] Use g_assert_not_reached instead of (g_)assert(0, false) |
Date: |
Wed, 18 Sep 2024 21:46:07 -0700 |
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.
If a maintainer could pull the whole series, this would be much more easier than
integrating various parts of it in different subsystems. Thanks!
v3
- drop changes on .promela files
- some changes were already merged
v2
- align backslashes for some changes
- add summary in all commits message
- remove redundant comment
v1
20240910221606.1817478-1-pierrick.bouvier@linaro.org/T/#t">https://lore.kernel.org/qemu-devel/20240910221606.1817478-1-pierrick.bouvier@linaro.org/T/#t
Pierrick Bouvier (34):
hw/acpi: replace assert(0) with g_assert_not_reached()
hw/arm: replace assert(0) with g_assert_not_reached()
hw/net: 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()
target/ppc: replace assert(0) 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()
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/net: 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()
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)
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/hyperv/hyperv_testdev.c | 7 +++----
hw/hyperv/vmbus.c | 15 ++++++---------
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/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 -
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 -
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 -
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 +++
36 files changed, 50 insertions(+), 90 deletions(-)
--
2.39.5
- [PATCH v3 00/34] Use g_assert_not_reached instead of (g_)assert(0, false),
Pierrick Bouvier <=
- [PATCH v3 01/34] hw/acpi: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/19
- [PATCH v3 02/34] hw/arm: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/19
- [PATCH v3 04/34] migration: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/19
- [PATCH v3 03/34] hw/net: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/19
- [PATCH v3 05/34] qobject: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/19
- [PATCH v3 06/34] target/ppc: replace assert(0) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/19
- [PATCH v3 07/34] block: replace assert(false) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/19
- [PATCH v3 09/34] hw/net: replace assert(false) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/19
- [PATCH v3 08/34] hw/hyperv: replace assert(false) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/19
- [PATCH v3 10/34] hw/nvme: replace assert(false) with g_assert_not_reached(), Pierrick Bouvier, 2024/09/19