summaryrefslogtreecommitdiff
path: root/test/tsan/suppressions_mutex.cc
blob: 5d3a5d05289f1117e93881594fa65f232d51df12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// RUN: %clang_tsan -O1 %s -o %t && %env_tsan_opts=suppressions='%s.supp' %run %t 2>&1 | FileCheck %s
#include "test.h"

void __attribute__((noinline)) suppress_this(pthread_mutex_t *mu) {
  pthread_mutex_destroy(mu);
}

int main() {
  pthread_mutex_t mu;
  pthread_mutex_init(&mu, 0);
  pthread_mutex_lock(&mu);
  suppress_this(&mu);
  fprintf(stderr, "DONE\n");
  return 0;
}

// CHECK-NOT: failed to open suppressions file
// CHECK-NOT: WARNING: ThreadSanitizer:
// CHECK: DONE