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: Martin Sebor <msebor at gmail dot com>
- To: Prathamesh Kulkarni <prathamesh dot kulkarni at linaro dot org>, David Malcolm <dmalcolm at redhat dot com>
- Cc: Richard Biener <rguenther at suse dot de>, Tom de Vries <Tom_deVries at mentor dot com>, gcc Patches <gcc-patches at gcc dot gnu dot org>, Marek Polacek <polacek at redhat dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, Jason Merrill <jason at redhat dot com>
- Date: Mon, 19 Sep 2016 21:27:09 -0600
- Subject: Re: PR35503 - warn for restrict pointer
- Authentication-results: sourceware.org; auth=none
- References: <CAAgBjMkRNk3f47mXwZ6J_MyMHQym4vo3+zXCZ1R6jjrqDkKRYA@mail.gmail.com> <fcf386ee-6e1c-fb81-d43f-7e825978e0ee@mentor.com> <CAAgBjM=yQGLhxmc155Eg2ggSys0u+z8ieZebxVcoC3h5O7dk0Q@mail.gmail.com> <181560f0-c738-cff9-9002-101686da4c14@mentor.com> <alpine.LSU.2.11.1609010842570.26629@t29.fhfr.qr> <CAAgBjMnakS3C2LX3HLrABJvN3artp-MYJZr_5VZ9Z_ULe+5cwQ@mail.gmail.com> <1472838245.5595.183.camel@redhat.com> <CAAgBjMmDH2tU7HbdFhcotm0NioUs0txnjWhGcSSYnRcEMu-_=g@mail.gmail.com>
and used
pp_format for formatting arg_positions by adding specifier %I (name
chosen arbitrarily).
Does that look OK ?
diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c
index a39815e..e8bd1ef 100644
--- a/gcc/pretty-print.c
+++ b/gcc/pretty-print.c
@@ -610,6 +610,23 @@ pp_format (pretty_printer *pp, text_info *text)
(pp, *text->args_ptr, precision, unsigned, "u");
break;
+ case 'I':
The comment just above pp_format that lists the format specifiers
understood by the function should be updated. There probably (I
hope) is more formal documentation of the format specifiers
somewhere else that should be updated as well.
That said, since this specifier formats a vec<int>, it seems that
it might be useful to be able to format vectors of other elements,
such as short and long. With that in mind, would adding a new V
length modifier instead be a more regular way to extend the pretty
printer to these types? The V length modifier would have to be
accepted in conjunction with other length modifiers (h, l, etc
and type specifiers (d, i, o, etc.). E.g, "%hVu" would accept
a vec<unsigned short>* as an argument and format it as a sequence
of decimal numbers, and "%lVx" would do the same for vec<long>*
formatting them in hex.
Martin