From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Warren Date: Mon, 31 Mar 2008 10:15:05 -0400 Subject: [U-Boot-Users] [PATCH 08/13] SPARC: added SMC91111 driver in and out macros for LEON processors. In-Reply-To: <20080331111242.GA29923@mail.gnudd.com> References: <47EF1725.7050106@gmail.com> <1206732179-23031-1-git-send-email-daniel@gaisler.com> <1206732179-23031-8-git-send-email-daniel@gaisler.com> <20080331111242.GA29923@mail.gnudd.com> Message-ID: <47F0F1E9.3080009@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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