Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / Preprocessor / pragma_diagnostic_sections.cpp
blob38f20acb107f30669afec69d47a9ce8c3438a04a
1 // RUN: %clang_cc1 -fsyntax-only -Wall -Wunused-macros -Wunused-parameter -Wno-uninitialized -verify %s
3 struct S {
4 void m1() { int b; while (b==b); } // expected-warning {{always evaluates to true}}
6 #pragma clang diagnostic push
7 #pragma clang diagnostic ignored "-Wtautological-compare"
8 void m2() { int b; while (b==b); }
9 #pragma clang diagnostic pop
11 void m3() { int b; while (b==b); } // expected-warning {{always evaluates to true}}
14 //------------------------------------------------------------------------------
16 #pragma clang diagnostic push
17 #pragma clang diagnostic ignored "-Wtautological-compare"
18 template <typename T>
19 struct TS {
20 void m() { T b; while (b==b); }
22 #pragma clang diagnostic pop
24 void f() {
25 TS<int> ts;
26 ts.m();
29 //------------------------------------------------------------------------------
31 #define UNUSED_MACRO1 // expected-warning {{macro is not used}}
33 #pragma clang diagnostic push
34 #pragma clang diagnostic ignored "-Wunused-macros"
35 #define UNUSED_MACRO2
36 #pragma clang diagnostic pop
38 //------------------------------------------------------------------------------
40 #pragma clang diagnostic push
41 #pragma clang diagnostic ignored "-Wreturn-type"
42 int g() { }
43 #pragma clang diagnostic pop
45 //------------------------------------------------------------------------------
47 void ww(
48 #pragma clang diagnostic push
49 #pragma clang diagnostic ignored "-Wunused-parameter"
50 int x,
51 #pragma clang diagnostic pop
52 int y) // expected-warning {{unused}}
56 //------------------------------------------------------------------------------
58 struct S2 {
59 int x, y;
60 S2() :
61 #pragma clang diagnostic push
62 #pragma clang diagnostic ignored "-Wreorder"
63 y(),
64 x()
65 #pragma clang diagnostic pop
69 //------------------------------------------------------------------------------
71 #define MYMACRO \
72 _Pragma("clang diagnostic push") \
73 _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") \
74 _Pragma("clang diagnostic pop")
75 MYMACRO
76 #undef MYMACRO
78 //------------------------------------------------------------------------------