================
@@ -20,6 +20,9 @@ const char* c_null_str = 0; c_null_str
"Hello, world"
// CHECK-NEXT: ({{(const )?}}char[13]) "Hello, world"
+printf("Hello World\n");
+// expected-error {{call to undeclared library function 'printf' with type
'int (const char *, ...)' }}
+
int x = 42; x
// CHECK-NEXT: (int) 42
----------------
anutosh491 wrote:
Added a test here (can possibly open a new file if needed) but seems like an
appropriate place.
On master
```
anutosh491@vv-nuc:/build/anutosh491/llvm-project/build/bin$ ./clang-repl
--Xcc=-x --Xcc=c
clang-repl> printf("Hello World\n");
In file included from <<< inputs >>>:1:
input_line_1:1:1: error: call to undeclared library function 'printf' with type
'int (const char *, ...)'; ISO C99 and later do not support implicit function
declarations [-Wimplicit-function-declaration]
1 | printf("Hello World\n");
| ^
input_line_1:1:1: note: include the header <stdio.h> or explicitly provide a
declaration for 'printf'
error: Parsing failed.
clang-repl> int x = 42; x
Hello World
(int) 42
```
On branch
```
anutosh491@vv-nuc:/build/anutosh491/llvm-project/build/bin$ ./clang-repl
--Xcc=-x --Xcc=c
clang-repl> printf("10\n");
In file included from <<< inputs >>>:1:
input_line_1:1:1: error: call to undeclared library function 'printf' with type
'int (const char *, ...)'; ISO C99 and later do not support implicit function
declarations [-Wimplicit-function-declaration]
1 | printf("10\n");
| ^
input_line_1:1:1: note: include the header <stdio.h> or explicitly provide a
declaration for 'printf'
error: Parsing failed.
clang-repl> int x = 42; x
(int) 42
```
https://github.com/llvm/llvm-project/pull/169989
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits