| 1 |
// RUN: %check_clang_tidy %s concurrency-mt-unsafe %t -- -config='{CheckOptions: {concurrency-mt-unsafe.FunctionSet: "posix"}}' |
| 2 |
|
| 3 |
extern unsigned int sleep (unsigned int __seconds); |
| 4 |
extern int *gmtime (const int *__timer); |
| 5 |
extern int *gmtime_r (const int *__timer, char*); |
| 6 |
extern char *dirname (char *__path); |
| 7 |
|
| 8 |
void foo() { |
| 9 |
sleep(2); |
| 10 |
::sleep(2); |
| 11 |
|
| 12 |
auto tm = gmtime(nullptr); |
| 13 |
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: function is not thread safe [concurrency-mt-unsafe] |
| 14 |
tm = ::gmtime(nullptr); |
| 15 |
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: function is not thread safe [concurrency-mt-unsafe] |
| 16 |
|
| 17 |
tm = gmtime_r(nullptr, nullptr); |
| 18 |
tm = ::gmtime_r(nullptr, nullptr); |
| 19 |
|
| 20 |
dirname(nullptr); |
| 21 |
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: function is not thread safe [concurrency-mt-unsafe] |
| 22 |
} |