diff mbox

[U-Boot,3/3] hush: Include file and line number when reporting syntax errors

Message ID 1345235191-13757-3-git-send-email-joe.hershberger@ni.com
State Rejected
Delegated to: Wolfgang Denk
Headers show

Commit Message

Joe Hershberger Aug. 17, 2012, 8:26 p.m. UTC
Make debugging script problems easier just like non-u-boot.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---
 common/hush.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Mike Frysinger Aug. 17, 2012, 11:33 p.m. UTC | #1
On Friday 17 August 2012 16:26:31 Joe Hershberger wrote:
> Make debugging script problems easier just like non-u-boot.

err, but you're posting "hush.c" all the time, and the line number of the 
source code in hush.c, not the line of the shell script

> --- a/common/hush.c
> +++ b/common/hush.c
> 
>  #ifdef __U_BOOT__
> -static void syntax_err(void) {
> -	 printf("syntax error\n");
> +static void __syntax_err(char *file, int line)

const char *file

> +{
> +	 printf("syntax error %s:%d\n", file, line);
>  }
> +#define syntax_err() __syntax_err(__FILE__, __LINE__)

shouldn't this be behind a DEBUG define ?
-mike
Wolfgang Denk Sept. 2, 2012, 6:33 p.m. UTC | #2
Dear Joe Hershberger,

In message <1345235191-13757-3-git-send-email-joe.hershberger@ni.com> you wrote:
> Make debugging script problems easier just like non-u-boot.
> 
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
>  common/hush.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Skipped (i. e. not applied).  See Mike's comments.

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/common/hush.c b/common/hush.c
index 4c84c2f..1db8a53 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -383,9 +383,11 @@  static inline void debug_printf(const char *format, ...) { }
 #define final_printf debug_printf
 
 #ifdef __U_BOOT__
-static void syntax_err(void) {
-	 printf("syntax error\n");
+static void __syntax_err(char *file, int line)
+{
+	 printf("syntax error %s:%d\n", file, line);
 }
+#define syntax_err() __syntax_err(__FILE__, __LINE__)
 #else
 static void __syntax(char *file, int line) {
 	error_msg("syntax error %s:%d", file, line);