PR35503 - warn for restrict pointer

Prathamesh Kulkarni prathamesh.kulkarni@linaro.org
Thu Sep 22 07:12:00 GMT 2016


On 20 September 2016 at 18:31, Joseph Myers <joseph@codesourcery.com> wrote:
> On Tue, 20 Sep 2016, Prathamesh Kulkarni wrote:
>
>> Could someone please take a look at the change to c-format.c, I am not sure
>> if I have added that correctly.
>
> Any changes to these GCC formats also require tests to be updated
> (gcc.dg/format/gcc_diag*).
Hi,
I previously used T_C for 'Z' specifier which was incorrect because
that expected
the argument type to be char *, while the actual type expected is vec<int> *.
I have currently added the following, similar to %p, which I suppose
would at least
silence the "unknown conversion specifier" warning:

 { "Z",   1, STD_C89, { T89_V,   BADLEN,  BADLEN,  BADLEN,  BADLEN,
BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "",
 "",   NULL },

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 ?

Thanks,
Prathamesh
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr35503-10.diff
Type: text/x-patch
Size: 13921 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160922/7db5f103/attachment.bin>


More information about the Gcc-patches mailing list