1 | // RUN: %check_clang_tidy %s cert-err52-cpp %t |
2 | |
3 | typedef void *jmp_buf; |
4 | extern int __setjmpimpl(jmp_buf); |
5 | #define setjmp(x) __setjmpimpl(x) |
6 | [[noreturn]] extern void longjmp(jmp_buf, int); |
7 | |
8 | namespace std { |
9 | using ::jmp_buf; |
10 | using ::longjmp; |
11 | } |
12 | |
13 | static jmp_buf env; |
14 | void g() { |
15 | std::longjmp(env, 1); |
16 | // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not call 'longjmp'; consider using exception handling instead [cert-err52-cpp] |
17 | ::longjmp(env, 1); |
18 | // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not call 'longjmp'; consider using exception handling instead |
19 | longjmp(env, 1); |
20 | // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not call 'longjmp'; consider using exception handling instead |
21 | } |
22 | |
23 | void f() { |
24 | (void)setjmp(env); |
25 | // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: do not call 'setjmp'; consider using exception handling instead |
26 | } |
27 | |