From: Wolfgang Denk Date: Mon, 07 Nov 2011 22:55:54 +0100 Subject: [U-Boot] [PATCH v0 4/7] x86: Provide more configuration granularity In-Reply-To: <1320459711-20257-5-git-send-email-graeme.russ@gmail.com> References: <1320459711-20257-1-git-send-email-graeme.russ@gmail.com> <1320459711-20257-5-git-send-email-graeme.russ@gmail.com> Message-ID: <20111107215554.7A791189301B@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Graeme Russ, In message <1320459711-20257-5-git-send-email-graeme.russ@gmail.com> you wrote: > Planned future ports requires more granularity for some options ... > +#if defined(CONFIG_CMD_NET) > char *s; > +#endif > +#ifndef CONFIG_SYS_NO_FLASH > ulong size; > +#endif ... > +#ifndef CONFIG_SYS_NO_FLASH > /* configure available FLASH banks */ > size = flash_init(); > display_flash_config(size); > show_boot_progress(0x24); > +#endif The more often I see this, the less I like it. In a number of recent cleanup patches I tried to avoid such multiple #ifdefs by using local blocks, like that: #ifndef CONFIG_SYS_NO_FLASH { ulong size; /* configure available FLASH banks */ size = flash_init(); display_flash_config(size); show_boot_progress(0x24); } #endif This is not exactly nice either, but at least keeps the related declarations and code together, and reduces the number of #ifdef's. Have a look at it and feel free to use this method if you like it, or just ignore it. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de They say a little knowledge is a dangerous thing, but it is not one half so bad as a lot of ignorance. - Terry Pratchett, _Equal Rites_