linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 3/3] symbol.c: Set correct size of array from parenthesized string initializer
Date: Sat, 18 May 2013 00:38:03 -0700	[thread overview]
Message-ID: <51972FDB.6060201@chrisli.org> (raw)
In-Reply-To: <5195370B.9080702@ramsay1.demon.co.uk>

On 05/16/2013 12:44 PM, Ramsay Jones wrote:

> diff --git a/validation/init-char-array1.c b/validation/init-char-array1.c
> new file mode 100644
> index 0000000..7427702
> --- /dev/null
> +++ b/validation/init-char-array1.c
> @@ -0,0 +1,25 @@
> +/*
> + * for array of char, ("...") as the initializer is an gcc language
> + * extension. check that a parenthesized string initializer is handled
> + * correctly and that -Wparen-string warns about it's use.
> + */
> +static const char u[] = ("hello");
> +static const char v[] = {"hello"};
> +static const char w[] = "hello";
> +static const char x[5] = "hello";

That seems not complete. I haven't found the official gcc rules
about parenthesized string. I just try the following forms and
gcc takes it.

char x1[] = { ("hello") };
char x2[] = { (("hello")) };

I guess the rules is that parenthesized string can appear in
any place where string was allowed.

Chris

  reply	other threads:[~2013-05-18  7:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16 19:44 [PATCH 3/3] symbol.c: Set correct size of array from parenthesized string initializer Ramsay Jones
2013-05-18  7:38 ` Christopher Li [this message]
2013-05-18  8:14   ` Chris Li
2013-05-20 18:42     ` Ramsay Jones
2013-05-23 15:28       ` Chris Li
2013-05-25 20:01         ` Ramsay Jones
2013-05-29 10:02           ` Chris Li
2013-06-01 17:42             ` Ramsay Jones
2013-05-20 18:37   ` Ramsay Jones

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=51972FDB.6060201@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).