On Thu, 2016-02-18 at 14:28 +0000, Manuel López-Ibáñez wrote:
> On 18/02/16 11:40, Prasad Ghangal wrote:
> > Wouldn't it be nice instead of multiple warnings if gcc gives
> > single
> > warning like :
> >
> > 68425.c:3:34: warning: excess elements in array initializer (6
> > elements, expected 2)
> > const int array[2] = { 1, 2, 3 ,6 ,89 ,193};
> > ^
>
> Yes! Perhaps even (now that we have ranges!):
>
> 68425.c:3:34: warning: excess elements in array initializer (6
> elements,
> expected 2)
> const int array[2] = { 1, 2, 3 ,6 ,89 ,193};
> ^~~~~~~~~~~~~
Yes, that would be ideal. Unfortunately, not every tree expression
node has a location stored for it, so implementing the underlined range
might be tricky to do. (in particular, INTEGER_CST doesn't. I hope to
look into that for gcc 7, perhaps with a wrapper node to provide
locations for expr nodes that don't have them).
> But even without ranges, your suggestion would be a great
> improvement.
Agreed.