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

Re: [Xen-devel] [PATCH RFC XEN v1 01/14] xen: arm: Add gic_hw_desc



On Tue, 2015-12-15 at 16:35 +0000, Andrew Cooper wrote:
> On 15/12/15 16:21, Ian Campbell wrote:
> > On Tue, 2015-12-15 at 16:15 +0000, Stefano Stabellini wrote:
> > > On Wed, 9 Dec 2015, Ian Campbell wrote:
> > > > Because the enum gic_version values do not correspond to the gic
> > > > version (in order to allow space for variants such as GICv2m,
> > > > although
> > > > that is currently not present) logging the raw value is not
> > > > terribly
> > > > useful. Provide gic_hw_desc which provides a string describing each
> > > > GIC version.
> > > > 
> > > > Will be used in a later patch.
> > > > 
> > > > Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> > > > ---
> > > > Âxen/arch/arm/gic.cÂÂÂÂÂÂÂÂ| 14 ++++++++++++++
> > > > Âxen/include/asm-arm/gic.h |ÂÂ1 +
> > > > Â2 files changed, 15 insertions(+)
> > > > 
> > > > diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
> > > > index 1e1e5ba..bea39d6 100644
> > > > --- a/xen/arch/arm/gic.c
> > > > +++ b/xen/arch/arm/gic.c
> > > > @@ -62,6 +62,20 @@ enum gic_version gic_hw_version(void)
> > > > ÂÂÂÂreturn gic_hw_ops->info->hw_version;
> > > > Â}
> > > > Â
> > > > +const char *gic_hw_desc(enum gic_version v)
> > > > +{
> > > > +ÂÂÂÂswitch (v) {
> > > > +ÂÂÂÂcase GIC_V2: return "GIC v2";
> > > > +ÂÂÂÂcase GIC_V3: return "GIC v3";
> > > > +ÂÂÂÂ}
> > > > +
> > > > +ÂÂÂÂ/*
> > > > +ÂÂÂÂÂ* The compiler ought to gripe if the above doesn't cover all
> > > > enum
> > > > +ÂÂÂÂÂ* gic_version, in case some version doesn't.
> > > > +ÂÂÂÂÂ*/
> > > > +ÂÂÂÂreturn "Unknown";
> > > default: ?
> > Deliberately not, since that would quash the expected compiler warning.
> 
> What expected compiler warning?
> 
> That switch statement, complete or not, is always valid.

I meant the sort of thing which -Wswitch-enum warns about, i.e. the switch
not covering the whole range of enum values.

The return statement is there for the benefit of other compilers which
cannot do that analysis for some reason.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.