brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 2880514 Raw
60 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -Wmissing-prototypes -std=c++11 %s2// RUN: %clang_cc1 -fsyntax-only -Wmissing-prototypes -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s3 4void 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 8namespace 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 13namespace {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 22struct A {23  // Don't warn about member functions.24  void f() { }25};26 27// Don't warn about inline functions.28inline void g() { }29 30// Don't warn about function templates.31template<typename> void h() { }32 33// Don't warn when instantiating function templates.34template void h<int>();35 36// PR9519: don't warn about friend functions.37class I {38  friend void I_friend() {}39};40 41// Don't warn on explicitly deleted functions.42void j() = delete;43 44extern 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 48namespace {49struct anon { };50}51 52// No warning because this has internal linkage despite not being declared53// explicitly 'static', owing to the internal linkage parameter.54void l(anon) {55}56 57void *operator new(decltype(sizeof(3)) size, const anon &) throw() {58  return nullptr;59}60