From: Thomas Huth <thuth@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org,
"Eric Blake" <eblake@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Ani Sinha" <ani@anisinha.ca>, "Rob Herring" <robh@kernel.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Michael Rolnik" <mrolnik@gmail.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Yanan Wang" <wangyanan55@huawei.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Helge Deller" <deller@gmx.de>,
"Jason Wang" <jasowang@redhat.com>,
"Juan Quintela" <quintela@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Huacai Chen" <chenhuacai@kernel.org>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Cédric Le Goater" <clg@kaod.org>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Greg Kurz" <groug@kaod.org>, "Corey Minyard" <minyard@acm.org>,
"Laurent Vivier" <lvivier@redhat.com>
Subject: Re: [PATCH 3/5] bulk: Replace [g_]assert(0) -> g_assert_not_reached()
Date: Wed, 22 Feb 2023 05:06:04 +0100 [thread overview]
Message-ID: <f0eb7a7c-8505-ee8d-af5f-259c2627958b@redhat.com> (raw)
In-Reply-To: <20230221232520.14480-4-philmd@linaro.org>
On 22/02/2023 00.25, Philippe Mathieu-Daudé wrote:
> In order to avoid warnings such commit c0a6665c3c ("target/i386:
> Remove compilation errors when -Werror=maybe-uninitialized"),
> replace all assert(0) and g_assert(0) by g_assert_not_reached().
>
> Remove any code following g_assert_not_reached().
>
> See previous commit for rationale.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>
> diff --git a/docs/spin/aio_notify_accept.promela b/docs/spin/aio_notify_accept.promela
> index 9cef2c955d..f929d30328 100644
> --- a/docs/spin/aio_notify_accept.promela
> +++ b/docs/spin/aio_notify_accept.promela
> @@ -118,7 +118,7 @@ accept_if_req_not_eventually_false:
> if
> :: req -> goto accept_if_req_not_eventually_false;
> fi;
> - assert(0);
> + g_assert_not_reached();
> }
This does not look like C code ... is it safe to replace the statement here?
> diff --git a/docs/spin/aio_notify_bug.promela b/docs/spin/aio_notify_bug.promela
> index b3bfca1ca4..ce6f5177ed 100644
> --- a/docs/spin/aio_notify_bug.promela
> +++ b/docs/spin/aio_notify_bug.promela
> @@ -106,7 +106,7 @@ accept_if_req_not_eventually_false:
> if
> :: req -> goto accept_if_req_not_eventually_false;
> fi;
> - assert(0);
> + g_assert_not_reached();
> }
dito
> diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
> index f54f44d899..59c8032a21 100644
> --- a/migration/postcopy-ram.c
> +++ b/migration/postcopy-ram.c
> @@ -1347,49 +1347,42 @@ int postcopy_ram_incoming_init(MigrationIncomingState *mis)
>
> int postcopy_ram_incoming_cleanup(MigrationIncomingState *mis)
> {
> - assert(0);
> - return -1;
> + g_assert_not_reached();
> }
>
> int postcopy_ram_prepare_discard(MigrationIncomingState *mis)
> {
> - assert(0);
> - return -1;
> + g_assert_not_reached();
> }
>
> int postcopy_request_shared_page(struct PostCopyFD *pcfd, RAMBlock *rb,
> uint64_t client_addr, uint64_t rb_offset)
> {
> - assert(0);
> - return -1;
> + g_assert_not_reached();
> }
>
> int postcopy_ram_incoming_setup(MigrationIncomingState *mis)
> {
> - assert(0);
> - return -1;
> + g_assert_not_reached();
> }
>
> int postcopy_place_page(MigrationIncomingState *mis, void *host, void *from,
> RAMBlock *rb)
> {
> - assert(0);
> - return -1;
> + g_assert_not_reached();
> }
>
> int postcopy_place_page_zero(MigrationIncomingState *mis, void *host,
> RAMBlock *rb)
> {
> - assert(0);
> - return -1;
> + g_assert_not_reached();
> }
>
> int postcopy_wake_shared(struct PostCopyFD *pcfd,
> uint64_t client_addr,
> RAMBlock *rb)
> {
> - assert(0);
> - return -1;
> + g_assert_not_reached();
> }
> #endif
If we ever reconsider to allow compiling with G_DISABLE_ASSERT again, this
will fail to compile since the return is missing now, so this is kind of
ugly ... would it make sense to replace this with g_assert_true(0) instead?
Or use abort() directly?
Thomas
next prev parent reply other threads:[~2023-02-22 4:06 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-21 23:25 [PATCH 0/5] bulk: Replace assert(0) -> g_assert_not_reached() Philippe Mathieu-Daudé
2023-02-21 23:25 ` [PATCH 1/5] target/ppc: fix warning with clang-15 Philippe Mathieu-Daudé
2023-02-21 23:25 ` [PATCH 2/5] scripts/checkpatch.pl: Do not allow assert(0) Philippe Mathieu-Daudé
2023-02-22 0:08 ` Richard Henderson
2023-02-22 3:53 ` Thomas Huth
2023-02-23 14:51 ` Philippe Mathieu-Daudé
2023-02-21 23:25 ` [PATCH 3/5] bulk: Replace [g_]assert(0) -> g_assert_not_reached() Philippe Mathieu-Daudé
2023-02-22 0:08 ` Richard Henderson
2023-02-22 4:06 ` Thomas Huth [this message]
2023-02-22 6:29 ` Richard Henderson
2023-02-22 11:54 ` Thomas Huth
2023-02-22 11:56 ` Thomas Huth
2023-02-22 13:02 ` Philippe Mathieu-Daudé
2023-02-21 23:25 ` [PATCH 4/5] block/vvfat: Remove pointless check of NDEBUG Philippe Mathieu-Daudé
2023-02-22 0:09 ` Richard Henderson
2023-02-21 23:25 ` [PATCH 5/5] hw: Remove mentions " Philippe Mathieu-Daudé
2023-02-22 0:10 ` Richard Henderson
2023-02-22 12:05 ` Michael S. Tsirkin
2023-02-22 16:11 ` Philippe Mathieu-Daudé
2023-02-22 16:28 ` Michael S. Tsirkin
2023-02-22 18:43 ` Richard Henderson
2023-02-22 20:23 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f0eb7a7c-8505-ee8d-af5f-259c2627958b@redhat.com \
--to=thuth@redhat.com \
--cc=aleksandar.rikalo@syrmia.com \
--cc=ani@anisinha.ca \
--cc=armbru@redhat.com \
--cc=aurelien@aurel32.net \
--cc=chenhuacai@kernel.org \
--cc=clg@kaod.org \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=deller@gmx.de \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=groug@kaod.org \
--cc=imammedo@redhat.com \
--cc=jasowang@redhat.com \
--cc=jiaxun.yang@flygoat.com \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=minyard@acm.org \
--cc=mrolnik@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=quintela@redhat.com \
--cc=richard.henderson@linaro.org \
--cc=robh@kernel.org \
--cc=wangyanan55@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).