brintos

brintos / llvm-project-archived public Read only

0
0
Text · 939 B · e7ab661 Raw
28 lines · c
1// RUN: %clang_cc1 -fsyntax-only -verify -std=c89 -Wfunction-effects -internal-isystem %S/../Headers/Inputs/include %s2 3// Tests for a few cases involving C functions without prototypes.4 5void hasproto(void) __attribute__((blocking)); // expected-note {{function does not permit inference of 'nonblocking' because it is declared 'blocking'}}6 7// Has no prototype, inferably safe.8void nb1() {}9 10// Has no prototype, noreturn.11[[noreturn]]12void aborts();13 14void 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.18}19 20#include <setjmp.h>21 22void 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'}}26  }27}28