1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/.
29 E2 e2
; // expected-error {{unused class member [loplugin:unusedmember]}}
39 } e4
; // expected-error {{unused class member [loplugin:unusedmember]}}
49 namespace ElaboratedEnum
87 enum E
// expected-error {{unused class member [loplugin:unusedmember]}}
94 void f() { (void)S::E1
; }
97 namespace UnusedDataMember
106 struct __attribute__((warn_unused
)) T
114 int i2
; // expected-error {{unused class member [loplugin:unusedmember]}}
115 int const& i3
; // expected-error {{unused class member [loplugin:unusedmember]}}
118 T t2
; // expected-error {{unused class member [loplugin:unusedmember]}}
119 T
const& t3
; // expected-error {{unused class member [loplugin:unusedmember]}}
147 void f() { (void)alignof(S
const(&)[][10]); }
160 int i
__attribute__((aligned(__alignof__(S1
))));
186 void f() { (void)sizeof(S3
); }
201 struct // anonymous struct extension (widely supported)
207 #if false //TODO: see corresponding TODO in compilerplugins/clang/unusedmember.cxx
208 static constexpr struct
210 int l
; // expected-error {{unused class member [loplugin:unusedmember]}}
215 int m
; // expected-error {{unused class member [loplugin:unusedmember]}}
216 } t
; // expected-error {{unused class member [loplugin:unusedmember]}}
222 #if false //TODO: see corresponding TODO in compilerplugins/clang/unusedmember.cxx
223 (void)S::s
; // avoid "unused variable 's'" (non-loplugin) warning
237 void f() { (void)offsetof(S
, i
); }
240 namespace OffsetofTemplate
244 template <typename
> struct S
248 template <typename T
> void f1() { (void)offsetof(T
, i
); }
250 void f() { f1
<S
<void>>(); }
256 (void)&ElaboratedEnum::f
;
257 (void)&UnusedEnum::f
;
258 (void)&UnusedDataMember::f
;
264 (void)&OffsetofTemplate::f
;
267 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */