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

31 Mar
2008
31 Mar
'08
4:15 p.m.
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
6246
Age (days ago)
6246
Last active (days ago)
0 comments
1 participants
participants (1)
-
Ben Warren