]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Parser/attributes.c
Updaet clang to 92395.
[FreeBSD/FreeBSD.git] / test / Parser / attributes.c
1 // RUN: %clang_cc1 -fsyntax-only -verify %s -pedantic -std=c99
2
3 int __attribute__(()) x;
4
5 __inline void __attribute__((__always_inline__, __nodebug__))
6 foo(void) {
7 }
8
9
10 __attribute__(()) y;   // expected-warning {{defaults to 'int'}}
11
12 // PR2796
13 int (__attribute__(()) *z)(long y);
14
15
16 void f1(__attribute__(()) int x);
17
18 int f2(y, __attribute__(()) x);     // expected-error {{expected identifier}}
19
20 // This is parsed as a normal argument list (with two args that are implicit
21 // int) because the __attribute__ is a declspec.
22 void f3(__attribute__(()) x,  // expected-warning {{defaults to 'int'}}
23         y);               // expected-warning {{defaults to 'int'}}
24
25 void f4(__attribute__(()));   // expected-error {{expected parameter declarator}}
26
27
28 // This is ok, the __attribute__ applies to the pointer.
29 int baz(int (__attribute__(()) *x)(long y));
30
31 void g1(void (*f1)(__attribute__(()) int x));
32 void g2(int (*f2)(y, __attribute__(()) x));    // expected-error {{expected identifier}}
33 void g3(void (*f3)(__attribute__(()) x, int y));  // expected-warning {{defaults to 'int'}}
34 void g4(void (*f4)(__attribute__(())));  // expected-error {{expected parameter declarator}}
35
36
37 void (*h1)(void (*f1)(__attribute__(()) int x));
38 void (*h2)(int (*f2)(y, __attribute__(()) x));    // expected-error {{expected identifier}}
39
40 void (*h3)(void (*f3)(__attribute__(()) x));   // expected-warning {{defaults to 'int'}}
41 void (*h4)(void (*f4)(__attribute__(())));  // expected-error {{expected parameter declarator}}
42
43
44
45 // rdar://6131260
46 int foo42(void) {
47   int x, __attribute__((unused)) y, z;
48   return 0;
49 }
50
51 // rdar://6096491
52 void __attribute__((noreturn)) d0(void), __attribute__((noreturn)) d1(void);
53
54 void d2(void) __attribute__((noreturn)), d3(void) __attribute__((noreturn));