From: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
To: David Malcolm <dmalcolm@redhat.com>
Cc: Joseph Myers <joseph@codesourcery.com>,
Martin Sebor <msebor@gmail.com>,
Richard Biener <rguenther@suse.de>,
Tom de Vries <Tom_deVries@mentor.com>,
gcc Patches <gcc-patches@gcc.gnu.org>,
Marek Polacek <polacek@redhat.com>,
Jason Merrill <jason@redhat.com>
Subject: Re: PR35503 - warn for restrict pointer
Date: Sat, 08 Oct 2016 17:07:00 -0000 [thread overview]
Message-ID: <CAAgBjMkJBwrhEcxpBx-7-YaFkuwUMPcyffxw_7NzKruYPVD17Q@mail.gmail.com> (raw)
In-Reply-To: <1475842779.24366.12.camel@redhat.com>
On 7 October 2016 at 17:49, David Malcolm <dmalcolm@redhat.com> wrote:
> On Fri, 2016-10-07 at 10:33 +0530, Prathamesh Kulkarni wrote:
>> On 22 September 2016 at 23:15, Joseph Myers <joseph@codesourcery.com>
>> wrote:
>> > On Thu, 22 Sep 2016, Prathamesh Kulkarni wrote:
>> >
>> > > Would that be acceptable ? I am not sure how to make %Z check if
>> > > the
>> > > argument has type vec<int> *
>> > > since vec<int> is not really a builtin C type.
>> > > Could you suggest me a better solution so that the format checker
>> > > will check
>> > > if arg has type vec<int> * instead of checking if it's just a
>> > > pointer ?
>> > > Also for testing, should I create a testcase in g++.dg since
>> > > gcc.dg/format/ tests are C-only ?
>> >
>> > If it's C++-only then it would need to be in g++.dg.
>> >
>> > The way we handle GCC-specific types in checking these formats is
>> > that the
>> > code using these formats has to define typedefs which the format
>> > -checking
>> > code then looks up. In most cases it can just look up names like
>> > location_t or tree, but for HOST_WIDE_INT it looks up
>> > __gcc_host_wide_int__ which the user must have defined as a
>> > typedef.
>> > Probably that's the way to go in this case: the user must do
>> > "typedef
>> > vec<int> __gcc_vec_int__;" or similar, and the code looks up
>> > __gcc_vec_int__.
>> Thanks for the suggestions. To keep it simple, instead of vec<int>,
>> I made %Z take two args: int *v, unsigned len, and prints elements in
>> v having length == len.
>> Is that OK ?
>>
>> Bootstrapped+tested on x86_64-unknown-linux-gnu.
>> As pointed out earlier in the thread, the patch can give false
>> positives because
>> it only checks whether parameters are qualified with restrict, not
>> how
>> parameters
>> are used inside the function. For instance it warned for example 10
>> mentioned in n1570
>> under section 6.7.3.1 - "Formal definition of restrict".
>> Should we keep the warning in Wall or keep it in Wextra ?
>> The attached patch enables it with Wall.
>>
>> Thanks,
>> Prathamesh
>
> This needs a ChangeLog.
>
> The changes to diagnostic-core.h and diagnostic.c are OK for trunk,
> given a suitable ChangeLog (and could be split into a separate patch if
> you like).
Thanks, I committed diagnostic.c and diagnostic-core.h changes (with ChangeLog)
in r240891.
Thanks,
Prathamesh
next prev parent reply other threads:[~2016-10-08 17:07 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-26 11:39 Prathamesh Kulkarni
2016-08-26 12:15 ` Joseph Myers
2016-08-26 15:56 ` Jason Merrill
2016-08-28 13:03 ` Prathamesh Kulkarni
2016-08-29 14:12 ` Marek Polacek
2016-08-29 14:25 ` Tobias Burnus
2016-08-29 14:29 ` Marek Polacek
2016-08-29 21:53 ` Prathamesh Kulkarni
2016-08-29 23:55 ` David Malcolm
2016-08-30 0:01 ` David Malcolm
2016-08-30 0:04 ` David Malcolm
2016-08-30 11:39 ` Prathamesh Kulkarni
2016-08-30 13:20 ` David Malcolm
2016-08-31 16:00 ` Prathamesh Kulkarni
2016-08-30 14:54 ` Tom de Vries
2016-08-30 15:34 ` Prathamesh Kulkarni
2016-08-30 17:29 ` Tom de Vries
2016-08-30 17:57 ` Prathamesh Kulkarni
2016-08-31 0:41 ` David Malcolm
2016-09-01 6:55 ` Richard Biener
2016-09-01 9:25 ` Prathamesh Kulkarni
2016-09-01 15:58 ` Martin Sebor
2016-09-05 12:03 ` Prathamesh Kulkarni
2016-09-02 17:44 ` David Malcolm
2016-09-02 19:54 ` Manuel López-Ibáñez
2016-09-18 18:48 ` Prathamesh Kulkarni
2016-09-19 18:34 ` Jason Merrill
2016-09-19 21:17 ` David Malcolm
2016-09-19 21:52 ` Joseph Myers
2016-09-19 21:24 ` David Malcolm
2016-09-20 7:41 ` Martin Sebor
2016-09-20 12:16 ` Prathamesh Kulkarni
2016-09-20 13:21 ` Joseph Myers
2016-09-22 7:12 ` Prathamesh Kulkarni
2016-09-22 18:01 ` Joseph Myers
2016-10-07 5:03 ` Prathamesh Kulkarni
2016-10-07 12:19 ` David Malcolm
2016-10-08 17:07 ` Prathamesh Kulkarni [this message]
2016-10-12 14:23 ` Jason Merrill
2016-10-13 20:16 ` Prathamesh Kulkarni
2016-09-20 13:10 ` Joseph Myers
2016-09-20 14:24 ` Martin Sebor
2016-09-20 14:34 ` Joseph Myers
2016-09-20 10:07 ` Pedro Alves
2016-08-31 20:08 ` Fabien Chêne
2016-08-31 7:49 ` Tom de Vries
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=CAAgBjMkJBwrhEcxpBx-7-YaFkuwUMPcyffxw_7NzKruYPVD17Q@mail.gmail.com \
--to=prathamesh.kulkarni@linaro.org \
--cc=Tom_deVries@mentor.com \
--cc=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=joseph@codesourcery.com \
--cc=msebor@gmail.com \
--cc=polacek@redhat.com \
--cc=rguenther@suse.de \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).