qemu-ppc
[Top][All Lists]
Advanced

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

Re: [for-5.0 PATCH] ppc: Make PPCVirtualHypervisor an incomplete type


From: Markus Armbruster
Subject: Re: [for-5.0 PATCH] ppc: Make PPCVirtualHypervisor an incomplete type
Date: Tue, 10 Dec 2019 11:52:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

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

> On 12/9/19 2:28 PM, Greg Kurz wrote:
>> PPCVirtualHypervisor is an interface instance. It should never be
>> dereferenced. Drop the dummy type definition for extra safety, which
>> is the common practice with QOM interfaces.
>
> This "common practice" is also referenced in commit 00ed3da9b5:
>
>     xics: Minor fixes for XICSFabric interface
>
>     Interface instances should never be directly dereferenced.  So,
> the common
>     practice is to make them incomplete types to make sure no-one does
> that.
>     XICSFrabric, however, had a dummy type which is less safe.
>
>     We were also using OBJECT_CHECK() where we should have been using
>     INTERFACE_CHECK().
>
> This indeed follow the changes from commit aa1b35b975d8:
>
>     qom: make interface types abstract
>
>     Interfaces don't have instance, let's make the interface type really
>     abstract to avoid confusion.
>
> Now I can't find guidelines for this. If you don't know about it and
> use 'git-grep', it is very confusing to see we use structures we never
> define.

Incomplete type is the closest you get to abstract class in C.

Prior discussion:
Subject: Re: Issues around TYPE_INTERFACE
Message-ID: <address@hidden>
https://lists.nongnu.org/archive/html/qemu-devel/2019-04/msg00749.html

> Can we document this use please?

Fair.




reply via email to

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