qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 04/12] compiler.h: replace QEMU_NORETURN with G_NORETURN


From: Marc-André Lureau
Subject: Re: [PATCH 04/12] compiler.h: replace QEMU_NORETURN with G_NORETURN
Date: Thu, 24 Feb 2022 23:57:23 +0400

Hi

On Thu, Feb 24, 2022 at 11:37 PM Richard Henderson <richard.henderson@linaro.org> wrote:
On 2/24/22 08:36, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> G_NORETURN was introduced in glib 2.68, fallback to G_GNUC_NORETURN in
> glib-compat.
>
> Note that this attribute must be placed before the function declaration
> (bringing a bit of consistency in qemu codebase usage).
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

For C11, G_NORETURN is a wrapper for _Noreturn.
Since we're using C11, we should just use _Noreturn.

G_NORETURN has several flavours, one of them is the c++ [[noreturn]], but also MSVC specific etc.

Might be worth considering if we think about making code usable in different contexts.
 

>   void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
>                                       MMUAccessType access_type, int mmu_idx,
> -                                    uintptr_t retaddr) QEMU_NORETURN;
> +                                    uintptr_t retaddr) G_NORETURN;

Incorrect placement.  I didn't scan the whole patch; I assume that using _Noreturn will
flag this up as an error.

Right, bad regexp search, will fix.
 

> -static void QEMU_NORETURN dump_core_and_abort(int target_sig)
> +G_NORETURN static void dump_core_and_abort(int target_sig)

I guess this can go either place, but I think I prefer the scope specifier first.

Ok, I'll change it to "static G_NORETURN"

--
Marc-André Lureau

reply via email to

[Prev in Thread] Current Thread [Next in Thread]