[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 02:17:07 PDT 2020
lebedev.ri added a comment.
In D84604#2262745 <https://reviews.llvm.org/D84604#2262745>, @lebedev.ri wrote:
> 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.
I've verified that this is indeed the change that causes it,
and therefore gone ahead and temporairly reverted it in rG8427885e27813c457dccb011f65e8ded74444e31 <https://reviews.llvm.org/rG8427885e27813c457dccb011f65e8ded74444e31>.
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