33 lines · c
1// RUN: %clang_cc1 -O2 -verify -emit-codegen-only %s2 3__attribute__((error("oh no foo"))) void foo(void);4 5__attribute__((error("oh no bar"))) void bar(void);6 7int x(void) {8 return 8 % 2 == 1;9}10void baz(void) {11 foo(); // expected-error {{call to 'foo' declared with 'error' attribute: oh no foo}}12 if (x())13 bar();14}15 16// FIXME: indirect call detection not yet supported.17void (*quux)(void);18 19void indirect(void) {20 quux = foo;21 quux();22}23 24// https://github.com/llvm/llvm-project/issues/14652025 26[[gnu::error("error please")]]27void cleaner_function(char*);28 29void asdf(void){30 [[gnu::cleanup(cleaner_function)]] // expected-error {{call to 'cleaner_function' declared with 'error' attribute: error please}}31 char x; 32}33