[PATCH] D84604: Thread safety analysis: Consider global variables in scope

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 9 01:20:32 PDT 2020


lebedev.ri added a comment.

I'm not sure this is the problematic patch, but i'm now seeing some weird warnings:

  <source>:304:15: warning: acquiring mutex 'guard' requires negative capability '!guard' [-Wthread-safety-negative]
    MutexLocker guard(&mutex);
                ^
  <source>:309:15: warning: acquiring mutex 'guard' requires negative capability '!guard' [-Wthread-safety-negative]
    MutexLocker guard(&mutex);
                ^
  <source>:322:15: warning: acquiring mutex 'guard' requires negative capability '!guard' [-Wthread-safety-negative]
    MutexLocker guard(&mutex);
                ^
  3 warnings generated.

https://godbolt.org/z/5zYT55

If this is the patch that causes it, then i think it's an obvious false-positive (wasn't this patch supposed to only handle globals?),
if not, the warning's wording is not great.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84604/new/

https://reviews.llvm.org/D84604



More information about the cfe-commits mailing list