$ cat demo.c
struct mutex {
int x;
};
struct guarded_int {
struct mutex mu;
int value __attribute__((guarded_by(mu)));
};
$ clang -c demo.c
demo.c:7:38: error: use of undeclared identifier 'mu'
int value __attribute__((guarded_by(mu)));
^
1 error generated.
Clang compiles the code okay with "-x c++", so it seems to be a bug in how Thread Safety Analysis is wired into the C frontend.