qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH fix for-2.9] cpus: fix wrong define name


From: Greg Kurz
Subject: Re: [Qemu-devel] [PATCH fix for-2.9] cpus: fix wrong define name
Date: Tue, 11 Apr 2017 00:13:22 +0200

On Mon, 10 Apr 2017 10:49:12 -0700
Richard Henderson <address@hidden> wrote:

> On 04/10/2017 10:44 AM, Greg Kurz wrote:
> > On Mon, 10 Apr 2017 18:29:57 +0100
> > Peter Maydell <address@hidden> wrote:
> >  
> >> On 10 April 2017 at 18:26, Richard Henderson <address@hidden> wrote:  
> >>> On 04/09/2017 11:06 PM, Nikunj A Dadhania wrote:  
> >>>> --- a/cpus.c
> >>>> +++ b/cpus.c
> >>>> @@ -202,7 +202,7 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp)
> >>>>              } else if (use_icount) {
> >>>>                  error_setg(errp, "No MTTCG when icount is enabled");
> >>>>              } else {
> >>>> -#ifndef TARGET_SUPPORT_MTTCG
> >>>> +#ifndef TARGET_SUPPORTS_MTTCG  
> >>>
> >>>
> >>> This sort of thing is why glibc moved to using -Wundef.
> >>>
> >>> It would be a huge amount of work to convert our existing sources, but it
> >>> would probably pay off in the long run.  
> >>
> >> We already build with -Wundef...
> >>  
> >
> > From the gcc info page:
> >
> > '-Wundef'
> >      Warn if an undefined identifier is evaluated in an '#if' directive.
> >
> > and BTW, isn't the purpose of #ifndef precisely to detect that the
> > identifier is undefined ?  
> 
> Yes, but it also has the typo problem above, whereas
> 
>    #if !TARGET_SUPPORTS_MTTCG
> 
> plus -Wundef would have caught that error.
> 

Turning such #ifdef/#ifndef to #if/#if ! would indeed make sense, but
we'd still have to be careful that every new addition follows the rule.

> 
> r~

Attachment: pgpoDKlvfdVcr.pgp
Description: OpenPGP digital signature


reply via email to

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