https://bugs.llvm.org/show_bug.cgi?id=46354
Bug ID: 46354
Summary: Missing warning -Wthread-safety-negative when using
capabilities in namespace scope
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
With mutex.h from https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#mutex-h
and -Wthread-safety-negative, there is a warning on
class Foo {
Mutex mu;
public:
void foo() {
mu.Lock(); // acquiring mutex 'mu' requires negative capability '!mu'
mu.Unlock();
}
};
but not on
Mutex mu;
void foo() {
mu.Lock();
mu.Unlock();
}
That's inconsistent, and probably also unintended: "The analyzer assumes that
it holds a negative capability for any object that is not defined within the
current lexical scope. The scope of a class member is assumed to be its
enclosing class, while the scope of a global variable is the translation unit
in which it is defined." [1]
[1]
https://static.googleusercontent.com/media/research.google.com/en/us/pubs/archive/42958.pdf
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs