qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 1/3] target: Remove unnecessary CPU() cast


From: Markus Armbruster
Subject: Re: [PATCH v2 1/3] target: Remove unnecessary CPU() cast
Date: Fri, 08 May 2020 14:50:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Philippe Mathieu-Daudé <address@hidden> writes:

> The CPU() macro is defined as:
>
>   #define CPU(obj) ((CPUState *)(obj))
>
> which expands to:
>
>   ((CPUState *)object_dynamic_cast_assert((Object *)(obj), (name),
>                                           __FILE__, __LINE__, __func__))
>
> This assertion can only fail when @obj points to something other
> than its stated type, i.e. when we're in undefined behavior country.
>
> Remove the unnecessary CPU() casts when we already know the pointer
> is of CPUState type.
>
> Patch created mechanically using spatch with this script:
>
>   @@
>   typedef CPUState;
>   CPUState *s;
>   @@
>   -   CPU(s)
>   +   s
>
> Acked-by: David Gibson <address@hidden>
> Reviewed-by: Cédric Le Goater <address@hidden>
> Reviewed-by: Richard Henderson <address@hidden>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>

Reviewed-by: Markus Armbruster <address@hidden>




reply via email to

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