[cfe-commits] Skipping analysis inside of lock functions

Caitlin Sadowski supertri at google.com
Tue Sep 13 18:05:00 PDT 2011


Actually, it is pretty common. Anytime you want something like:

class MutexWrapper() {
  private:
    Mutex mu;
  public:
   void LockMutex() {
      mu.Lock();
   }
   void UnlockMutex() {
    mu.Unlock();
   }
}

However, I think I have a better idea how to do it -- patch sequence
follows shortly.

Cheers,

Caitlin

On Mon, Sep 12, 2011 at 4:18 PM, Chandler Carruth <chandlerc at google.com> wrote:
> On Mon, Sep 12, 2011 at 4:10 PM, Caitlin Sadowski <supertri at google.com>
> wrote:
>>
>> Attached is a patch which skips analysis inside of lock functions
>> (avoiding spurious warnings).
>
> Can you give examples of the real-world code that would trigger warnings
> without this? I have to admit I'm a bit suspect. It seems like if you're
> doing something other than atomic operations and system calls inside of your
> lock function, you might well want thread safety annotations for that....



More information about the cfe-commits mailing list