1 // RUN: %clang_cc1 -fsyntax-only -verify -Wmissing-prototypes -std=c++11 %s 2 // RUN: %clang_cc1 -fsyntax-only -Wmissing-prototypes -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s 3 4 void f() { } // expected-warning {{no previous prototype for function 'f'}} 5 // expected-note@-1{{declare 'static' if the function is not intended to be used outside of this translation unit}} 6 // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:1-[[@LINE-2]]:1}:"static " 7 8 namespace NS { 9 void f() { } // expected-warning {{no previous prototype for function 'f'}} 10 // expected-note@-1{{declare 'static' if the function is not intended to be used outside of this translation unit}} 11 } 12 13 namespace { 14 // Don't warn about functions in anonymous namespaces. 15 void f() { } 16 // Even if they're in nested namespaces within an anonymous namespace. 17 namespace NS { 18 void f() { } 19 } 20 } 21 22 struct A { 23 // Don't warn about member functions. 24 void f() { } 25 }; 26 27 // Don't warn about inline functions. 28 inline void g() { } 29 30 // Don't warn about function templates. 31 template<typename> void h() { } 32 33 // Don't warn when instantiating function templates. 34 template void h<int>(); 35 36 // PR9519: don't warn about friend functions. 37 class I { 38 friend void I_friend() {} 39 }; 40 41 // Don't warn on explicitly deleted functions. 42 void j() = delete; 43 44 extern void k() {} // expected-warning {{no previous prototype for function 'k'}} 45 // expected-note@-1{{declare 'static' if the function is not intended to be used outside of this translation unit}} 46 // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-2]]:{{.*}}-[[@LINE-2]]:{{.*}}}:"{{.*}}" 47 48 namespace { 49 struct anon { }; 50 } 51 52 // No warning because this has internal linkage despite not being declared 53 // explicitly 'static', owing to the internal linkage parameter. 54 void l(anon) { 55 } 56 57 void *operator new(decltype(sizeof(3)) size, const anon &) throw() { 58 return nullptr; 59 } 60