[PATCH 3/9] pre-process: suppress trailing space when dumping macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxx>
---
 pre-process.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pre-process.c b/pre-process.c
index bf4b8e7..8abd5e6 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(' ');
 		}
-- 
2.19.0



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux