From 68ee1322b455f987e3b22531091b86b5273e120e Mon Sep 17 00:00:00 2001 From: Zachary Kincaid Date: Tue, 25 Aug 2015 19:19:45 -0400 Subject: [PATCH 01/11] Add findlib to required libs --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 80d08cc19..e7c3d8504 100644 --- a/Makefile.in +++ b/Makefile.in @@ -106,7 +106,7 @@ ocamlbuild: META: @rm -f $@ @printf "description = \"C Intermediate Language\"\n" >>$@ - @printf "requires = \"unix str num dynlink\"\n" >>$@ + @printf "requires = \"unix str num dynlink findlib\"\n" >>$@ @printf "version = \"$(CIL_VERSION)\"\n\n" >>$@ @printf "archive(byte) = \"cil.cma\"\n" >>$@ @printf "archive(native) = \"cil.cmxa\"\n\n" >>$@ From ce9f7edb28e031f48963dc8aa30c63dd8a8fb886 Mon Sep 17 00:00:00 2001 From: Zak Kincaid Date: Wed, 23 May 2018 20:29:10 -0400 Subject: [PATCH 02/11] Replaced deprecated mutable String operations with Bytes equivalents --- src/cil.ml | 10 +++++----- src/formatlex.mll | 6 +++--- src/ocamlutil/errormsg.ml | 14 +++++++------- src/ocamlutil/pretty.ml | 21 +++++++++++++++------ 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/cil.ml b/src/cil.ml index 63da92793..b4b313b22 100755 --- a/src/cil.ml +++ b/src/cil.ml @@ -5080,19 +5080,19 @@ let loadBinaryFile (filename : string) : file = (* Take the name of a file and make a valid symbol name out of it. There are * a few characters that are not valid in symbols *) let makeValidSymbolName (s: string) = - let s = String.copy s in (* So that we can update in place *) - let l = String.length s in + let s = Bytes.of_string s in (* So that we can update in place *) + let l = Bytes.length s in for i = 0 to l - 1 do - let c = String.get s i in + let c = Bytes.get s i in let isinvalid = match c with '-' | '.' -> true | _ -> false in if isinvalid then - String.set s i '_'; + Bytes.set s i '_'; done; - s + Bytes.to_string s let rec addOffset (toadd: offset) (off: offset) : offset = match off with diff --git a/src/formatlex.mll b/src/formatlex.mll index 584a060d5..9fc32fae4 100644 --- a/src/formatlex.mll +++ b/src/formatlex.mll @@ -145,11 +145,11 @@ let scan_oct_escape str = * We convert L"Hi" to "H\000i\000" *) let wbtowc wstr = let len = String.length wstr in - let dest = String.make (len * 2) '\000' in + let dest = Bytes.make (len * 2) '\000' in for i = 0 to len-1 do - dest.[i*2] <- wstr.[i] ; + Bytes.set dest (i*2) wstr.[i] ; done ; - dest + Bytes.to_string dest (* This function converst the "Hi" in L"Hi" to { L'H', L'i', L'\0' } *) let wstr_to_warray wstr = diff --git a/src/ocamlutil/errormsg.ml b/src/ocamlutil/errormsg.ml index 2ffee51cf..7aa673a0f 100644 --- a/src/ocamlutil/errormsg.ml +++ b/src/ocamlutil/errormsg.ml @@ -209,18 +209,18 @@ let rem_quotes str = String.sub str 1 ((String.length str) - 2) let cleanFileName str = let str1 = if str <> "" && String.get str 0 = '"' (* '"' ( *) - then rem_quotes str else str in - let l = String.length str1 in + then Bytes.of_string (rem_quotes str) else Bytes.of_string str in + let l = Bytes.length str1 in let rec loop (copyto: int) (i: int) = if i >= l then - String.sub str1 0 copyto + Bytes.sub_string str1 0 copyto else - let c = String.get str1 i in + let c = Bytes.get str1 i in if c <> '\\' then begin - String.set str1 copyto c; loop (copyto + 1) (i + 1) + Bytes.set str1 copyto c; loop (copyto + 1) (i + 1) end else begin - String.set str1 copyto '/'; - if i < l - 2 && String.get str1 (i + 1) = '\\' then + Bytes.set str1 copyto '/'; + if i < l - 2 && Bytes.get str1 (i + 1) = '\\' then loop (copyto + 1) (i + 2) else loop (copyto + 1) (i + 1) diff --git a/src/ocamlutil/pretty.ml b/src/ocamlutil/pretty.ml index 41180974f..a5c1c18b2 100644 --- a/src/ocamlutil/pretty.ml +++ b/src/ocamlutil/pretty.ml @@ -725,8 +725,11 @@ let gprintf (finish : doc -> 'b) invalid_arg ("dprintf: unimplemented format " ^ (String.sub format i (j-i+1))); let j' = succ j in (* eat the d,i,x etc. *) - let format_spec = "% " in - String.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *) + let format_spec = + String.init 2 (function + | 0 -> '%' + | _ -> fget j') (* format_spec = "%x", etc. *) + in Obj.magic(fun n -> collect (dctext1 acc (Int64.format format_spec n)) @@ -735,8 +738,11 @@ let gprintf (finish : doc -> 'b) if j != i + 1 then invalid_arg ("dprintf: unimplemented format " ^ (String.sub format i (j-i+1))); let j' = succ j in (* eat the d,i,x etc. *) - let format_spec = "% " in - String.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *) + let format_spec = + String.init 2 (function + | 0 -> '%' + | _ -> fget j') (* format_spec = "%x", etc. *) + in Obj.magic(fun n -> collect (dctext1 acc (Int32.format format_spec n)) @@ -745,8 +751,11 @@ let gprintf (finish : doc -> 'b) if j != i + 1 then invalid_arg ("dprintf: unimplemented format " ^ (String.sub format i (j-i+1))); let j' = succ j in (* eat the d,i,x etc. *) - let format_spec = "% " in - String.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *) + let format_spec = + String.init 2 (function + | 0 -> '%' + | _ -> fget j') (* format_spec = "%x", etc. *) + in Obj.magic(fun n -> collect (dctext1 acc (Nativeint.format format_spec n)) From aefdd57326f502775b8f3984e74d6c1e1adce008 Mon Sep 17 00:00:00 2001 From: Zachary Kincaid Date: Sat, 21 Mar 2020 10:36:15 -0400 Subject: [PATCH 03/11] Remove unnecessary mkdirs --- Makefile.in | 2 -- 1 file changed, 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index e273533dd..0b88e3e53 100644 --- a/Makefile.in +++ b/Makefile.in @@ -344,7 +344,6 @@ else endif install-findlib: META $(CILLIB_FILES) $(CILLIB_TARGETS) uninstall-findlib - mkdir -p $(OCAMLFIND_INSTALLDIR) OCAMLFIND_DESTDIR=$(OCAMLFIND_INSTALLDIR) \ $(OCAMLFIND) install cil META $(CILLIB_TARGETS) `cat $(CILLIB_FILES)` @@ -353,7 +352,6 @@ uninstall-findlib: .PHONY: install-data uninstall-data install-data: - mkdir -p $(DESTDIR)$(datadir) ifneq ($(CYGPATH),) printf $(shell $(CYGPATH) -ma "$(OCAMLFIND_DESTDIR)") > ocamlpath else From fd3999db1773fe29c23661fcbed36d73c54511d7 Mon Sep 17 00:00:00 2001 From: Zachary Kincaid Date: Wed, 2 Nov 2022 14:16:00 -0400 Subject: [PATCH 04/11] Switch to zarith --- _tags | 2 +- src/cilint.ml | 5 +++-- src/cilint.mli | 7 ++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/_tags b/_tags index 59986cee7..44bc70608 100644 --- a/_tags +++ b/_tags @@ -1,5 +1,5 @@ # Traverse only subdirectories containing source code -true: -traverse +true: -traverse, package(zarith) : include # build every cmo in debug mode (for cil.cma) <**/*.cmo>: debug diff --git a/src/cilint.ml b/src/cilint.ml index ae17e4d97..5769434c6 100644 --- a/src/cilint.ml +++ b/src/cilint.ml @@ -21,8 +21,9 @@ bitwise operations on big_ints, and bug-fixed versions of int64_of_big_int and big_int_of_int64. *) -open Big_int - +type big_int = Z.t +open Big_int_Z + type cilint = Small of int | Big of big_int type truncation = NoTruncation | ValueTruncation | BitTruncation diff --git a/src/cilint.mli b/src/cilint.mli index f6d6983e4..f34008adc 100644 --- a/src/cilint.mli +++ b/src/cilint.mli @@ -3,7 +3,8 @@ (** The cilint type is public and not just big_int to make life with ocamldebug easier. Please do not rely on this representation, use the ..._of_cilint functions to get at a cilint's value. *) -type cilint = Small of int | Big of Big_int.big_int +type big_int = Z.t +type cilint = Small of int | Big of big_int (** 0 as a cilint *) val zero_cilint : cilint @@ -85,7 +86,7 @@ val int_of_cilint : cilint -> int val int64_of_cilint : cilint -> int64 (** Return the cilint's value as a big_int *) -val big_int_of_cilint : cilint -> Big_int.big_int +val big_int_of_cilint : cilint -> big_int (** Return the cilint's value as a string *) val string_of_cilint : cilint -> string @@ -97,7 +98,7 @@ val cilint_of_int : int -> cilint val cilint_of_int64 : int64 -> cilint (** Make a cilint from a big_int *) -val cilint_of_big_int : Big_int.big_int -> cilint +val cilint_of_big_int : big_int -> cilint (** Make a cilint from a string *) val cilint_of_string : string -> cilint From dc48f78c78df1876e3c47c7a6c21a3dca879e908 Mon Sep 17 00:00:00 2001 From: Nicolas Koh Date: Wed, 8 Mar 2023 18:05:22 -0500 Subject: [PATCH 05/11] Add share --- share/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 share/.gitkeep diff --git a/share/.gitkeep b/share/.gitkeep new file mode 100644 index 000000000..e69de29bb From afe97e36b444903cf50c69f52b8e23071dd462cb Mon Sep 17 00:00:00 2001 From: Nicolas Koh Date: Wed, 8 Mar 2023 20:44:11 -0500 Subject: [PATCH 06/11] Add description --- opam | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/opam b/opam index b203083e4..28768e8cc 100644 --- a/opam +++ b/opam @@ -1,18 +1,15 @@ -opam-version: "1.2" +opam-version: "2.0" authors: ["gabriel@kerneis.info"] maintainer: "gabriel@kerneis.info" homepage: "https://cil-project.github.io/cil/" bug-reports: "https://github.com/cil-project/cil/issues/" +description: "Cil" dev-repo: "git+https://github.com/cil-project/cil/" build: [ ["env" "FORCE_PERL_PREFIX=1" "./configure" "--prefix" prefix] [make] -] -build-test: [ - ["env" "VERBOSE=1" make "test"] -] -build-doc: [ - [make "doc"] + ["env" "VERBOSE=1" make "test"] {with-test} + [make "doc"] {with-doc} ] install: [ make "install" @@ -22,8 +19,9 @@ remove: [ [make "uninstall"] ] depends: [ + "ocaml" "ocamlfind" "ocamlbuild" {build} - "hevea" {build & doc} - "hevea" {build & test} + "hevea" {build & with-doc} + "hevea" {build & with-test} ] From 1a369a1514d645018f02057b698cd1730a5914b2 Mon Sep 17 00:00:00 2001 From: Nicolas Koh Date: Thu, 9 Mar 2023 12:50:18 -0500 Subject: [PATCH 07/11] Makefile.in --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 0b88e3e53..d914ff650 100644 --- a/Makefile.in +++ b/Makefile.in @@ -106,7 +106,7 @@ ocamlbuild: META: @rm -f $@ @printf "description = \"C Intermediate Language\"\n" >>$@ - @printf "requires = \"unix str num dynlink findlib\"\n" >>$@ + @printf "requires = \"unix str dynlink findlib\"\n" >>$@ @printf "version = \"$(CIL_VERSION)\"\n\n" >>$@ @printf "archive(byte) = \"cil.cma\"\n" >>$@ @printf "archive(native) = \"cil.cmxa\"\n\n" >>$@ From c099db188563e85aa322cd3b403322ec85e41909 Mon Sep 17 00:00:00 2001 From: Nicolas Koh Date: Thu, 9 Mar 2023 12:55:40 -0500 Subject: [PATCH 08/11] _tags --- src/_tags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_tags b/src/_tags index 646cc2d47..d4c663de1 100644 --- a/src/_tags +++ b/src/_tags @@ -1,4 +1,4 @@ or or or : include : package(findlib) -: use_unix, use_str, use_nums, use_dynlink, use_cil, linkall, package(findlib) +: use_unix, use_str, use_dynlink, use_cil, linkall, package(findlib) From 86814813dc5c6fb0fee94ceb88bfa6360b450b95 Mon Sep 17 00:00:00 2001 From: Nicolas Koh Date: Thu, 9 Mar 2023 13:00:03 -0500 Subject: [PATCH 09/11] Makefile.in restored --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index d914ff650..0b88e3e53 100644 --- a/Makefile.in +++ b/Makefile.in @@ -106,7 +106,7 @@ ocamlbuild: META: @rm -f $@ @printf "description = \"C Intermediate Language\"\n" >>$@ - @printf "requires = \"unix str dynlink findlib\"\n" >>$@ + @printf "requires = \"unix str num dynlink findlib\"\n" >>$@ @printf "version = \"$(CIL_VERSION)\"\n\n" >>$@ @printf "archive(byte) = \"cil.cma\"\n" >>$@ @printf "archive(native) = \"cil.cmxa\"\n\n" >>$@ From 6b857e0163c807803c185f795d023cb60d28c8b0 Mon Sep 17 00:00:00 2001 From: Zachary Kincaid Date: Mon, 10 Mar 2025 21:44:02 -0400 Subject: [PATCH 10/11] Updates for OCaml 5.3.0 --- src/check.ml | 2 +- src/cil.ml | 16 +++++++------- src/dominators.ml | 2 +- src/ext/partial/heap.ml | 2 +- src/ext/pta/golf.ml | 10 ++++----- src/ext/pta/olf.ml | 2 +- src/ext/pta/steensgaard.ml | 4 ++-- src/ext/zrapp/reachingdefs.ml | 2 +- src/ext/zrapp/rmciltmps.ml | 2 +- src/frontc/cabs2cil.ml | 4 ++-- src/ocamlutil/bitmap.ml | 2 +- src/ocamlutil/inthash.ml | 2 +- src/ocamlutil/longarray.ml | 2 +- src/ocamlutil/pretty.ml | 39 ++++++++++++++++++++++++----------- 14 files changed, 53 insertions(+), 38 deletions(-) diff --git a/src/check.ml b/src/check.ml index b7366d135..e5cda3490 100644 --- a/src/check.ml +++ b/src/check.ml @@ -646,7 +646,7 @@ and checkInit (i: init) : typ = | (Index(Const(CInt64(i', _, _)), NoOffset), ei) :: rest -> if i' <> i then ignore (warn "Initializer for index %s when %s was expected" - (Int64.format "%d" i') (Int64.format "%d" i)); + (Int64.to_string i') (Int64.to_string i)); checkInitType ei bt; loopIndex (Int64.succ i) rest | _ :: rest -> diff --git a/src/cil.ml b/src/cil.ml index b4b313b22..92fbc360b 100755 --- a/src/cil.ml +++ b/src/cil.ml @@ -1696,7 +1696,7 @@ let d_const () c = * integers in negative form. -- Gabriel *) E.s (E.bug "unexpected negative unsigned integer (please report this bug)") else - text (prefix ^ "0x" ^ Int64.format "%x" i ^ suffix) + text (Format.sprintf "%s0x%Lx%s" prefix i suffix) else ( if (i = mostNeg32BitInt) then (* sm: quirk here: if you print -2147483648 then this is two tokens *) @@ -2713,7 +2713,7 @@ let parseInt (str: string) : exp = let l = String.length str in fun s -> let ls = String.length s in - l >= ls && s = String.uppercase (String.sub str (l - ls) ls) + l >= ls && s = String.uppercase_ascii (String.sub str (l - ls) ls) in let l = String.length str in (* See if it is octal or hex *) @@ -4643,12 +4643,12 @@ class plainCilPrinterClass = Const(c) -> let d_plainconst () c = match c with - CInt64(i, ik, so) -> - let fmt = if isSigned ik then "%d" else "%x" in - dprintf "Int64(%s,%a,%s)" - (Int64.format fmt i) - d_ikind ik - (match so with Some s -> s | _ -> "None") + CInt64(i, ik, so) -> + let sos = match so with Some s -> s | _ -> "None" in + if isSigned ik then + dprintf "Int64(%Ld,%a,%s)" i d_ikind ik sos + else + dprintf "Int64(%Lx,%a,%s)" i d_ikind ik sos | CStr(s) -> text ("CStr(\"" ^ escape_string s ^ "\")") | CWStr(s) -> diff --git a/src/dominators.ml b/src/dominators.ml index d3c394605..4562ba51c 100644 --- a/src/dominators.ml +++ b/src/dominators.ml @@ -50,7 +50,7 @@ let debug = false (* For each statement we maintain a set of statements that dominate it *) module BS = Set.Make(struct type t = Cil.stmt - let compare v1 v2 = Pervasives.compare v1.sid v2.sid + let compare v1 v2 = Stdlib.compare v1.sid v2.sid end) diff --git a/src/ext/partial/heap.ml b/src/ext/partial/heap.ml index 10f48a045..5fbbe372c 100644 --- a/src/ext/partial/heap.ml +++ b/src/ext/partial/heap.ml @@ -9,7 +9,7 @@ type ('a) t = { } let create size = { - elements = Array.create (size+1) (max_int,None) ; + elements = Array.make (size+1) (max_int,None) ; size = 0 ; capacity = size ; } diff --git a/src/ext/pta/golf.ml b/src/ext/pta/golf.ml index 69c94abe4..bb40d7b0f 100644 --- a/src/ext/pta/golf.ml +++ b/src/ext/pta/golf.ml @@ -101,7 +101,7 @@ struct type 'a t = 'a bound let compare (x : 'a t) (y : 'a t) = if U.equal (x.info, y.info) then x.index - y.index - else Pervasives.compare (U.deref x.info) (U.deref y.info) + else Stdlib.compare (U.deref x.info) (U.deref y.info) end module Path = @@ -113,12 +113,12 @@ struct if U.equal (x.tail, y.tail) then begin if x.reached_global = y.reached_global then - Pervasives.compare x.kind y.kind - else Pervasives.compare x.reached_global y.reached_global + Stdlib.compare x.kind y.kind + else Stdlib.compare x.reached_global y.reached_global end - else Pervasives.compare (U.deref x.tail) (U.deref y.tail) + else Stdlib.compare (U.deref x.tail) (U.deref y.tail) end - else Pervasives.compare (U.deref x.head) (U.deref y.head) + else Stdlib.compare (U.deref x.head) (U.deref y.head) end module B = S.Make (Bound) diff --git a/src/ext/pta/olf.ml b/src/ext/pta/olf.ml index 517fe28da..f0d1b0567 100644 --- a/src/ext/pta/olf.ml +++ b/src/ext/pta/olf.ml @@ -64,7 +64,7 @@ module Bound = struct type 'a t = 'a bound let compare (x : 'a t) (y : 'a t) = - Pervasives.compare (U.deref x.info) (U.deref y.info) + Stdlib.compare (U.deref x.info) (U.deref y.info) end module B = S.Make (Bound) diff --git a/src/ext/pta/steensgaard.ml b/src/ext/pta/steensgaard.ml index 9e6a122ee..f4a0586b1 100644 --- a/src/ext/pta/steensgaard.ml +++ b/src/ext/pta/steensgaard.ml @@ -77,7 +77,7 @@ module Bound = struct type 'a t = 'a bound let compare (x : 'a t) (y : 'a t) = - Pervasives.compare x y + Stdlib.compare x y end module B = S.Make(Bound) @@ -92,7 +92,7 @@ struct type t = constant let compare ((xid,_) : t) ((yid,_) : t) = - Pervasives.compare xid yid + Stdlib.compare xid yid end module C = Set.Make(Constant) diff --git a/src/ext/zrapp/reachingdefs.ml b/src/ext/zrapp/reachingdefs.ml index c8199f7c2..3d763e3b6 100644 --- a/src/ext/zrapp/reachingdefs.ml +++ b/src/ext/zrapp/reachingdefs.ml @@ -41,7 +41,7 @@ module IOS = type t = int option let compare io1 io2 = match io1, io2 with - Some i1, Some i2 -> Pervasives.compare i1 i2 + Some i1, Some i2 -> Stdlib.compare i1 i2 | Some i1, None -> 1 | None, Some i2 -> -1 | None, None -> 0 diff --git a/src/ext/zrapp/rmciltmps.ml b/src/ext/zrapp/rmciltmps.ml index a1c32fcbc..e544261c7 100644 --- a/src/ext/zrapp/rmciltmps.ml +++ b/src/ext/zrapp/rmciltmps.ml @@ -16,7 +16,7 @@ module S = Stats module IS = Set.Make(struct type t = int - let compare = Pervasives.compare + let compare = Stdlib.compare end) let debug = RD.debug diff --git a/src/frontc/cabs2cil.ml b/src/frontc/cabs2cil.ml index dc185e133..61721cd7d 100644 --- a/src/frontc/cabs2cil.ml +++ b/src/frontc/cabs2cil.ml @@ -1924,7 +1924,7 @@ let rec setOneInit (this: preInit) let pMaxIdx, pArray = match this with NoInitPre -> (* No initializer so far here *) - ref idx, ref (Array.create (max 32 (idx + 1)) NoInitPre) + ref idx, ref (Array.make (max 32 (idx + 1)) NoInitPre) | CompoundPre (pMaxIdx, pArray) -> if !pMaxIdx < idx then begin @@ -3417,7 +3417,7 @@ and doExp (asconst: bool) (* This expression is used as a constant *) let l = String.length str in fun s -> let ls = String.length s in - l >= ls && s = String.uppercase (String.sub str (l - ls) ls) + l >= ls && s = String.uppercase_ascii (String.sub str (l - ls) ls) in match ct with A.CONST_INT str -> begin diff --git a/src/ocamlutil/bitmap.ml b/src/ocamlutil/bitmap.ml index 14d26a08b..33f5f9aea 100644 --- a/src/ocamlutil/bitmap.ml +++ b/src/ocamlutil/bitmap.ml @@ -10,7 +10,7 @@ type t = { mutable nrWords : int; let enlarge b newWords = let newbitmap = if newWords > b.nrWords then - let a = Array.create newWords Int32.zero in + let a = Array.make newWords Int32.zero in Array.blit b.bitmap 0 a 0 b.nrWords; a else diff --git a/src/ocamlutil/inthash.ml b/src/ocamlutil/inthash.ml index 8d5bd32af..a6253b9b6 100644 --- a/src/ocamlutil/inthash.ml +++ b/src/ocamlutil/inthash.ml @@ -34,7 +34,7 @@ let resize tbl = let osize = Array.length odata in let nsize = min (2 * osize + 1) Sys.max_array_length in if nsize <> osize then begin - let ndata = Array.create nsize Empty in + let ndata = Array.make nsize Empty in let rec insert_bucket = function Empty -> () | Cons(key, data, rest) -> diff --git a/src/ocamlutil/longarray.ml b/src/ocamlutil/longarray.ml index ed9f533b1..0cdef6154 100644 --- a/src/ocamlutil/longarray.ml +++ b/src/ocamlutil/longarray.ml @@ -24,7 +24,7 @@ let split_idx (idx: int) : int option = let rec create (len: int) (init: 'a) : 'a t = let len1, len2 = split_len len in - (Array.create len1 init) :: (if len2 > 0 then create len2 init else []) + (Array.make len1 init) :: (if len2 > 0 then create len2 init else []) let rec init (len: int) (fn: int -> 'a) : 'a t = let len1, len2 = split_len len in diff --git a/src/ocamlutil/pretty.ml b/src/ocamlutil/pretty.ml index a5c1c18b2..a15e87ff7 100644 --- a/src/ocamlutil/pretty.ml +++ b/src/ocamlutil/pretty.ml @@ -726,39 +726,54 @@ let gprintf (finish : doc -> 'b) ^ (String.sub format i (j-i+1))); let j' = succ j in (* eat the d,i,x etc. *) let format_spec = - String.init 2 (function - | 0 -> '%' - | _ -> fget j') (* format_spec = "%x", etc. *) + match fget j' with + | 'd' -> format_of_string "%Ld" + | 'i' -> "%Li" + | 'u' -> "%Lu" + | 'x' -> "%Lx" + | 'X' -> "%LX" + | 'o' -> "%Lo" + | _ -> assert false in Obj.magic(fun n -> collect (dctext1 acc - (Int64.format format_spec n)) + (Printf.sprintf format_spec n)) (succ j')) | 'l' -> if j != i + 1 then invalid_arg ("dprintf: unimplemented format " ^ (String.sub format i (j-i+1))); let j' = succ j in (* eat the d,i,x etc. *) let format_spec = - String.init 2 (function - | 0 -> '%' - | _ -> fget j') (* format_spec = "%x", etc. *) + match fget j' with + | 'd' -> format_of_string "%ld" + | 'i' -> "%li" + | 'u' -> "%lu" + | 'x' -> "%lx" + | 'X' -> "%lX" + | 'o' -> "%lo" + | _ -> assert false in Obj.magic(fun n -> collect (dctext1 acc - (Int32.format format_spec n)) + (Printf.sprintf format_spec n)) (succ j')) | 'n' -> if j != i + 1 then invalid_arg ("dprintf: unimplemented format " ^ (String.sub format i (j-i+1))); let j' = succ j in (* eat the d,i,x etc. *) let format_spec = - String.init 2 (function - | 0 -> '%' - | _ -> fget j') (* format_spec = "%x", etc. *) + match fget j' with + | 'd' -> format_of_string "%d" + | 'i' -> "%i" + | 'u' -> "%u" + | 'x' -> "%x" + | 'X' -> "%X" + | 'o' -> "%o" + | _ -> assert false in Obj.magic(fun n -> collect (dctext1 acc - (Nativeint.format format_spec n)) + (Printf.sprintf format_spec n)) (succ j')) | 'f' | 'e' | 'E' | 'g' | 'G' -> Obj.magic(fun f -> From 128d334545ff9f8ca375c62824c3171b7f4bddf8 Mon Sep 17 00:00:00 2001 From: Zachary Kincaid Date: Thu, 5 Jun 2025 14:15:38 -0400 Subject: [PATCH 11/11] Use ocamlfind to check for dynlink --- configure | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/configure b/configure index 2560ede45..ae54dab6d 100755 --- a/configure +++ b/configure @@ -3703,20 +3703,6 @@ $as_echo "version differs from ocamlc; ocamlopt.opt discarded." >&6; } - # checking for native dynlink - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dynlink.cmxa" >&5 -$as_echo_n "checking for dynlink.cmxa... " >&6; } - if test -f "$OCAMLLIB/dynlink.cmxa" ; then - OCAMLNATDYNLINK=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - OCAMLNATDYNLINK=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - - # checking for ocaml toplevel if test -n "$ac_tool_prefix"; then @@ -4684,6 +4670,20 @@ if test "$OCAMLFIND" = "no"; then as_fn_error $? "You must install OCaml findlib (the ocamlfind command)" "$LINENO" 5 fi + # checking for native dynlink + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dynlink.cmxa" >&5 + $as_echo_n "checking for dynlink... " >&6; } + $OCAMLFIND query dynlink + case $? in + 0) OCAMLNATDYNLINK=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + $as_echo "yes" >&6; };; + *) OCAMLNATDYNLINK=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + $as_echo "no" >&6; };; + esac + + # ------------------- Perl ---------------- if test -n "$ac_tool_prefix"; then