[U-Boot] [PATCH] semihosting: Improve ARMv7A support
Andrey Smirnov
andrew.smirnov at gmail.com
Sat Sep 12 17:59:10 CEST 2015
On Sat, Sep 12, 2015 at 12:12 AM, Albert ARIBAUD
<albert.u.boot at aribaud.net> wrote:
> Hello Andrey,
>
> Two nitpicks:
>
>> +#if defined(CONFIG_ARM64)
>> static noinline long smh_trap(unsigned int sysnum, void *addr)
>> {
>> register long result asm("r0");
>> -#if defined(CONFIG_ARM64)
>
> What's the point of moving the #ifdef up? It just forces you to
> duplicate the function start with no discernable benefit since the
> function name and arguments are the same in the 64 and 32 bit case.
>
The point is to improve readability of the code. With #ifdef moved up
you have to figure out the version of the code you care about first
and then you can read the entirety of the function and reason about
it. With #ifdefs inside of the body of the function, every time you
read it you have to filter out all of the "irrelevant junk" that
compiler would not even see on your platform.
More information about the U-Boot
mailing list