[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/3] target: Remove unnecessary CPU() cast
- To: Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>
- From: Markus Armbruster <armbru@xxxxxxxxxx>
- Date: Fri, 08 May 2020 14:50:41 +0200
- Cc: Peter Maydell <peter.maydell@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Jason Wang <jasowang@xxxxxxxxxx>, Mark Cave-Ayland <mark.cave-ayland@xxxxxxxxxxxx>, qemu-devel@xxxxxxxxxx, Gerd Hoffmann <kraxel@xxxxxxxxxx>, "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, qemu-block@xxxxxxxxxx, David Hildenbrand <david@xxxxxxxxxx>, Halil Pasic <pasic@xxxxxxxxxxxxx>, Christian Borntraeger <borntraeger@xxxxxxxxxx>, Aleksandar Markovic <aleksandar.qemu.devel@xxxxxxxxx>, Joel Stanley <joel@xxxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, David Gibson <david@xxxxxxxxxxxxxxxxxxxxx>, Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>, Eduardo Habkost <ehabkost@xxxxxxxxxx>, Corey Minyard <minyard@xxxxxxx>, Richard Henderson <richard.henderson@xxxxxxxxxx>, "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx>, qemu-s390x@xxxxxxxxxx, qemu-arm@xxxxxxxxxx, Peter Chubb <peter.chubb@xxxxxxxxxxxx>, Cédric Le Goater <clg@xxxxxxxx>, John Snow <jsnow@xxxxxxxxxx>, Richard Henderson <rth@xxxxxxxxxxx>, "Daniel P. Berrangé" <berrange@xxxxxxxxxx>, Andrew Jeffery <andrew@xxxxxxxx>, Cornelia Huck <cohuck@xxxxxxxxxx>, Laurent Vivier <laurent@xxxxxxxxx>, qemu-ppc@xxxxxxxxxx, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Aurelien Jarno <aurelien@xxxxxxxxxxx>
- Delivery-date: Fri, 08 May 2020 12:50:55 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Philippe Mathieu-Daudé <f4bug@xxxxxxxxx> 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 <david@xxxxxxxxxxxxxxxxxxxxx>
> Reviewed-by: Cédric Le Goater <clg@xxxxxxxx>
> Reviewed-by: Richard Henderson <richard.henderson@xxxxxxxxxx>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>
Reviewed-by: Markus Armbruster <armbru@xxxxxxxxxx>
|