From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Fri, 19 Feb 2021 11:55:40 -0500 Subject: [PATCH v4 6/8] image: Do not #if guard board_fit_image_post_process() prototype In-Reply-To: <20210120164656.1396639-7-mr.nuke.me@gmail.com> References: <20210120164656.1396639-1-mr.nuke.me@gmail.com> <20210120164656.1396639-7-mr.nuke.me@gmail.com> Message-ID: <20210219165540.GT10169@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Jan 20, 2021 at 10:46:54AM -0600, Alexandru Gagniuc 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_image_post_process(...) > > 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. > > Since the original version of this patch, an empty definition was > added by commit f14e6eec6c7f ("image: cleanup pre-processor usage"). > The empty definition can cause silent failures, when an implementation > of board_fit_image_post_process() is expected because the linker will > not catch the missing function. Thus this patch removes this empty > inline declaration. > > Fixes: f14e6eec6c7f ("image: cleanup pre-processor usage") > Signed-off-by: Alexandru Gagniuc > Reviewed-by: Simon Glass Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: