From: Christopher Li <sparse@chrisli.org>
To: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Cc: Sparse Mailing-list <linux-sparse@vger.kernel.org>
Subject: Re: [PATCH 1/3] char.c: Fix parsing of escapes
Date: Fri, 17 May 2013 11:27:49 -0700 [thread overview]
Message-ID: <519676A5.4000706@chrisli.org> (raw)
In-Reply-To: <51953664.1040300@ramsay1.demon.co.uk>
On 05/16/2013 12:41 PM, Ramsay Jones wrote:
>
> When parsing a string or character constant, the parse_escape()
> function returns a pointer to the character at which to resume
> parsing. However, in the case of an hex or octal escape, it was
> returning a one-past-the-end pointer. Thus, a string like:
>
> char str[3] = "\x61\x62\x63";
>
> was being parsed as:
>
> '\x61', 'x', '6', '2', '\x63'
>
> which, in turn, provokes an 'too long initializer' warning.
>
> Also, fix an off-by-one error in get_char_constant() when setting
> the 'end' pointer for a TOKEN_CHAR or TOKEN_WIDE_CHAR. Despite the
> name, the string->length of the token is actually the size of the
> allocated memory (ie len+1), so we need to compensate by using
> 'token->string->length - 1'.
Great patch. Applied.
Chris
prev parent reply other threads:[~2013-05-17 18:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-16 19:41 [PATCH 1/3] char.c: Fix parsing of escapes Ramsay Jones
2013-05-17 18:27 ` Christopher Li [this message]
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=519676A5.4000706@chrisli.org \
--to=sparse@chrisli.org \
--cc=linux-sparse@vger.kernel.org \
--cc=ramsay@ramsay1.demon.co.uk \
/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;
as well as URLs for NNTP newsgroup(s).