Recommit r246175 - Add Kaleidoscope regression tests, with a fix to make sure
[oota-llvm.git] / examples / Kaleidoscope / Chapter5 / toy.cpp
index 83af1776b20ebcf80307eee32e3d50ef8b30de4a..4658edcd4cec16a5b8d6e5cb12c569bd53d5a593 100644 (file)
@@ -905,14 +905,14 @@ static void MainLoop() {
 //===----------------------------------------------------------------------===//
 
 /// putchard - putchar that takes a double and returns 0.
-extern "C" double putchard(double X) {
-  putchar((char)X);
+__attribute__((used)) extern "C" double putchard(double X) {
+  fputc((char)X, stderr);
   return 0;
 }
 
 /// printd - printf that takes a double prints it as "%f\n", returning 0.
-extern "C" double printd(double X) {
-  printf("%f\n", X);
+__attribute__((used)) extern "C" double printd(double X) {
+  fprintf(stderr, "%f\n", X);
   return 0;
 }