[PATCH sis v2 04/15] Fix "suggest parentheses around operand of ‘!’" compiler warnings.

Mark Kettenis mark.kettenis at xs4all.nl
Fri Apr 8 00:56:27 PDT 2011


> From: Michel =?ISO-8859-1?Q?D=E4nzer?= <michel at daenzer.net>
> Date: Fri, 08 Apr 2011 09:13:32 +0200
> 
> On Don, 2011-04-07 at 23:47 +0300, Timo Aaltonen wrote: 
> > Signed-off-by: Timo Aaltonen <timo.aaltonen at canonical.com>
> 
> The title should be something along the lines of 'Fix logic errors
> pointed out by compiler warnings' now.
> 
> 
> > diff --git a/src/sis_cursor.c b/src/sis_cursor.c
> > index 13eddc4..67a3402 100644
> > --- a/src/sis_cursor.c
> > +++ b/src/sis_cursor.c
> > @@ -759,7 +759,7 @@ SiS300LoadCursorImage(ScrnInfoPtr pScrn, UChar *src)
> >      }
> >  
> >      if(pSiS->VBFlags & CRT2_ENABLE) {
> > -       if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) {
> > +       if((pSiS->UseHWARGBCursor) && (!(pSiS->VBFlags & DISPTYPE_CRT1))) {
> >  	  status2 = sis301GetCursorStatus;
> >  	  sis301DisableHWCursor()
> >  	  SISWaitRetraceCRT2(pScrn);
> > diff --git a/src/sis_utility.c b/src/sis_utility.c
> > index 64d8919..0892cf5 100644
> > --- a/src/sis_utility.c
> > +++ b/src/sis_utility.c
> > @@ -523,7 +523,7 @@ SISSwitchCRT2Type(ScrnInfoPtr pScrn, ULong newvbflags, Bool quiet)
> >      }
> >  #endif
> >  
> > -    if((!(newvbflags & CRT2_ENABLE)) && (!newvbflags & DISPTYPE_CRT1)) {
> > +    if((!(newvbflags & CRT2_ENABLE)) && (!(newvbflags & DISPTYPE_CRT1))) {
> >         if(!quiet) {
> >            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
> >               "CRT2 can't be switched off while CRT1 is off\n");
> 
> The outer parens around the ! expressions are superfluous. The bug was
> just that the ! was inside the existing parens instead of outside them.

But they are consistent with the style used elsewhere in this driver.
I agree on the patch description update though.

Reviewed-by: Mark Kettenis <kettenis at openbsd.org>


More information about the xorg-devel mailing list