remove dead makefile flags.
[oota-llvm.git] / bindings / ocaml / bitreader / bitreader_ocaml.c
index 87477f6312d24b9e4f00c825b27f968af9f74a58..0fd484f123435a4c4eb112497e326662aa3e1e9a 100644 (file)
@@ -2,8 +2,8 @@
 |*                                                                            *|
 |*                     The LLVM Compiler Infrastructure                       *|
 |*                                                                            *|
-|* This file was developed by Gordon Henriksen and is distributed under the   *|
-|* University of Illinois Open Source License. See LICENSE.TXT for details.   *|
+|* This file is distributed under the University of Illinois Open Source      *|
+|* License. See LICENSE.TXT for details.                                      *|
 |*                                                                            *|
 |*===----------------------------------------------------------------------===*|
 |*                                                                            *|
@@ -14,9 +14,8 @@
 
 #include "llvm-c/BitReader.h"
 #include "caml/alloc.h"
-#include "caml/mlvalues.h"
+#include "caml/fail.h"
 #include "caml/memory.h"
-#include <stdio.h>
 
 
 /* Can't use the recommended caml_named_value mechanism for backwards
@@ -29,7 +28,19 @@ CAMLprim value llvm_register_bitreader_exns(value Error) {
   return Val_unit;
 }
 
-void llvm_raise(value Prototype, char *Message);
+static void llvm_raise(value Prototype, char *Message) {
+  CAMLparam1(Prototype);
+  CAMLlocal1(CamlMessage);
+  
+  CamlMessage = copy_string(Message);
+  LLVMDisposeMessage(Message);
+  
+  raise_with_arg(Prototype, CamlMessage);
+  abort(); /* NOTREACHED */
+#ifdef CAMLnoreturn
+  CAMLnoreturn; /* Silences warnings, but is missing in some versions. */
+#endif
+}
 
 
 /*===-- Modules -----------------------------------------------------------===*/