Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / Sema / attr-nonblocking-constraints.c
blobe7ab661b3125a2da9d2ede9754b47d189a107350
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c89 -Wfunction-effects -internal-isystem %S/../Headers/Inputs/include %s
3 // Tests for a few cases involving C functions without prototypes.
5 void hasproto(void) __attribute__((blocking)); // expected-note {{function does not permit inference of 'nonblocking' because it is declared 'blocking'}}
7 // Has no prototype, inferably safe.
8 void nb1() {}
10 // Has no prototype, noreturn.
11 [[noreturn]]
12 void aborts();
14 void nb2(void) __attribute__((nonblocking)) {
15 hasproto(); // expected-warning {{function with 'nonblocking' attribute must not call non-'nonblocking' function 'hasproto'}}
16 nb1();
17 aborts(); // no diagnostic because it's noreturn.
20 #include <setjmp.h>
22 void nb3(int x, int y) __attribute__((nonblocking)) {
23 if (x != y) {
24 jmp_buf jb;
25 longjmp(jb, 0); // expected-warning {{function with 'nonblocking' attribute must not call non-'nonblocking' function 'longjmp'}}