blob: d2ba70b0325085d2c45cc4c3c5c7d6e60df321a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* { dg-do compile } */
/* { dg-options "-W -Wall" } */
void bar (void);
void
foo (int x)
{
__attribute__((musttail)); /* { dg-warning "empty declaration" "" { target c } } */
/* { dg-warning "attributes at the beginning of statement are ignored" "" { target c++ } .-1 } */
if (x == 1)
__attribute__((musttail (1))) return bar (); /* { dg-error "'musttail' attribute does not take any arguments" } */
if (x == 2)
__attribute__((musttail (1, "", 3))) return bar (); /* { dg-error "'musttail' attribute does not take any arguments" } */
if (x == 3)
[[gnu::musttail (1)]] return bar (); /* { dg-error "'musttail' attribute does not take any arguments" } */
/* { dg-error "expected" "" { target c } .-1 } */
if (x == 4)
[[gnu::musttail (1, "", 3)]] return bar (); /* { dg-error "'musttail' attribute does not take any arguments" } */
/* { dg-error "expected" "" { target c } .-1 } */
if (x == 3)
[[clang::musttail (1)]] return bar (); /* { dg-error "'musttail' attribute does not take any arguments" } */
/* { dg-error "expected" "" { target c } .-1 } */
if (x == 4)
[[clang::musttail (1, "", 3)]] return bar (); /* { dg-error "'musttail' attribute does not take any arguments" } */
/* { dg-error "expected" "" { target c } .-1 } */
if (x == 5)
__attribute__((fallthrough, musttail)) return bar (); /* { dg-warning "attribute 'musttail' mixed with other attributes on 'return' statement" "" { target c } } */
/* { dg-warning "attributes at the beginning of statement are ignored" "" { target c++ } .-1 } */
if (x == 6)
[[fallthrough]] [[gnu::musttail]] return bar (); /* { dg-warning "'fallthrough' attribute ignored" "" { target c } } */
/* { dg-warning "attributes at the beginning of statement are ignored" "" { target c++ } .-1 } */
if (x == 7)
[[clang::musttail, fallthrough]] return bar (); /* { dg-warning "'fallthrough' attribute ignored" "" { target c } } */
/* { dg-warning "attributes at the beginning of statement are ignored" "" { target c++ } .-1 } */
if (x == 8)
__attribute__((musttail, musttail)) return bar ();
if (x == 9)
[[gnu::musttail, gnu::musttail]] return bar ();
if (x == 10)
[[clang::musttail]] [[clang::musttail]] return bar ();
if (x == 11)
[[clang::musttail]] [[gnu::musttail]] return bar ();
}
|