[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/44] qobject: replace assert(0) with g_assert_not_reached()
From: |
Thomas Huth |
Subject: |
[PULL 13/44] qobject: replace assert(0) with g_assert_not_reached() |
Date: |
Wed, 25 Sep 2024 13:09:54 +0200 |
From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
This patch is part of a series that moves towards a consistent use of
g_assert_not_reached() rather than an ad hoc mix of different
assertion mechanisms.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-ID: <20240919044641.386068-6-pierrick.bouvier@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
qobject/qlit.c | 2 +-
qobject/qnum.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/qobject/qlit.c b/qobject/qlit.c
index be8332136c..a62865b642 100644
--- a/qobject/qlit.c
+++ b/qobject/qlit.c
@@ -118,7 +118,7 @@ QObject *qobject_from_qlit(const QLitObject *qlit)
case QTYPE_QBOOL:
return QOBJECT(qbool_from_bool(qlit->value.qbool));
default:
- assert(0);
+ g_assert_not_reached();
}
return NULL;
diff --git a/qobject/qnum.c b/qobject/qnum.c
index 2bbeaedc7b..2138b563a9 100644
--- a/qobject/qnum.c
+++ b/qobject/qnum.c
@@ -85,7 +85,7 @@ bool qnum_get_try_int(const QNum *qn, int64_t *val)
return false;
}
- assert(0);
+ g_assert_not_reached();
return false;
}
@@ -123,7 +123,7 @@ bool qnum_get_try_uint(const QNum *qn, uint64_t *val)
return false;
}
- assert(0);
+ g_assert_not_reached();
return false;
}
@@ -156,7 +156,7 @@ double qnum_get_double(QNum *qn)
return qn->u.dbl;
}
- assert(0);
+ g_assert_not_reached();
return 0.0;
}
@@ -172,7 +172,7 @@ char *qnum_to_string(QNum *qn)
return g_strdup_printf("%.17g", qn->u.dbl);
}
- assert(0);
+ g_assert_not_reached();
return NULL;
}
--
2.46.0
- [PULL 03/44] tests/functional: Convert the xtensa lx60 Avocado test, (continued)
- [PULL 03/44] tests/functional: Convert the xtensa lx60 Avocado test, Thomas Huth, 2024/09/25
- [PULL 04/44] tests/functional: Convert the SPARCStation Avocado test, Thomas Huth, 2024/09/25
- [PULL 05/44] tests/functional: Convert the e500 ppc64 Avocado test, Thomas Huth, 2024/09/25
- [PULL 06/44] tests/functional: Convert the mac ppc Avocado tests, Thomas Huth, 2024/09/25
- [PULL 08/44] tests/functional: Convert the powernv tests from boot_linux_console.py, Thomas Huth, 2024/09/25
- [PULL 09/44] hw/acpi: replace assert(0) with g_assert_not_reached(), Thomas Huth, 2024/09/25
- [PULL 11/44] hw/net: replace assert(0) with g_assert_not_reached(), Thomas Huth, 2024/09/25
- [PULL 10/44] hw/arm: replace assert(0) with g_assert_not_reached(), Thomas Huth, 2024/09/25
- [PULL 07/44] tests/functional: Convert the r2d sh4 Avocado test, Thomas Huth, 2024/09/25
- [PULL 12/44] migration: replace assert(0) with g_assert_not_reached(), Thomas Huth, 2024/09/25
- [PULL 13/44] qobject: replace assert(0) with g_assert_not_reached(),
Thomas Huth <=
- [PULL 14/44] target/ppc: replace assert(0) with g_assert_not_reached(), Thomas Huth, 2024/09/25
- [PULL 15/44] block: replace assert(false) with g_assert_not_reached(), Thomas Huth, 2024/09/25
- [PULL 17/44] hw/net: replace assert(false) with g_assert_not_reached(), Thomas Huth, 2024/09/25
- [PULL 16/44] hw/hyperv: replace assert(false) with g_assert_not_reached(), Thomas Huth, 2024/09/25
- [PULL 18/44] hw/nvme: replace assert(false) with g_assert_not_reached(), Thomas Huth, 2024/09/25
- [PULL 19/44] hw/pci: replace assert(false) with g_assert_not_reached(), Thomas Huth, 2024/09/25
- [PULL 20/44] hw/ppc: replace assert(false) with g_assert_not_reached(), Thomas Huth, 2024/09/25
- [PULL 21/44] migration: replace assert(false) with g_assert_not_reached(), Thomas Huth, 2024/09/25
- [PULL 22/44] target/i386/kvm: replace assert(false) with g_assert_not_reached(), Thomas Huth, 2024/09/25
- [PULL 23/44] accel/tcg: remove break after g_assert_not_reached(), Thomas Huth, 2024/09/25