This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR35503 - warn for restrict pointer
- From: David Malcolm <dmalcolm at redhat dot com>
- To: Prathamesh Kulkarni <prathamesh dot kulkarni at linaro dot org>, Marek Polacek <polacek at redhat dot com>
- Cc: Tobias Burnus <tobias dot burnus at physik dot fu-berlin dot de>, gcc Patches <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Mon, 29 Aug 2016 20:01:24 -0400
- Subject: Re: PR35503 - warn for restrict pointer
- Authentication-results: sourceware.org; auth=none
- References: <CAAgBjM=cBASQABxosjJDvgCy-pfq=EPk0s-2e-Sy=xwGK-4MDw@mail.gmail.com> <20160829142525.GB9825@physik.fu-berlin.de> <20160829142925.GE11131@redhat.com> <CAAgBjMnmFf-jM1z6H+Yxp-wa=-e95GT=MPC-_9Q+qJR7PSnOpA@mail.gmail.com> <1472514930.5595.96.camel@redhat.com>
On Mon, 2016-08-29 at 19:55 -0400, David Malcolm wrote:
[...]
> Assuming you have the location_t values available, you can create a
> rich_location for the primary range, and then add secondary ranges
> like
> this:
>
> rich_location richloc (loc_of_arg1);
Oops, the above should be:
rich_location richloc (line_table, loc_of_arg1);
or:
gcc_rich_location (loc_of_arg1);
which does the same thing (#include "gcc-rich-location.h").
> richloc.add_range (loc_of_arg3, false); /* false here = don't draw
> a
> caret, just the underline */
> richloc.add_range (loc_of_arg4, false);
> warning_at_rich_loc (&richloc, OPT_Wrestrict, etc...
>
> See line-map.h for more information on rich_location.
[...]