[U-Boot] [PATCH v4 0/8] Provide a mechanism to avoid using #ifdef everywhere

Wolfgang Denk wd at denx.de
Mon Oct 28 15:44:01 CET 2013


Dear Simon,

In message <1382800457-26608-1-git-send-email-sjg at chromium.org> you wrote:
> Many parts of the U-Boot code base are sprinkled with #ifdefs. This makes
> different boards compile different versions of the source code, meaning
> that we must build all boards to check for failures. It is easy to misspell
> an #ifdef and there is not as much checking of this by the compiler. Multiple
> dependent #ifdefs are harder to do than with if..then..else. Variable
> declarations must be #idefed as well as the code that uses them, often much
> later in the file/function. #ifdef indents don't match code indents and
> have their own separate indent feature. Overall, excessive use of #idef
> hurts readability and makes the code harder to modify and refactor. For
> people coming newly into the code base, #ifdefs can be a big barrier.

While I agree in general with the goal and the implementation, there
is an implementation detail I dislike - this is that the new code
is harder to type and to read - I mean, something like
CONFIG_SYS_HUSH_PARSER is already clumsy enough, but making this
autoconf_sys_hush_parser() appears to be worse.  Also, the connection
to a CONFIG_* option is not easily visible.


I also had feedback from Detlev (who is unfortunately on a business
trip again so he didn't find time [yet] to comment himself); he
commented that he really likes the idea, but does not like that we now
have to access the well-known contants using a new name.


Maybe we can find a shorter / easier to read way to do this - I think
it would be really nice if we could see the well-known names.

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
Where there's no emotion, there's no motive for violence.
	-- Spock, "Dagger of the Mind", stardate 2715.1


More information about the U-Boot mailing list