From: Sean Anderson Date: Sun, 28 Feb 2021 18:55:02 -0500 Subject: [PATCH 1/5] hush: Print syntax error line with DEBUG_SHELL In-Reply-To: References: <20210228234718.1208376-1-seanga2@gmail.com> <20210228234718.1208376-2-seanga2@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 2/28/21 6:51 PM, Heinrich Schuchardt wrote: > Am 1. M?rz 2021 00:47:14 MEZ schrieb Sean Anderson : >> This prints the filename (rather useless) and line (very useful) >> whenever a >> syntax error occurs if DEBUG_SHELL is enabled. > > Please, use log_error() instead. The rest of this file uses DEBUG_SHELL already. This is done to reduce the (torrent) of debugs which are only useful for someone debugging the shell. If anything, this should be CONFIG_DEBUG_SHELL (and debug_printf defined to log_debug with CONFIG_DEBUG_SHELL). --Sean > Best regards > > Heinrich > >> >> Signed-off-by: Sean Anderson >> --- >> >> 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__ >