[cfe-dev] [[Clang] Why is Clang still emitting thread safety warnings when I annotate methods with no_thread_safety_analysis

Siyuan Ren via cfe-dev cfe-dev at lists.llvm.org
Thu Mar 26 14:03:36 PDT 2020


[Here](https://github.com/netheril96/securefs/blob/15b36a894442019bba1466bebe3aa06973a77143/sources/commands.cpp#L128)
is the file where I annotate a method with `no_thread_safety_analysis`
(the macro definition is
[here](https://github.com/netheril96/securefs/blob/15b36a894442019bba1466bebe3aa06973a77143/external/thread_safety_annotations.hpp#L58).

When I compile the file with `-Wthread-safety
-Wthread-safety-negative`, clang still emits tons of warnings, such as

```
calling function 'remove_entry' requires holding mutex 'dir->m_lock'
exclusively [-Wthread-safety-analysis]
```

Why?

My environment is clang 11.0 on Ubuntu 19.10.


More information about the cfe-dev mailing list