From b094258661e0064133679b8b51e981eefda07ec7 Mon Sep 17 00:00:00 2001 From: Dmitri Gribenko Date: Sat, 30 Nov 2019 13:31:16 +0100 Subject: [PATCH] Updated the OCaml/bitwriter.ml test for OCaml 4.06+ Since OCaml 4.02 (released in 2014), strings and bytes are different types, but up until OCaml 4.06, the compiler defaulted to a compatibility mode "unsafe-string". OCaml 4.06 flips the default to "safe-string", breaking the test. This change should be compatible with OCaml 4.02+, but is only truly necessary for OCaml 4.06+. For more information, see: https://caml.inria.fr/pub/docs/manual-ocaml/libref/String.html https://ocaml.org/releases/4.02.html --- llvm/test/Bindings/OCaml/bitwriter.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/test/Bindings/OCaml/bitwriter.ml b/llvm/test/Bindings/OCaml/bitwriter.ml index 28a61fe..17111bd 100644 --- a/llvm/test/Bindings/OCaml/bitwriter.ml +++ b/llvm/test/Bindings/OCaml/bitwriter.ml @@ -17,7 +17,7 @@ let test x = if not x then exit 1 else () let read_file name = let ic = open_in_bin name in let len = in_channel_length ic in - let buf = String.create len in + let buf = Bytes.create len in test ((input ic buf 0 len) = len); @@ -46,4 +46,4 @@ let _ = test (file_buf = temp_bitcode m); test (file_buf = temp_bitcode ~unbuffered:false m); test (file_buf = temp_bitcode ~unbuffered:true m); - test (file_buf = Llvm.MemoryBuffer.as_string (Llvm_bitwriter.write_bitcode_to_memory_buffer m)) + test (file_buf = Bytes.of_string (Llvm.MemoryBuffer.as_string (Llvm_bitwriter.write_bitcode_to_memory_buffer m))) -- 2.7.4