[U-Boot-Users] [PATCH 08/13] SPARC: added SMC91111 driver in and out macros for LEON processors.

Ben Warren biggerbadderben at gmail.com
Mon Mar 31 16:15:05 CEST 2008


Alessandro Rubini wrote:
>>> +#define SMC_insb(r,b,l) 	({	int __i ;  \
>>> +					byte *__b2;  \
>>> +			    		__b2 = (byte *) b;  \
>>> +			    		for (__i = 0; __i < l; __i++) {  \
>>> +					  *(__b2 + __i) = SMC_inb(r);  \
>>> +					  SMC_inb(0);  \
>>> +					};  \
>>> +				})
>>>       
>
>   
>> [...] it's generally considered good form to wrap multi-line macros with 
>> do {...} while(0) in order to avoid compiler issues.
>>     
>
> But this is the "expression statement" gcc slang. the do/while0 thing
> avoids if/else problems but isn't an expression, it is a statement.
> This has no issue with if/else (no trailing semicolon or brace) and
> moreover it is an expression.
>
>   
Oh, I see.  Thanks for taking the time Alessandro.  I'm putting this 
back on list so others can be educated too.

regards,
Ben




More information about the U-Boot mailing list