Hi, the attached patch produces this diagnostic
test/Sema/warn-sizeof-arrayarg.c:14:15: warning: sizeof on array
function parameter will return size of 'int *' instead of 'int [10]'
[-Wsizeof-array-argument]
(void)sizeof(a); // \
^
test/Sema/warn-sizeof-arrayarg.c:7:12: note: declared here
void f(int a[10], Arr arr) { // \
^
for this code:
void f(int a[10]) {
compute_hash(a, sizeof(a));
}
It finds 0 bugs and 0 false positives in llvm/clang code and 2 bugs
and 0 false positives in chrome/webkit.
Ok?
Nico
clang-sizeof-arrary-arg.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
