[PATCH 6/8] image: Do not #if guard board_fit_config_name_match() prototype

Simon Glass sjg at chromium.org
Sat Dec 19 03:29:05 CET 2020


Hi Alexandru

On Tue, 15 Dec 2020 at 17:10, Alexandru Gagniuc <mr.nuke.me at gmail.com> wrote:
>
> There's no point in guarding function prototypes with #ifdefs. If a
> function is not defined, the linker will notice. Having the prototype
> does not affect code size.
>
> What the #if guard takes away is the ability to use IS_ENABLED:
>
>         if (CONFIG_IS ENABLED(FIT_IMAGE_POST_PROCESS))
>                 board_fit_config_name_match(...)
>
> When the prototype is guarded, the above form cannot be used. This
> leads to the proliferation of #ifdefs, and unreadable code. The
> opportunity cost of the #if guard outweighs any benefits. Remove it.
>
> Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
> ---
>  include/image.h | 3 ---
>  1 file changed, 3 deletions(-)

Yes indeed.

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list