summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRamsay Jones <ramsay@ramsayjones.plus.com>2018-11-19 20:48:35 +0000
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-11-24 13:14:09 +0100
commit24278007c5315d94f76ce550d27192f55cb2840a (patch)
tree91397ed80092d56463830bde323215b6ae94a415
parentfdf8252f312a40df9aa51c6e30c0d07fa29ebd12 (diff)
downloadsparse-24278007c5315d94f76ce550d27192f55cb2840a.tar.gz
pre-process: suppress trailing space when dumping macros
The dump_macro() function outputs a trailing space character for every macro. This makes comparing the '-dD' output from sparse to the similar output from gcc somewhat annoying. The space character arises from the presence of an <untaint> token directly before the <eof> token in the macro definition token list. The <untaint> token seems to always have the 'whitespace' flag set, which results in the output of a space in order to separate it from the current token. In order to suppress the unwanted space character, check if the next token is an <untaint> token and, if so, don't print the space. Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--pre-process.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/pre-process.c b/pre-process.c
index bf4b8e76..8abd5e6e 100644
--- a/pre-process.c
+++ b/pre-process.c
@@ -2201,6 +2201,8 @@ static void dump_macro(struct symbol *sym)
/* fall-through */
default:
printf("%s", show_token(token));
+ if (token_type(next) == TOKEN_UNTAINT)
+ break;
if (next->pos.whitespace)
putchar(' ');
}