34 lines · c
1// RUN: %clang_cc1 -verify=expected,enabled -emit-codegen-only %s2// RUN: %clang_cc1 -verify -emit-codegen-only -Wno-attribute-warning %s3 4__attribute__((error("oh no foo"))) void foo(void);5 6__attribute__((error("oh no bar"))) void bar(void);7 8int x(void) {9 return 8 % 2 == 1;10}11 12__attribute__((warning("oh no quux"))) void quux(void);13 14__attribute__((error("demangle me"))) void __compiletime_assert_455(void);15 16__attribute__((error("one"), error("two"))) // expected-warning {{attribute 'error' is already applied with different arguments}}17void // expected-note@-1 {{previous attribute is here}}18duplicate_errors(void);19 20__attribute__((warning("one"), warning("two"))) // expected-warning {{attribute 'warning' is already applied with different arguments}}21void // expected-note@-1 {{previous attribute is here}}22duplicate_warnings(void);23 24void baz(void) {25 foo(); // expected-error {{call to 'foo' declared with 'error' attribute: oh no foo}}26 if (x())27 bar(); // expected-error {{call to 'bar' declared with 'error' attribute: oh no bar}}28 29 quux(); // enabled-warning {{call to 'quux' declared with 'warning' attribute: oh no quux}}30 __compiletime_assert_455(); // expected-error {{call to '__compiletime_assert_455' declared with 'error' attribute: demangle me}}31 duplicate_errors(); // expected-error {{call to 'duplicate_errors' declared with 'error' attribute: two}}32 duplicate_warnings(); // enabled-warning {{call to 'duplicate_warnings' declared with 'warning' attribute: two}}33}34