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/.
10 #include <sal/config.h>
14 #include "external.hxx"
16 int n0
; // no warning, see external.hxx
18 // expected-error@+1 {{externally available entity 'n1' is not previously declared in an included file (if it is only used in this translation unit, make it static or put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]}}
20 // expected-note@+1 {{another declaration is here [loplugin:external]}}
23 int const n2
= 0; // no warning, internal linkage
25 constexpr int n3
= 0; // no warning, internal linkage
27 static int n4
; // no warning, internal linkage
29 // expected-note@+1 {{another declaration is here [loplugin:external]}}
31 // expected-error@+1 {{externally available entity 'n5' is not previously declared in an included file (if it is only used in this translation unit, make it static or put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]}}
34 // expected-note@+1 {{another declaration is here [loplugin:external]}}
36 // expected-error@+1 {{externally available entity 'n6' is not previously declared in an included file (if it is only used in this translation unit, make it static or put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]}}
40 // expected-error@+1 {{externally available entity 'n7' is not previously declared in an included file (if it is only used in this translation unit, make it static or put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]}}
46 int u1
; // no warning, internal linkage
48 static int u2
; // no warning, internal linkage
51 int u3
; // no warning, see the comment about DR1113 in compilerplugins/clang/external.cxx
54 int u4
; // no warning, internal linkage
60 int v1
; // no warning, see external.hxx
62 // expected-error@+1 {{externally available entity 'v2' is not previously declared in an included file (if it is only used in this translation unit, make it static or put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]}}
65 static int v3
; // no warning, internal linkage
79 int S::m
= 0; // no warning
81 int f(int a
) // no warning about parameters
83 static int s
= 0; // no warning about local static variables
85 int b
= a
+ s
; // no warning about local variables
89 // expected-error@+1 {{externally available entity 'S1' is not previously declared in an included file (if it is only used in this translation unit, put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]}}
92 friend void f1() {} // no warning for injected function (no place where to mark it `static`)
93 template <typename
> friend void ft1() {} // ...nor for injected function template
94 // expected-error@+1 {{externally available entity 'f2' is not previously declared in an included file (if it is only used in this translation unit, make it static; otherwise, provide a declaration of it in an included file) [loplugin:external]}}
98 // expected-error@+1 {{externally available entity 'S2' is not previously declared in an included file (if it is only used in this translation unit, put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]}}
102 template <typename
> friend void ft1();
103 // expected-note@+1 {{another declaration is here [loplugin:external]}}
110 // expected-note@+1 {{another declaration is here [loplugin:external]}}
114 // expected-note@+1 {{another declaration is here [loplugin:external]}}
122 // expected-note@+1 {{another declaration is here [loplugin:external]}}
125 // expected-error@+1 {{externally available entity 'E' is not previously declared in an included file (if it is only used in this translation unit, put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]}}
132 // expected-note-re@+1 {{a function associating 'N{{(::I1)?}}::E' is declared here [loplugin:external]}}
133 static void g(std::vector
<E
>)
135 // expected-note@+1 {{another declaration is here [loplugin:external]}}
139 // expected-note-re@+1 {{a function associating 'N{{(::I1)?}}::E' is declared here [loplugin:external]}}
143 // expected-note-re@+1 {{a function associating 'N{{(::I1)?}}::E' is declared here [loplugin:external]}}
147 // expected-error@+1 {{externally available entity 'S1' is not previously declared in an included file (if it is only used in this translation unit, put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]}}
151 // No note about associating function; injected friend function not found by ADL:
152 friend void f2(E
const*);
153 // expected-note@+1 {{a function associating 'N::S1' is declared here [loplugin:external]}}
157 // expected-error@+1 {{externally available entity 'S3' is not previously declared in an included file (if it is only used in this translation unit, put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]}}
160 // expected-note@+1 {{another declaration is here [loplugin:external]}}
166 // expected-note-re@+1 {{a function associating 'N{{(::I1)?}}::E' is declared here [loplugin:external]}}
171 // expected-note-re@+1 {{a function associating 'N{{(::I1)?}}::E' is declared here [loplugin:external]}}
179 // expected-note@+1 {{another declaration is here [loplugin:external]}}
180 friend void f(E
const*);
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */