From 5a82845f60b2be8e1b85bed08851c794aa188a39 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 28 Mar 2009 19:09:04 +0000 Subject: update the normally disabled debug code around the syntax() func to use new maybe_die() --- shell/hush.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/shell/hush.c b/shell/hush.c index 84dd9e13c..3ab96a323 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -588,7 +588,6 @@ static const struct built_in_command bltins[] = { }; -#if 1 /* Normal */ static void maybe_die(const char *notice, const char *msg) { @@ -601,23 +600,13 @@ static void maybe_die(const char *notice, const char *msg) #endif fp(msg ? "%s: %s" : notice, notice, msg); } -static void syntax(const char *msg) -{ - maybe_die("syntax error", msg); -} -#else -/* Debug */ -static void syntax_lineno(int line) -{ -#if ENABLE_HUSH_INTERACTIVE - void FAST_FUNC (*fp)(const char *s, ...); - fp = (G.interactive_fd ? bb_error_msg : bb_error_msg_and_die); - fp("syntax error hush.c:%d", line); +#if 1 +#define syntax(msg) maybe_die("syntax error", msg); #else - bb_error_msg_and_die("syntax error hush.c:%d", line); -#endif -} -#define syntax(str) syntax_lineno(__LINE__) +/* Debug -- trick gcc to expand __LINE__ and convert to string */ +#define __syntax(msg, line) maybe_die("syntax error hush.c:" # line, msg) +#define _syntax(msg, line) __syntax(msg, line) +#define syntax(msg) _syntax(msg, __LINE__) #endif static int glob_needed(const char *s) -- cgit v1.2.3