[cfe-dev] warning request: partial array initialisation

Chandler Carruth chandlerc at google.com
Tue Jun 19 12:59:05 PDT 2012

On Tue, Jun 19, 2012 at 12:31 PM, Jay Foad <jay.foad at gmail.com> wrote:

> On 19 June 2012 18:56, Chandler Carruth <chandlerc at google.com> wrote:
> > When we're designing warnings that try to catch bugs, we need to focus on
> > getting the warning into a state that is easier to explain and cope with
> for
> > our users. For example:
> >
> > 1) A warning that is *always* a bug in the code is easy: the user can't
> > really complain, their code is simply wrong.
> > 2) A warning that directs innocent users to some alternate syntax which
> hase
> > equivalent semantics but is more explicit / clear / less bug-prone.
> Fair point. I agree with the general principle that the compiler
> shouldn't warn when there's no better way to express what you really
> want; and if I really want
>  static int a[1000000] = { 1, 2, /* all the rest 0 */ };
> then there's no better way of writing it.
> > Also, this seems really like a coding convention or style you would like
> to enforce, and so I suspect a separate tool would be better suited to it.
> Yup. I'd love a general purpose scriptable tool for doing this kind of
> thing. Maybe it's time I looked at Coccinelle...

Have you looked at the Tooling stuff Manuel and others are building up? It
is specifically targeting these use cases.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120619/4f60dada/attachment.html>

More information about the cfe-dev mailing list