Debian Codegraph @

clang/test/SemaObjC/attr-suppress.m

raw
1 // RUN: %clang_cc1 -fsyntax-only -fblocks %s -verify
2
3 #define SUPPRESS1 __attribute__((suppress))
4 #define SUPPRESS2(...) __attribute__((suppress(__VA_ARGS__)))
5
6 SUPPRESS1 int global = 42;
7
8 SUPPRESS1 void foo() {
9 SUPPRESS1 int *p; // no-warning
10
11 SUPPRESS1 int a = 0; // no-warning
12 SUPPRESS2()
13 int b = 1; // no-warning
14 SUPPRESS2("a")
15 int c = a + b; // no-warning
16 SUPPRESS2("a", "b") { b = c - a; } // no-warning
17
18 SUPPRESS2("a", "b")
19 if (b == 10)
20 a += 4; // no-warning
21 SUPPRESS1 while (1) {} // no-warning
22 SUPPRESS1 switch (a) { // no-warning
23 default:
24 c -= 10;
25 }
26
27 // GNU-style attributes and C++11 attributes apply to different things when
28 // written like this. GNU attribute gets attached to the declaration, while
29 // C++11 attribute ends up on the type.
30 int SUPPRESS2("r") z; // no-warning
31 SUPPRESS2(foo) // no-warning
32 float f;
33 // expected-error@-2 {{expected string literal as argument of 'suppress' attribute}}
34 }
35
36 union SUPPRESS2("type.1") U { // no-warning
37 int i;
38 float f;
39 };
40
41 SUPPRESS1 @interface Test { // no-warning
42 }
43 @property SUPPRESS2("prop") int *prop; // no-warning
44 - (void)bar:(int)x SUPPRESS1; // no-warning
45 @end