[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Frontend / backend-attribute-error-warning.c
blobc3c7803479aac963b02e8bcfffc7e99f858076bf
1 // RUN: %clang_cc1 -verify=expected,enabled -emit-codegen-only %s
2 // RUN: %clang_cc1 -verify -emit-codegen-only -Wno-attribute-warning %s
4 __attribute__((error("oh no foo"))) void foo(void);
6 __attribute__((error("oh no bar"))) void bar(void);
8 int x(void) {
9 return 8 % 2 == 1;
12 __attribute__((warning("oh no quux"))) void quux(void);
14 __attribute__((error("demangle me"))) void __compiletime_assert_455(void);
16 __attribute__((error("one"), error("two"))) // expected-warning {{attribute 'error' is already applied with different arguments}}
17 void // expected-note@-1 {{previous attribute is here}}
18 duplicate_errors(void);
20 __attribute__((warning("one"), warning("two"))) // expected-warning {{attribute 'warning' is already applied with different arguments}}
21 void // expected-note@-1 {{previous attribute is here}}
22 duplicate_warnings(void);
24 void 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}}
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}}