[clang] Thread Safety Analysis: Warn when using negative reentrant capability (PR #141599)

Aaron Puchert via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 5 14:23:10 PDT 2025


================
@@ -4222,6 +4222,11 @@ def warn_fun_requires_lock_precise :
   InGroup<ThreadSafetyPrecise>, DefaultIgnore;
 def note_found_mutex_near_match : Note<"found near match '%0'">;
 
+// Pedantic thread safety warnings enabled by default
+def warn_thread_reentrant_with_negative_capability : Warning<
+  "%0 is marked reentrant but used as a negative capability; this may be contradictory">,
+  InGroup<ThreadSafetyPedantic>, DefaultIgnore;
----------------
aaronpuchert wrote:

All thread-safety warnings are off-by-default, so this should be consistent. But I'm not sure we need a separate flag at all for now. (Reentrant capabilities have just been introduced, so we shouldn't break much.)

https://github.com/llvm/llvm-project/pull/141599


More information about the cfe-commits mailing list