diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-08-05 09:10:50 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-08-05 09:10:50 +0000 |
commit | c268434b332bbe57950d977633369bf5822d9554 (patch) | |
tree | 3d8607c86d206590e64609b483f2323b549fb385 /lib/Analysis/LiveVariables.cpp | |
parent | ba44712b0e578a851751e199bb75dbbff5836fed (diff) |
Flesh out the -Warray-bounds detection of C89 tail-padded one-element
arrays. This now suppresses the warning only in the case of
a one-element array as the last field in a struct where the array size
is a literal '1' rather than any macro expansion or template parameter.
This doesn't distinguish between the language standard in use to allow
code which dates from C89 era to compile without the warning even in C99
and C++ builds. We could add a separate warning (under a different flag)
with fixit hints to switch to a flexible array, but its not clear that
this would be desirable. Much of the code using this idiom is striving
for maximum portability.
Tests were also fleshed out a bit, and the diagnostic itself tweaked to
be more pretty w.r.t. single elment arrays. This is more ugly than
I would like due to APInt's not being supported by the diagnostic
rendering engine.
A pseudo-patch for this was proposed by Nicola Gigante, but I reworked
it both for several correctness issues and for code style.
Sorry this was so long in coming.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136965 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LiveVariables.cpp')
0 files changed, 0 insertions, 0 deletions