[PATCH] D148381: [Clang] Add counted_by attribute
Kees Cook via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 6 11:00:47 PDT 2023
kees added a comment.
I can generate warnings for anonymous structs were the `__counted_by` member is reported as "not found". For example:
little.c:7:28: warning: counted_by field 'count' not found
7 | int array[] __counted_by(count);
| ^~~~~
For this:
#define __counted_by(member) __attribute__((__counted_by__(member)))
struct anon {
unsigned long flags;
struct {
unsigned char count;
int array[] __counted_by(count);
};
};
extern void bar(int input);
void foo(struct anon *p, int index)
{
bar(p->array[index]);
}
Otherwise, things are looking good on test builds so far...
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148381/new/
https://reviews.llvm.org/D148381
More information about the cfe-commits
mailing list