mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: Will Deacon <will.deacon@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	linux-sparse@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Christopher Li <sparse@chrisli.org>
Subject: Re: [RFC/PATCH] arm64: Rename macro arguments to silence sparse
Date: Tue, 7 Feb 2017 02:50:48 +0100	[thread overview]
Message-ID: <20170207015047.4ffc3xzrqsuuzo54@macpro.local> (raw)
In-Reply-To: <d5bb9d5a-5b02-ffab-d404-bbda532b6c76@codeaurora.org>

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 <luc.vanoostenryck@gmail.com>
Date: Tue, 7 Feb 2017 02:37:00 +0100
Subject: [PATCH] add testcase for wrong early escape conversion

Reported-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 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
+ */
-- 
2.11.0

  reply	other threads:[~2017-02-07  1:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07  1:01 Stephen Boyd
2017-02-07  1:08 ` Stephen Boyd
2017-02-07  1:50   ` Luc Van Oostenryck [this message]
2017-02-07 20:11     ` Stephen Boyd
2017-02-07 20:33       ` Van Oostenryck Luc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170207015047.4ffc3xzrqsuuzo54@macpro.local \
    --to=luc.vanoostenryck@gmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=sparse@chrisli.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®