[PATCH 7/8] spl: fit: Replace #ifdef blocks with more readable constructs

Simon Glass sjg at chromium.org
Mon Dec 21 21:23:41 CET 2020


Hi Alex,

On Mon, 21 Dec 2020 at 10:43, Alex G. <mr.nuke.me at gmail.com> wrote:
>
>
>
> On 12/18/20 8:29 PM, Simon Glass wrote:
> > On Tue, 15 Dec 2020 at 17:10, Alexandru Gagniuc <mr.nuke.me at gmail.com> wrote:
> >>
> >> Use the IS_ENABLED() macro to control code flow, instead of the
> >> caveman approach of sprinkling #ifdefs. Code size is not affected, as
> >> the linker garbage-collects unused functions. However, readability is
> >> improved significantly.
> >>
> >> Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
> >> ---
> >>   common/spl/spl_fit.c | 53 ++++++++++++++++++++------------------------
> >>   1 file changed, 24 insertions(+), 29 deletions(-)
> >
> > I am trying to imagine stick drawings with #ifdefs
> >
>                                     #ifdef
>                                   #if     #if
>                                 #if         #if
>                                 #if         #if
>
>                                   #if     #if
>                                     #endif
>                            #if        #if        #if
>                              #if      #if      #if
>                                #if    #if    #if
>                                  #if  #if  #if
>                                     #ifdef
>                                     #endif
>                                     #endif
>                                     #endif
>                                     #endif
>                                     #endif
>                                     #endif
>                                     #endif
>                                     #endif
>                                     #endif
>                                     #endif
>                                     #endif
>                                     #endif
>                                     #endif
>                                     #endif
>                                     #endif
>                                     #endif
>                                     #endif
>                                     #ifdef
>                                  #if       #if
>                                #if           #if
>                              #if               #if
>                            #if                   #if
>                       #endif                      #endif
>

So you are an artist and an engineer.

Regards,
Simon


More information about the U-Boot mailing list