[cfe-commits] [Patch] Produce errors for 'static' and type qualifiers in array declarators

Hans Wennborg hans at chromium.org
Mon Aug 6 11:12:35 PDT 2012


As mentioned in a recent cfe-dev thread [1], Clang currently fails to
produce errors for using 'static' and type qualifiers in array
declarators outside of function prototypes. For example:

void f(int x[static 42]) { // <-- This is fine.
  int a[static 42]; // <-- This should be an error.
}

Attached is my attempt to fix this.

One thing I was uncertain of is what to do when the code has multiple
errors. For example, if it has 'static' in an array declarator that is
both outside a function prototype, and also not in the first pair of
brackets. Currently, my patch only gives one error.

Please take a look.

Thanks,
Hans

[1]. http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-August/023482.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: static_in_array_decls.patch
Type: application/octet-stream
Size: 4664 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120806/e033972c/attachment.obj>


More information about the cfe-commits mailing list