1 #include "testheader.h" 2 BareFunctionShouldGetStatic(void)3void BareFunctionShouldGetStatic(void) { } 4 ExternFunctionShouldNotGetStatic(void)5extern void ExternFunctionShouldNotGetStatic(void) { } 6 StaticFunctionShouldNotGetStatic(void)7static void StaticFunctionShouldNotGetStatic(void) { } 8 9 // this should not get static 10 static void StaticFunctionPreDeclShouldNotGetStatic(void); 11 12 // this should get static! StaticFunctionPreDeclShouldNotGetStatic(void)13void StaticFunctionPreDeclShouldNotGetStatic(void) { } 14 15 extern void ExternFunctionPreDeclShouldNotGetStatic(void); 16 ExternFunctionPreDeclShouldNotGetStatic(void)17void ExternFunctionPreDeclShouldNotGetStatic(void) { } 18 19 void BareFunctionPreDeclShouldGetStatic(void); 20 BareFunctionPreDeclShouldGetStatic(void)21void BareFunctionPreDeclShouldGetStatic(void) { } 22 23 // declaration in testheader has "extern" ExternHeaderFunctionShouldNotGetStatic(void)24void ExternHeaderFunctionShouldNotGetStatic(void) { } 25 26 class Foo { 27 public: 28 friend void swap(); 29 }; 30 swap()31void swap() { } 32 33 // clang-format off ExternHeaderBadFormattingShouldNotGetStatic(void)34void ExternHeaderBadFormattingShouldNotGetStatic ( void) 35 { 36 37 } 38 // clang-format on 39 StaticPointerShouldNotGetStatic()40static char *StaticPointerShouldNotGetStatic() 41 { 42 return nullptr; 43 } 44 BarePointerShouldGetStatic()45char *BarePointerShouldGetStatic() 46 { 47 return nullptr; 48 } 49 ExternPointerShouldGetStatic()50extern char *ExternPointerShouldGetStatic() 51 { 52 return nullptr; 53 } 54 PetscExternPointerShouldNotGetStatic()55PETSC_EXTERN char *PetscExternPointerShouldNotGetStatic() 56 { 57 return nullptr; 58 } 59 PetscInternPointerShouldNotGetStatic()60PETSC_INTERN char *PetscInternPointerShouldNotGetStatic() 61 { 62 return nullptr; 63 } 64 65 // clang-format off PetscExternPointerBadFormattingShouldNotGetStatic()66PETSC_EXTERN char * PetscExternPointerBadFormattingShouldNotGetStatic ( ) 67 { 68 return nullptr; 69 } 70 PetscInternBadFormattingPointerShouldNotGetStatic()71PETSC_INTERN char * PetscInternBadFormattingPointerShouldNotGetStatic () 72 { 73 return nullptr; 74 } 75 // clang-format on 76 PetscExternHeaderPointerShouldNotGetStatic()77char *PetscExternHeaderPointerShouldNotGetStatic() 78 { 79 return nullptr; 80 } 81 PetscInternHeaderPointerShouldNotGetStatic()82char *PetscInternHeaderPointerShouldNotGetStatic() 83 { 84 return nullptr; 85 } 86 PetscExternHeaderPointerBadFormattingShouldNotGetStatic()87char *PetscExternHeaderPointerBadFormattingShouldNotGetStatic() 88 { 89 return nullptr; 90 } 91 PetscInternHeaderPointerBadFormattingShouldNotGetStatic()92char *PetscInternHeaderPointerBadFormattingShouldNotGetStatic() 93 { 94 return nullptr; 95 } 96 97 // ironically enough, this will get static silence_warnings(void)98void silence_warnings(void) 99 { 100 (void)StaticFunctionShouldNotGetStatic; 101 (void)StaticFunctionPreDeclShouldNotGetStatic; 102 (void)StaticPointerShouldNotGetStatic; 103 } 104