1 // RUN: %clang_cc1 %s -verify -fsyntax-only -Werror=implicit-function-declaration 2 3 /// -Werror-implicit-function-declaration is a deprecated alias used by many projects. 4 // RUN: %clang_cc1 %s -verify -fsyntax-only -Werror-implicit-function-declaration 5 6 typedef int int32_t; 7 typedef unsigned char Boolean; 8 9 extern int printf(__const char *__restrict __format, ...); // expected-note{{'printf' declared here}} 10 11 void func(void) { 12 int32_t *vector[16]; 13 const char compDesc[16 + 1]; 14 int32_t compCount = 0; 15 if (_CFCalendarDecomposeAbsoluteTimeV(compDesc, vector, compCount)) { // expected-error {{implicit declaration of function '_CFCalendarDecomposeAbsoluteTimeV' is invalid in C99}} expected-note {{previous implicit declaration}} 16 } 17 18 printg("Hello, World!\n"); // expected-error{{implicit declaration of function 'printg' is invalid in C99}} \ 19 // expected-note{{did you mean 'printf'?}} 20 21 __builtin_is_les(1, 3); // expected-error{{use of unknown builtin '__builtin_is_les'}} 22 } 23 Boolean _CFCalendarDecomposeAbsoluteTimeV(const char *componentDesc, int32_t **vector, int32_t count) { // expected-error {{conflicting types}} 24 return 0; 25 } 26 27 28 // Test the typo-correction callback in Sema::ImplicitlyDefineFunction 29 extern int sformatf(char *str, __const char *__restrict __format, ...); // expected-note{{'sformatf' declared here}} 30 void test_implicit(void) { 31 int formats = 0; 32 formatd("Hello, World!\n"); // expected-error{{implicit declaration of function 'formatd' is invalid in C99}} \ 33 // expected-note{{did you mean 'sformatf'?}} 34 } 35