[PATCH 1/5] hush: Print syntax error line with DEBUG_SHELL

Sean Anderson seanga2 at gmail.com
Mon Mar 1 00:47:14 CET 2021


This prints the filename (rather useless) and line (very useful) whenever a
syntax error occurs if DEBUG_SHELL is enabled.

Signed-off-by: Sean Anderson <seanga2 at gmail.com>
---

 common/cli_hush.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/common/cli_hush.c b/common/cli_hush.c
index 1b9bef64b6..83329763c6 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -372,15 +372,17 @@ static inline void debug_printf(const char *format, ...) { }
 #endif
 #define final_printf debug_printf
 
-#ifdef __U_BOOT__
+#ifdef DEBUG_SHELL
+static void __syntax(char *file, int line)
+{
+	error_msg("syntax error %s:%d\n", file, line);
+}
+
+#define syntax_err() __syntax(__FILE__, __LINE__)
+#else
 static void syntax_err(void) {
 	 printf("syntax error\n");
 }
-#else
-static void __syntax(char *file, int line) {
-	error_msg("syntax error %s:%d", file, line);
-}
-#define syntax() __syntax(__FILE__, __LINE__)
 #endif
 
 #ifdef __U_BOOT__
-- 
2.30.1



More information about the U-Boot mailing list