[cfe-commits] PATCH: Make common negative array size diagnostics include the declarator name

Chandler Carruth chandlerc at google.com
Mon Jan 3 17:44:01 PST 2011


The idea is that people have code simulating static_assert with a
preprocessor macro and a template that declares a negatively sized array.
Commonly, the variable name will be passed in from the macro to form the
"user error message" such as it may be. Currently, Clang doesn't include
this name in the diagnostic text, which is usually fine because the source
code is displayed with a caret diagnostic immediately following the
diagnostic. However, this can fall down in several ways: turning caret
diagnostics off, or when the variable name is on a different line from any
of those quoted in the caret diagnostics.

The fix is simple, if a bit crude. Suggestions on better wording or other
places where this would be useful are welcome.

I've included one test that actually checks the functionality of the patch.
There are a bunch of mechanical test updates that will accompany it on
submit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110103/0ce182f3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-neg-array-size-diag.patch
Type: application/octet-stream
Size: 2632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110103/0ce182f3/attachment.obj>


More information about the cfe-commits mailing list