[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/3] various: Remove unnecessary OBJECT() cast
- To: Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>
- From: Markus Armbruster <armbru@xxxxxxxxxx>
- Date: Fri, 08 May 2020 14:49:48 +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>, qemu-ppc@xxxxxxxxxx, 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>, Corey Minyard <cminyard@xxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Aurelien Jarno <aurelien@xxxxxxxxxxx>
- Delivery-date: Fri, 08 May 2020 12:50:08 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Philippe Mathieu-Daudé <f4bug@xxxxxxxxx> writes:
> The OBJECT() macro is defined as:
>
> #define OBJECT(obj) ((Object *)(obj))
>
> which expands to:
>
> ((Object *)object_dynamic_cast_assert((Object *)(obj), (name),
> __FILE__, __LINE__, __func__))
Nope :)
> This assertion can only fail when @obj points to something other
> than its stated type, i.e. when we're in undefined behavior country.
There is no assertion.
> Remove the unnecessary OBJECT() casts when we already know the
> pointer is of Object type.
>
> Patch created mechanically using spatch with this script:
>
> @@
> typedef Object;
> Object *o;
> @@
> - OBJECT(o)
> + o
>
> Acked-by: Cornelia Huck <cohuck@xxxxxxxxxx>
> Acked-by: Corey Minyard <cminyard@xxxxxxxxxx>
> Acked-by: John Snow <jsnow@xxxxxxxxxx>
> Reviewed-by: Richard Henderson <richard.henderson@xxxxxxxxxx>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>
> ---
> v2: Reword (Markus)
My rewording suggestion applied to PATCH 3, not to this one.
With v2's commit message;
Reviewed-by: Markus Armbruster <armbru@xxxxxxxxxx>
|