[PATCH] D19085: [clang-analyzer] fix warnings emitted on compiler-rt code base

Apelete Seketeli via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 14 15:13:22 PDT 2016


apelete added a comment.

In http://reviews.llvm.org/D19085#401547, @george.burgess.iv wrote:

> You're right that the code isn't trying to allocate an array of arrays, and I agree that `sizeof(emutls_address_array)` looks misleading. However, `sizeof(emutls_address_array)` should be equal to `sizeof(void *)`, so the generated code should be identical.


I forgot 'void *' can indeed hold any data pointer. Generated code should indeed be identical, thanks for your patience :-).

> That said, maybe we can placate the static analyzer if we make the new sizes `new_size * sizeof(void*) + sizeof(emutls_address_array)`? If that works, it's probably the cleanest solution.


It works, the static analyzer goes silent with this change.
New revision incoming.

> > Just for my own information, since I'm new to compiler technology and LLVM, is this file processed as C or C++ code ?

> 

> 

> Given that it has a .c extension, I'd say it's C. If you'd like to check this in the future, just throw `namespace {}` in the file and recompile. If it compiles, the compiler thinks it's C++. :)


Thanks for the tip.


http://reviews.llvm.org/D19085





More information about the llvm-commits mailing list