[PATCH v2 01/27] command.h: Add a U_BOOT_LONGHELP macro

Simon Glass sjg at chromium.org
Sun Oct 8 01:12:20 CEST 2023


From: Tom Rini <trini at konsulko.com>

In order to be able to discard unused long help texts without further
linker lists, add a macro for defining the long help messages which uses
__maybe_unused.  This allows us to discard them as unreferenced as part
of the link.

Signed-off-by: Tom Rini <trini at konsulko.com>
Reviewed-by: Simon Glass <sjg at chromium.org>
Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v1)

 include/command.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/command.h b/include/command.h
index 34ea989b39b4..a836ea795ab6 100644
--- a/include/command.h
+++ b/include/command.h
@@ -322,6 +322,9 @@ int cmd_source_script(ulong addr, const char *fit_uname, const char *confname);
 # define _CMD_HELP(x)
 #endif
 
+#define U_BOOT_LONGHELP(_cmdname, text)					\
+	static __maybe_unused const char _cmdname##_help_text[] = text;
+
 #define U_BOOT_SUBCMDS_DO_CMD(_cmdname)					\
 	static int do_##_cmdname(struct cmd_tbl *cmdtp, int flag,	\
 				 int argc, char *const argv[],		\
-- 
2.42.0.609.gbb76f46606-goog



More information about the U-Boot mailing list