qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] Make all static TypeInfos const


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH] Make all static TypeInfos const
Date: Thu, 10 Jan 2013 16:47:13 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0

Am 10.01.2013 16:19, schrieb Andreas Färber:
> Since 39bffca2030950ef6efe57c2fac8327a45ae1015 (qdev: register all
> types natively through QEMU Object Model), TypeInfo as used in
> the common, non-iterative pattern is no longer amended with information
> and should therefore be const.
> 
> Fix the documented QOM examples:
> 
>  sed -i 's/static TypeInfo/static const TypeInfo/g' include/qom/object.h
> 
> Since frequently the wrong examples are being copied by contributors of
> new devices, fix all types in the tree:
> 
>  sed -i 's/^static TypeInfo/static const TypeInfo/g' */*.c
>  sed -i 's/^static TypeInfo/static const TypeInfo/g' */*/*.c
> 
> This also avoids to piggy-back these changes onto real functional
> changes or other refactorings.
> 
> Signed-off-by: Andreas Färber <address@hidden>
> ---

Note that I have compile-tested this, which should've caught any attempt
to modify a const TypeInfo. And I have reviewed the patch to not do any
accidental refactoring.

While this is close to a touch-all patch, those lines are rarely
touched, so mainly QOM'ification patches touching .name would be
affected, i.e. at this time Fred's and mine.
Previous art are patches by Stefan W. to make MemoryRegionOps const.

After this patch, two occurrences of non-const static TypeInfo remain,
inside qom/object.c for Object and Interface respectively.
Plus non-static, non-const TypeInfos in eepro100, EHCI, UHCI and CPUs.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

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