Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaCXX / attr-x86-no_caller_saved_registers.cpp
blob55500519c49ef1a11fc54fb0907c41f21c249f0d
1 // RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s
3 struct a {
4 int b __attribute__((no_caller_saved_registers)); // expected-warning {{'no_caller_saved_registers' only applies to function types; type here is 'int'}}
5 static void foo(int *a) __attribute__((no_caller_saved_registers)) {}
6 };
8 struct a test __attribute__((no_caller_saved_registers)); // expected-warning {{'no_caller_saved_registers' only applies to function types; type here is 'struct a'}}
10 __attribute__((no_caller_saved_registers(999))) void bar(int *) {} // expected-error {{'no_caller_saved_registers' attribute takes no arguments}}
12 void __attribute__((no_caller_saved_registers)) foo(int *){}
14 [[gnu::no_caller_saved_registers]] void foo2(int *) {}
16 typedef __attribute__((no_caller_saved_registers)) void (*foo3)(int *);
18 int (*foo4)(double a, __attribute__((no_caller_saved_registers)) float b); // expected-warning {{'no_caller_saved_registers' only applies to function types; type here is 'float'}}
20 typedef void (*foo5)(int *);
22 void foo6(){} // expected-note {{previous declaration is here}}
24 void __attribute__((no_caller_saved_registers)) foo6(); // expected-error {{function declared with 'no_caller_saved_registers' attribute was previously declared without the 'no_caller_saved_registers' attribute}}
26 int main(int argc, char **argv) {
27 void (*fp)(int *) = foo; // expected-error {{cannot initialize a variable of type 'void (*)(int *)' with an lvalue of type 'void (int *) __attribute__((no_caller_saved_registers))'}}
28 a::foo(&argc);
29 foo3 func = foo2;
30 func(&argc);
31 foo5 __attribute__((no_caller_saved_registers)) func2 = foo2;
32 return 0;