Recommit r246175 - Add Kaleidoscope regression tests, with a fix to make sure
[oota-llvm.git] / examples / Kaleidoscope / Chapter8 / toy.cpp
index 7338c6ebc50bd15b86b686827031e96a64bb23b5..5f97a157336b363622edfbd8ea875859610edee5 100644 (file)
@@ -1383,14 +1383,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;
 }