xref: /llvm-project/clang/test/SemaCXX/attr-no-split-stack.cpp (revision b4728c12e8b6e6f4d1906ec3221ee0a3a124e843)
1*b4728c12SPeter Collingbourne // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2*b4728c12SPeter Collingbourne 
3*b4728c12SPeter Collingbourne int i __attribute__((no_split_stack)); // expected-error {{'no_split_stack' attribute only applies to functions}}
4*b4728c12SPeter Collingbourne 
5*b4728c12SPeter Collingbourne void f1() __attribute__((no_split_stack));
6*b4728c12SPeter Collingbourne void f2() __attribute__((no_split_stack(1))); // expected-error {{'no_split_stack' attribute takes no arguments}}
7*b4728c12SPeter Collingbourne 
8*b4728c12SPeter Collingbourne template <typename T>
9*b4728c12SPeter Collingbourne void tf1() __attribute__((no_split_stack));
10*b4728c12SPeter Collingbourne 
11*b4728c12SPeter Collingbourne int f3(int __attribute__((no_split_stack)), int); // expected-error{{'no_split_stack' attribute only applies to functions}}
12*b4728c12SPeter Collingbourne 
13*b4728c12SPeter Collingbourne struct A {
14*b4728c12SPeter Collingbourne   int f __attribute__((no_split_stack));  // expected-error{{'no_split_stack' attribute only applies to functions}}
15*b4728c12SPeter Collingbourne   void mf1() __attribute__((no_split_stack));
16*b4728c12SPeter Collingbourne   static void mf2() __attribute__((no_split_stack));
17*b4728c12SPeter Collingbourne };
18*b4728c12SPeter Collingbourne 
19*b4728c12SPeter Collingbourne int ci [[gnu::no_split_stack]]; // expected-error {{'no_split_stack' attribute only applies to functions}}
20*b4728c12SPeter Collingbourne 
21*b4728c12SPeter Collingbourne [[gnu::no_split_stack]] void cf1();
22*b4728c12SPeter Collingbourne [[gnu::no_split_stack(1)]] void cf2(); // expected-error {{'no_split_stack' attribute takes no arguments}}
23*b4728c12SPeter Collingbourne 
24*b4728c12SPeter Collingbourne template <typename T>
25*b4728c12SPeter Collingbourne [[gnu::no_split_stack]]
26*b4728c12SPeter Collingbourne void ctf1();
27*b4728c12SPeter Collingbourne 
28*b4728c12SPeter Collingbourne int cf3(int c[[gnu::no_split_stack]], int); // expected-error{{'no_split_stack' attribute only applies to functions}}
29*b4728c12SPeter Collingbourne 
30*b4728c12SPeter Collingbourne struct CA {
31*b4728c12SPeter Collingbourne   int f [[gnu::no_split_stack]];  // expected-error{{'no_split_stack' attribute only applies to functions}}
32*b4728c12SPeter Collingbourne   [[gnu::no_split_stack]] void mf1();
33*b4728c12SPeter Collingbourne   [[gnu::no_split_stack]] static void mf2();
34*b4728c12SPeter Collingbourne };
35