From patchwork Tue Feb 7 01:50:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 9559063 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B0DCB60236 for ; Tue, 7 Feb 2017 01:52:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D9E42654B for ; Tue, 7 Feb 2017 01:52:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 907AD26E4C; Tue, 7 Feb 2017 01:52:20 +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=-1.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 323382654B for ; Tue, 7 Feb 2017 01:52:19 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1caux6-0005fP-ED; Tue, 07 Feb 2017 01:52:16 +0000 Received: from mail-wr0-f195.google.com ([209.85.128.195]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1caux3-0005bp-8I for linux-arm-kernel@lists.infradead.org; Tue, 07 Feb 2017 01:52:14 +0000 Received: by mail-wr0-f195.google.com with SMTP id 89so4268686wrr.1 for ; Mon, 06 Feb 2017 17:51:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=YU0tCfIrkquV9YJJrvRuBLz9BtVqx2f4ccwI2QM/tfY=; b=rKytqVOySCCG1PMdRRDrMqrSPFme4AHb8/p0eW7UzShhonbPYyklE7dzyhkU1y44HH B1UojcAlM+B72MoZbuhL5v2f8Xjhvspy6dK2l6YLHcN40w0V1Ia3ST0YGwz48Rmn6VNV 2nPLuX0vH10GftSI9kt25W88swMGwIFCGrlhyTp+pjFuULJNE3WZemLKSfmqXAk887XD Zpm2U2x2RcWy3WoKdVbwC3IGbq4r0ZlpSUSm9sUfpiybbfcCyIQUsGftbMFhpf6LeGXx AUG4pS1gJVHwG0wiM6RW4YINn4jF1HMGWQe3Adn7H9WMUu/zrJU2IzPF4ZHyyRW92RfD 1s9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=YU0tCfIrkquV9YJJrvRuBLz9BtVqx2f4ccwI2QM/tfY=; b=OxQH3CCbkckcElrdJYH8jdSf0d+m+ZM1dhTREaRlAmztcCsO1sn1u+5aI9dJQAA8Kd OhIGfaApU+FgQu+BjxVfOpeNSQvuApvcH8rKIdt+KbpAumf+jqUPU4pFkTaNNCO+EN66 JLiQTzW+I5WRNPj9NtWc6gPYpwkobTkwhZwJdrSytGyREcdbC/pyWjHyQwLSttuCy7Tv A5GsS08uoN0L8BcHn4FB1xboSSVgkQKESUFfQrnXgLY3m8rRXgjduyZbBVAdn700+H8d t1B/hJt/wXJETMjpvxqHJrnVEGdfPTrfriMtORNm0kJV9H526DjqT4vNqIyNROlXHlSE Jr+w== X-Gm-Message-State: AMke39lTxIihHF2GJ1A4Ke0PjUQaz6K9V9l+CuhQg9ALTD/FVTH0y2oBjTNzAL7a+lFAlA== X-Received: by 10.223.166.137 with SMTP id t9mr3180034wrc.15.1486432250042; Mon, 06 Feb 2017 17:50:50 -0800 (PST) Received: from macpro.local ([2a02:a03f:8cf:5d00:b90a:2cd6:4e46:e74c]) by smtp.gmail.com with ESMTPSA id i29sm4626211wrc.25.2017.02.06.17.50.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Feb 2017 17:50:49 -0800 (PST) Date: Tue, 7 Feb 2017 02:50:48 +0100 From: Luc Van Oostenryck To: Stephen Boyd Subject: Re: [RFC/PATCH] arm64: Rename macro arguments to silence sparse Message-ID: <20170207015047.4ffc3xzrqsuuzo54@macpro.local> References: <20170207010143.22371-1-sboyd@codeaurora.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20161126 (1.7.1) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170206_175213_452640_6D03CC92 X-CRM114-Status: GOOD ( 22.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Catalin Marinas , Christopher Li , Will Deacon , linux-kernel@vger.kernel.org, linux-sparse@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, Feb 06, 2017 at 05:08:17PM -0800, Stephen Boyd wrote: > On 02/06/2017 05:01 PM, Stephen Boyd wrote: > > When I compile files with sparse, I get these sorts of warnings: > > > > arch/arm64/include/asm/lse.h:14:28: warning: Unknown escape 'l' > > arch/arm64/include/asm/lse.h:14:37: warning: Unknown escape 'l' > > arch/arm64/include/asm/alternative.h:172:28: warning: Unknown escape 'o' > > > > This is because sparse is trying to tokenize these files and sees > > a line like this: > > > > alternative_insn "\llsc", "\lse", ARM64_HAS_LSE_ATOMICS > > > > It gets past alternative_insn part and then sees the start of a > > string with the double quote character. So sparse starts to parse > > the string (eat_string() in the sparse code) but the string has > > an escape character '\' in it. Sparse sees the escape character, > > so it checks to see if it's an escape sequence, but '\l' isn't. > > This causes sparse to spit out this warning of an unknown escape > > sequence 'l'. > > > > In reality, sparse isn't going to use these macros anyway because > > this whole thing is inside an __ASSEMBLER__ ifdef. Yes, annoying. Conversion of escaped characters is supposed to be done just after preprocessing. It's definitively a bug. Luc From 786877f6fa5a3b49c92ef08b28c19e58b75ba8e8 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Tue, 7 Feb 2017 02:37:00 +0100 Subject: [PATCH] add testcase for wrong early escape conversion Reported-by: Stephen Boyd Signed-off-by: Luc Van Oostenryck --- validation/preprocessor/early-escape.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 validation/preprocessor/early-escape.c diff --git a/validation/preprocessor/early-escape.c b/validation/preprocessor/early-escape.c new file mode 100644 index 000000000..c7beba5d8 --- /dev/null +++ b/validation/preprocessor/early-escape.c @@ -0,0 +1,23 @@ +#if 0 +"\l" +#endif + +/* + * check-description: + * Following the C standard, escape conversion must be + * done in phase 5, just after preprocessing and just + * before string concatenation. So we're not supposed + * to receive a diagnostic for an unknown escape char + * for a token which is excluded by the preprocessor. + * check-name: early-escape + * check-command: sparse -E $file + * check-known-to-fail + * + * check-output-start + + + * check-output-end + * + * check-error-start + * check-error-end + */