[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / test / Preprocessor / pragma_diagnostic_sections.cpp
blobb680fae5b993ff498b8887540c0e97b98414bfd1
1 // RUN: %clang_cc1 -fsyntax-only -Wall -Wunused-macros -Wunused-parameter -Wno-uninitialized -verify %s
3 // rdar://8365684
4 struct S {
5 void m1() { int b; while (b==b); } // expected-warning {{always evaluates to true}}
7 #pragma clang diagnostic push
8 #pragma clang diagnostic ignored "-Wtautological-compare"
9 void m2() { int b; while (b==b); }
10 #pragma clang diagnostic pop
12 void m3() { int b; while (b==b); } // expected-warning {{always evaluates to true}}
15 //------------------------------------------------------------------------------
17 #pragma clang diagnostic push
18 #pragma clang diagnostic ignored "-Wtautological-compare"
19 template <typename T>
20 struct TS {
21 void m() { T b; while (b==b); }
23 #pragma clang diagnostic pop
25 void f() {
26 TS<int> ts;
27 ts.m();
30 //------------------------------------------------------------------------------
32 #define UNUSED_MACRO1 // expected-warning {{macro is not used}}
34 #pragma clang diagnostic push
35 #pragma clang diagnostic ignored "-Wunused-macros"
36 #define UNUSED_MACRO2
37 #pragma clang diagnostic pop
39 //------------------------------------------------------------------------------
41 #pragma clang diagnostic push
42 #pragma clang diagnostic ignored "-Wreturn-type"
43 int g() { }
44 #pragma clang diagnostic pop
46 //------------------------------------------------------------------------------
48 void ww(
49 #pragma clang diagnostic push
50 #pragma clang diagnostic ignored "-Wunused-parameter"
51 int x,
52 #pragma clang diagnostic pop
53 int y) // expected-warning {{unused}}
57 //------------------------------------------------------------------------------
59 struct S2 {
60 int x, y;
61 S2() :
62 #pragma clang diagnostic push
63 #pragma clang diagnostic ignored "-Wreorder"
64 y(),
65 x()
66 #pragma clang diagnostic pop
70 //------------------------------------------------------------------------------
72 // rdar://8790245
73 #define MYMACRO \
74 _Pragma("clang diagnostic push") \
75 _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") \
76 _Pragma("clang diagnostic pop")
77 MYMACRO
78 #undef MYMACRO
80 //------------------------------------------------------------------------------