mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH] logo: spell out CONFIG_ options for fixdep
Date: Mon,  2 Jun 2025 08:02:45 +0200	[thread overview]
Message-ID: <20250602060245.746307-1-a.fatoum@barebox.org> (raw)

To avoid rebuilding nearly the whole project when a header changes,
fixdep collects referenced CONFIG_ symbols in every file and prunes the
dependency list accordingly. This only works when we don't hide CONFIG_
symbols with preprocessor text substitution shenanigans.

logo.c does just that triggering a compile failure, when logos are
removed in config without touching the file. Spell out the config
symbols to fix this.

This is the only instance currently of /CONFIG_.*##/, so I believe we
don't have this bug elsewhere.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 lib/logo/logo.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/lib/logo/logo.c b/lib/logo/logo.c
index a64f489939eb..b8f7ae028e83 100644
--- a/lib/logo/logo.c
+++ b/lib/logo/logo.c
@@ -20,10 +20,8 @@
 	extern char __bblogo_barebox_logo_w##width##_start[];			\
 	extern char __bblogo_barebox_logo_w##width##_end[];			\
 										\
-	static void load_logo_##width(void)					\
+	static __maybe_unused void load_logo_##width(void)			\
 	{									\
-		if (!IS_ENABLED(CONFIG_BAREBOX_LOGO_##width))			\
-			return;							\
 		load_logo(width, __bblogo_barebox_logo_w##width##_start,	\
 				__bblogo_barebox_logo_w##width##_end);		\
 	}
@@ -60,11 +58,15 @@ static int logo_init(void)
 	if (ret)
 		return ret;
 
-	load_logo_64();
-	load_logo_240();
-	load_logo_320();
-	load_logo_400();
-	load_logo_640();
+	/*
+	 * fixdep depends on CONFIG_ symbols being listed in the file
+	 * as-is with no preprocessor magic involved
+	 */
+	IF_ENABLED(CONFIG_BAREBOX_LOGO_64,  load_logo_64());
+	IF_ENABLED(CONFIG_BAREBOX_LOGO_240, load_logo_240());
+	IF_ENABLED(CONFIG_BAREBOX_LOGO_320, load_logo_320());
+	IF_ENABLED(CONFIG_BAREBOX_LOGO_400, load_logo_400());
+	IF_ENABLED(CONFIG_BAREBOX_LOGO_640, load_logo_640());
 
 	return 0;
 }
-- 
2.39.5




             reply	other threads:[~2025-06-02  6:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-02  6:02 Ahmad Fatoum [this message]
2025-06-02  7:47 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250602060245.746307-1-a.fatoum@barebox.org \
    --to=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox