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

source code of clang-tools-extra/test/clang-tidy/checkers/concurrency/mt-unsafe-any.cpp