From patchwork Mon Nov 19 20:48:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 10689421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9653F14BD for ; Mon, 19 Nov 2018 20:48:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8431829FE4 for ; Mon, 19 Nov 2018 20:48:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 760A42A015; Mon, 19 Nov 2018 20:48:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BD4929FE4 for ; Mon, 19 Nov 2018 20:48:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730825AbeKTHOB (ORCPT ); Tue, 20 Nov 2018 02:14:01 -0500 Received: from avasout04.plus.net ([212.159.14.19]:52482 "EHLO avasout04.plus.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730824AbeKTHOB (ORCPT ); Tue, 20 Nov 2018 02:14:01 -0500 Received: from [10.0.2.15] ([146.198.133.33]) by smtp with ESMTPA id OqTEg9pO3Yyh2OqTFgYlx7; Mon, 19 Nov 2018 20:48:37 +0000 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.3 cv=MoN8FVSe c=1 sm=1 tr=0 a=VCDsReDbrwk4B7AcQzWGLw==:117 a=VCDsReDbrwk4B7AcQzWGLw==:17 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=xQA9DSoN0VXyDSm8IAQA:9 a=QEXdDO2ut3YA:10 a=yJM6EZoI5SlJf8ks9Ge_:22 X-AUTH: ramsayjones@:2500 To: Luc Van Oostenryck Cc: Sparse Mailing-list From: Ramsay Jones Subject: [PATCH 3/9] pre-process: suppress trailing space when dumping macros Message-ID: <85a62d44-a351-4250-e88c-7efe0104b0f0@ramsayjones.plus.com> Date: Mon, 19 Nov 2018 20:48:35 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 Content-Language: en-GB X-CMAE-Envelope: MS4wfAzvTg+BIHcObdeOdAobHkmseNySir34b8BoMFIW+hE8d/niI7V0NRHUE9QZcLljKpxjbVGJauWBkXsrimrTSWuLWdTWWbACxyALtJL4LNkLLZ2Gsruf pthTuTztuOYKZYc2szL7WL/eYTkfDHFITxTwFZP11pX5sUexNPMNnKFzK1cdpqoUUzAYka0rxPvuVA== Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 token directly before the token in the macro definition token list. The 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 token and, if so, don't print the space. Signed-off-by: Ramsay Jones --- 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(' '); }