bump product version to 6.4.0.3
[LibreOffice.git] / compilerplugins / clang / test / indentation.cxx
blobe0e25884eebb7981dcfd30c020772cdfa6231310
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include "config_clang.h"
12 int foo();
13 int foo2(int);
15 #define SOME_MACRO(x) foo2(x)
17 void top1(int x) {
19 foo(); // expected-note {{measured against this one [loplugin:indentation]}}
20 foo(); // expected-error {{statement mis-aligned compared to neighbours [loplugin:indentation]}}
23 foo(); // expected-note {{measured against this one [loplugin:indentation]}}
24 SOME_MACRO(1); // expected-error {{statement mis-aligned compared to neighbours SOME_MACRO [loplugin:indentation]}}
26 // no warning expected
28 foo(); foo();
30 // no warning expected
31 /*xxx*/ foo();
34 // disable this for now, ends up touching some very large switch statements in sw/ and sc/
35 switch (x)
37 case 1: foo(); break; // 1expected-note {{measured against this one [loplugin:indentation]}}
38 case 2: foo(); break; // 1expected-error {{statement mis-aligned compared to neighbours [loplugin:indentation]}}
42 if (x)
43 foo(); // expected-error {{if body should be indented [loplugin:indentation]}}
45 if (x)
47 foo();
50 if (x)
52 else
53 foo(); // expected-error {{else body should be indented [loplugin:indentation]}}
55 if (x)
57 else
59 foo();
62 if (x)
64 else // expected-error {{if and else not aligned [loplugin:indentation]}}
65 foo();
67 if (x)
69 } else
71 foo();
74 #if 0
75 if (x)
76 foo();
77 else
78 #endif
79 foo();
82 void attr() {
83 [[maybe_unused]] int i = foo();
84 foo();
87 #if CLANG_VERSION >= 100000
88 void attr_bad() {
89 [[maybe_unused]] int i = foo(); // expected-note {{measured against this one [loplugin:indentation]}}
90 foo(); // expected-error {{statement mis-aligned compared to neighbours [loplugin:indentation]}}
92 #endif
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */