brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · c12da09 Raw
46 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -fblocks %s -verify2 3#define SUPPRESS1 __attribute__((suppress))4#define SUPPRESS2(...) __attribute__((suppress(__VA_ARGS__)))5 6SUPPRESS1 int global = 42;7 8SUPPRESS1 void foo() {9  SUPPRESS1 int *p; // no-warning10 11  SUPPRESS1 int a = 0; // no-warning12  SUPPRESS2()13  int b = 1; // no-warning14  SUPPRESS2("a")15  int c = a + b;                     // no-warning16  SUPPRESS2("a", "b") { b = c - a; } // no-warning17 18  SUPPRESS2("a", "b")19  if (b == 10)20    a += 4;              // no-warning21  SUPPRESS1 while (1) {} // no-warning22  SUPPRESS1 switch (a) { // no-warning23  default:24    c -= 10;25  }26 27  // GNU-style attributes and C++11 attributes apply to different things when28  // written like this.  GNU  attribute gets attached to the declaration, while29  // C++11 attribute ends up on the type.30  int SUPPRESS2("r") z; // no-warning31  SUPPRESS2(foo) // no-warning32  float f;33  // expected-error@-2 {{expected string literal as argument of 'suppress' attribute}}34}35 36union SUPPRESS2("type.1") U { // no-warning37  int i;38  float f;39};40 41SUPPRESS1 @interface Test { // no-warning42}43@property SUPPRESS2("prop") int *prop; // no-warning44- (void)bar:(int)x SUPPRESS1; // no-warning45@end46