'Does Clang's Thread Safety Analysis work for C programs using pthread mutexes?

The Clang's Thread Safety Analysis is a system of manually applied annotations that can be then checked by the compiler if I specify -Wthread-safety.

As far as I can tell, this is C++ only and does not work for C programs. At least I could not make it work.

#include "mutex_annotations.h"
#include <pthread.h>

struct counter {
    pthread_mutex_t mu;
    int count GUARDED_BY(mu);
};
% clang -std=c11 -c try.c -Wthread-safety
try.c:6:26: error: use of undeclared identifier 'mu'


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source