Re: PATCH: io.h remove detrimental do {...} whiles, add sequence points, add const modifiers

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

 



On Fri, Dec 07, 2001 at 06:30:43PM +0100, Geert Uytterhoeven wrote:
> On Fri, 7 Dec 2001, Bradley D. LaRonde wrote:
> > 2001-12-07  Bradley D. LaRonde <brad@ltc.com>
> > 
> > * remove detrimental do {...} whiles
> > * add sequence point to in[b,w,l] to prevent compiler from reordering
> > * add const modifier to outs[b,w,l] (quiets some compiler warnings)
> > 
> > 
> > --- linux-oss-2.4-2001-12-04/include/asm-mips/io.h	Thu Dec  6 17:07:24 2001
> > +++ linux-patch/include/asm-mips/io.h	Thu Dec  6 16:47:20 2001
> > @@ -63,7 +63,7 @@
> >  extern const unsigned long mips_io_port_base;
> >  
> >  #define set_io_port_base(base)	\
> > -	do { * (unsigned long *) &mips_io_port_base = (base); } while (0)
> > +	*(unsigned long *)&mips_io_port_base = (base);
> 
> Now consider someone writing
> 
>     if (...)
> 	set_io_port_base(...);
>     else
> 	...
> 
> And see what happens...

If Bradley loses the extra semicolon, what other problem is the
do/while construct supposed to address?  I seem to recall there being
another problem case, but I can't remember what it is.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux