blob: ffab9a6f913c41e298e9316556122a226396e0bf [file] [log] [blame]
Hans Wennborge3ca33a2011-12-08 15:56:07 +00001// RUN: %clang_cc1 %s -verify -fsyntax-only -Werror
Steve Naroffe2ef8152008-04-04 14:32:09 +00002
3typedef int int32_t;
4typedef unsigned char Boolean;
5
Hans Wennborg122de3e2011-12-06 09:46:12 +00006extern int printf(__const char *__restrict __format, ...); // expected-note{{'printf' declared here}}
7
Steve Naroffe2ef8152008-04-04 14:32:09 +00008void func() {
9 int32_t *vector[16];
10 const char compDesc[16 + 1];
11 int32_t compCount = 0;
Chris Lattnere0303582010-01-09 20:43:19 +000012 if (_CFCalendarDecomposeAbsoluteTimeV(compDesc, vector, compCount)) { // expected-note {{previous implicit declaration is here}} \
Hans Wennborge3ca33a2011-12-08 15:56:07 +000013 expected-error {{implicit declaration of function '_CFCalendarDecomposeAbsoluteTimeV' is invalid in C99}}
Steve Naroffe2ef8152008-04-04 14:32:09 +000014 }
Hans Wennborg122de3e2011-12-06 09:46:12 +000015
Hans Wennborge3ca33a2011-12-08 15:56:07 +000016 printg("Hello, World!\n"); // expected-error{{implicit declaration of function 'printg' is invalid in C99}} \
Hans Wennborg122de3e2011-12-06 09:46:12 +000017 // expected-note{{did you mean 'printf'?}}
18
Kaelyn Uhrain43e875d2012-01-18 21:41:41 +000019 __builtin_is_les(1, 3); // expected-error{{use of unknown builtin '__builtin_is_les'}}
Steve Naroffe2ef8152008-04-04 14:32:09 +000020}
21Boolean _CFCalendarDecomposeAbsoluteTimeV(const char *componentDesc, int32_t **vector, int32_t count) { // expected-error{{conflicting types for '_CFCalendarDecomposeAbsoluteTimeV'}}
22 return 0;
23}
Kaelyn Uhrain43e875d2012-01-18 21:41:41 +000024
25
26// Test the typo-correction callback in Sema::ImplicitlyDefineFunction
27extern int sformatf(char *str, __const char *__restrict __format, ...); // expected-note{{'sformatf' declared here}}
28void test_implicit() {
29 int formats = 0;
30 formatd("Hello, World!\n"); // expected-error{{implicit declaration of function 'formatd' is invalid in C99}} \
31 // expected-note{{did you mean 'sformatf'?}}
32}