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

Sean Anderson seanga2 at gmail.com
Mon Mar 1 00:55:02 CET 2021


On 2/28/21 6:51 PM, Heinrich Schuchardt wrote:
> Am 1. März 2021 00:47:14 MEZ schrieb Sean Anderson <seanga2 at gmail.com>:
>> 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 <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__
> 




More information about the U-Boot mailing list