From 989ac0b2635443b9c0f183ee6343b663c854f4ea Mon Sep 17 00:00:00 2001 From: Damien Doligez Date: Mon, 31 Mar 2014 16:02:01 +0000 Subject: stop ignoring ocamlmklib.ml, it is not a generated file any more git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14512 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- tools/.ignore | 2 -- 1 file changed, 2 deletions(-) (limited to 'tools') diff --git a/tools/.ignore b/tools/.ignore index ce14846de2..5f3f25bf13 100644 --- a/tools/.ignore +++ b/tools/.ignore @@ -18,11 +18,9 @@ keywords lexer299.ml ocaml299to3 ocamlmklib -ocamlmklib.ml lexer301.ml scrapelabels addlabels -myocamlbuild_config.ml objinfo_helper read_cmt read_cmt.opt -- cgit v1.2.1 From c95804ee7e05b0e235d0deafe916095907e0b90f Mon Sep 17 00:00:00 2001 From: Damien Doligez Date: Thu, 3 Apr 2014 16:18:14 +0000 Subject: ignore generated file ocamlmklibconfig.ml git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14526 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- tools/.ignore | 1 + 1 file changed, 1 insertion(+) (limited to 'tools') diff --git a/tools/.ignore b/tools/.ignore index 5f3f25bf13..94fac02fbc 100644 --- a/tools/.ignore +++ b/tools/.ignore @@ -18,6 +18,7 @@ keywords lexer299.ml ocaml299to3 ocamlmklib +ocamlmklibconfig.ml lexer301.ml scrapelabels addlabels -- cgit v1.2.1 From 2b9f94b69b1e7e5729750e5d66d391b9d8c5d0f2 Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Sun, 6 Apr 2014 15:06:22 +0000 Subject: PR#6270: remove need for -I directives to ocamldebug in common case (patch by Josh Watzman) Add absolute directory names to bytecode format for ocamldebug to use The need for a long list of -I directives makes interactively using ocamldebug a pain in the butt. Many folks have solved this with various `find` invocations or even Python wrappers, but those lead to other problems when it might include files you weren't expecting (or miss things you were). But all of this is really annoying since the tooling should be able to figure out itself, even heuristically, where your source files are -- gdb gets this right, why can't we? This patch implements one of the more important heuristics from gdb: you typically debug on the same machine you built on, so looking for the source files and built artifacts in the absolute paths where they were during compilation is a good first try. We write out absolute paths into a new structure at the beginning of the debug section and then automatically append those directories into the load path. This means mean that if you happen to be debugging on a machine where the original source and build artifacts are *not* available in their original absolute locations, things will work as before, using the standard load path mechanism. You can also explicitly use -I to prepend directories to the load path and override the defaults located by this new mechanism. I personally find this makes using ocamldebug much more pleasant :) git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14533 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- tools/dumpobj.ml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools') diff --git a/tools/dumpobj.ml b/tools/dumpobj.ml index db8494cc26..f1255e9cd2 100644 --- a/tools/dumpobj.ml +++ b/tools/dumpobj.ml @@ -493,6 +493,7 @@ let dump_obj filename ic = if cu.cu_debug > 0 then begin seek_in ic cu.cu_debug; let evl = (input_value ic : debug_event list) in + ignore (input_value ic); (* Skip the list of absolute directory names *) record_events 0 evl end; seek_in ic cu.cu_pos; @@ -531,6 +532,7 @@ let dump_exe ic = for _i = 1 to num_eventlists do let orig = input_binary_int ic in let evl = (input_value ic : debug_event list) in + ignore (input_value ic); (* Skip the list of absolute directory names *) record_events orig evl done with Not_found -> () -- cgit v1.2.1 From de4f4cf8b39785866f50b97443837c6c990ad27e Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Mon, 7 Apr 2014 07:06:17 +0000 Subject: PR#6358: obey DESTDIR in install targets git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14536 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- tools/Makefile | 2 +- tools/Makefile.nt | 2 +- tools/Makefile.shared | 30 +++++++++++++++++------------- 3 files changed, 19 insertions(+), 15 deletions(-) (limited to 'tools') diff --git a/tools/Makefile b/tools/Makefile index e2f3cb26e7..b5cc10109b 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -19,7 +19,7 @@ ocamlmktop: ocamlmktop.tpl ../config/Makefile chmod +x ocamlmktop install:: - cp ocamlmktop $(BINDIR) + cp ocamlmktop $(INSTALL_BINDIR) clean:: rm -f ocamlmktop diff --git a/tools/Makefile.nt b/tools/Makefile.nt index 052af81c22..ed9b35946d 100644 --- a/tools/Makefile.nt +++ b/tools/Makefile.nt @@ -21,7 +21,7 @@ ocamlmktop: $(OCAMLMKTOP) $(CAMLC) $(LINKFLAGS) -o ocamlmktop $(OCAMLMKTOP_IMPORTS) $(OCAMLMKTOP) install:: - cp ocamlmktop $(BINDIR)/ocamlmktop$(EXE) + cp ocamlmktop $(INSTALL_BINDIR)/ocamlmktop$(EXE) clean:: rm -f ocamlmktop$(EXE) diff --git a/tools/Makefile.shared b/tools/Makefile.shared index 39be1db4e9..b50cb0adde 100644 --- a/tools/Makefile.shared +++ b/tools/Makefile.shared @@ -54,10 +54,14 @@ clean:: if test -f ocamldep; then mv -f ocamldep ocamldep.bak; else :; fi rm -f ocamldep.opt + +INSTALL_BINDIR=$(DESTDIR)$(BINDIR) +INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR) + install:: - cp ocamldep $(BINDIR)/ocamldep$(EXE) + cp ocamldep $(INSTALL_BINDIR)/ocamldep$(EXE) if test -f ocamldep.opt; \ - then cp ocamldep.opt $(BINDIR)/ocamldep.opt$(EXE); else :; fi + then cp ocamldep.opt $(INSTALL_BINDIR)/ocamldep.opt$(EXE); else :; fi # The profiler @@ -79,13 +83,13 @@ ocamloptp: ocamloptp.cmo opt:: profiling.cmx install:: - cp ocamlprof $(BINDIR)/ocamlprof$(EXE) - cp ocamlcp $(BINDIR)/ocamlcp$(EXE) - cp ocamloptp $(BINDIR)/ocamloptp$(EXE) - cp profiling.cmi profiling.cmo $(LIBDIR) + cp ocamlprof $(INSTALL_BINDIR)/ocamlprof$(EXE) + cp ocamlcp $(INSTALL_BINDIR)/ocamlcp$(EXE) + cp ocamloptp $(INSTALL_BINDIR)/ocamloptp$(EXE) + cp profiling.cmi profiling.cmo $(INSTALL_LIBDIR) installopt:: - cp profiling.cmx profiling.o $(LIBDIR) + cp profiling.cmx profiling.o $(INSTALL_LIBDIR) clean:: rm -f ocamlprof ocamlcp ocamloptp @@ -97,7 +101,7 @@ ocamlmklib: ocamlmklibconfig.cmo ocamlmklib.cmo $(CAMLC) $(LINKFLAGS) -o ocamlmklib ocamlmklibconfig.cmo ocamlmklib.cmo install:: - cp ocamlmklib $(BINDIR)/ocamlmklib$(EXE) + cp ocamlmklib $(INSTALL_BINDIR)/ocamlmklib$(EXE) clean:: rm -f ocamlmklib @@ -132,7 +136,7 @@ lexer299.ml: lexer299.mll $(CAMLLEX) lexer299.mll #install:: -# cp ocaml299to3 $(BINDIR)/ocaml299to3$(EXE) +# cp ocaml299to3 $(INSTALL_BINDIR)/ocaml299to3$(EXE) clean:: rm -f ocaml299to3 lexer299.ml @@ -148,7 +152,7 @@ lexer301.ml: lexer301.mll $(CAMLLEX) lexer301.mll #install:: -# cp scrapelabels $(LIBDIR) +# cp scrapelabels $(INSTALL_LIBDIR) clean:: rm -f scrapelabels lexer301.ml @@ -164,7 +168,7 @@ addlabels: addlabels.cmo $(ADDLABELS_IMPORTS) addlabels.cmo #install:: -# cp addlabels $(LIBDIR) +# cp addlabels $(INSTALL_LIBDIR) clean:: rm -f addlabels @@ -285,8 +289,8 @@ objinfo: objinfo_helper$(EXE) $(OBJINFO) $(CAMLC) -o objinfo $(OBJINFO) install:: - cp objinfo $(BINDIR)/ocamlobjinfo$(EXE) - cp objinfo_helper$(EXE) $(LIBDIR)/objinfo_helper$(EXE) + cp objinfo $(INSTALL_BINDIR)/ocamlobjinfo$(EXE) + cp objinfo_helper$(EXE) $(INSTALL_LIBDIR)/objinfo_helper$(EXE) clean:: rm -f objinfo objinfo_helper$(EXE) -- cgit v1.2.1 From 7d51d487ef28bb359cb3c4eb996b85d84eb63c0d Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Mon, 7 Apr 2014 12:09:25 +0000 Subject: [minor] make tools/Makefile.shared msvc-friendly git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14547 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- tools/Makefile.shared | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/Makefile.shared b/tools/Makefile.shared index b50cb0adde..6b33a5b047 100644 --- a/tools/Makefile.shared +++ b/tools/Makefile.shared @@ -89,7 +89,7 @@ install:: cp profiling.cmi profiling.cmo $(INSTALL_LIBDIR) installopt:: - cp profiling.cmx profiling.o $(INSTALL_LIBDIR) + cp profiling.cmx profiling.$(O) $(INSTALL_LIBDIR) clean:: rm -f ocamlprof ocamlcp ocamloptp -- cgit v1.2.1 From 8ebe1198178a4afde8a776ffe9dda7b13993a22c Mon Sep 17 00:00:00 2001 From: Damien Doligez Date: Sat, 12 Apr 2014 07:22:18 +0000 Subject: test reference files are now exempt from all rules git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14580 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- tools/check-typo | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'tools') diff --git a/tools/check-typo b/tools/check-typo index 05c7c68c07..93814131e5 100755 --- a/tools/check-typo +++ b/tools/check-typo @@ -34,6 +34,10 @@ # Built-in exceptions: # - Any binary file (i.e. with svn:mime-type = application/octet-stream) # is automatically exempt from all the rules. +# - Any file whose name matches one of the following patterns is +# automatically exempt from all rules +# *.reference +# */reference # - Any file whose name begins with "Makefile" is automatically exempt # from the "tabs" rule. # - Any file whose name matches one of the following patterns is @@ -45,11 +49,6 @@ # *.mltop # *.odocl # *.clib -# *.reference -# */reference -# - Any file whose name matches one of the following patterns is -# automatically exempt from the "long-line" rule. -# *.reference # ASCII characters are bytes from 0 to 127. Any other byte is # flagged as a non-ASCII character. @@ -138,10 +137,7 @@ IGNORE_DIRS=" case "$f" in */.depend*|*/.ignore) h;; *.mlpack|*.mllib|*.mltop|*.odocl|*.itarget|*.clib) h;; - *.reference|*/reference) h;; - esac - case "$f" in - *.reference) rules="long-line,$rules";; + *.reference|*/reference) continue;; esac (cat "$f"; echo) \ -- cgit v1.2.1 From 7303ac34cad9046746f9f95a7610740efcfd2121 Mon Sep 17 00:00:00 2001 From: Damien Doligez Date: Sat, 12 Apr 2014 10:17:02 +0000 Subject: fix some of the whitespace problems in the source git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14582 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- tools/eqparsetree.ml | 10 +++++----- tools/read_cmt.ml | 31 +++++++++++++++++++------------ tools/untypeast.ml | 15 ++++++++++----- tools/untypeast.mli | 3 ++- 4 files changed, 36 insertions(+), 23 deletions(-) (limited to 'tools') diff --git a/tools/eqparsetree.ml b/tools/eqparsetree.ml index 332efa3e14..128453e0c3 100644 --- a/tools/eqparsetree.ml +++ b/tools/eqparsetree.ml @@ -120,7 +120,7 @@ module Asttypes = struct (('all_a0 loc) * ('all_a0 loc)) -> 'result = fun mf_a ({ txt = a0; loc = a1 }, { txt = b0; loc = b1 }) -> (mf_a (a0, b0)) && (Location.eq_t (a1, b1)) - + end let rec eq_row_field : (row_field * row_field) -> 'result = @@ -185,7 +185,7 @@ and eq_core_type : (core_type * core_type) -> 'result = ({ ptyp_desc = a0; ptyp_loc = a1 }, { ptyp_desc = b0; ptyp_loc = b1 }) -> (eq_core_type_desc (a0, b0)) && (Location.eq_t (a1, b1)) - + let eq_class_infos : 'all_a0. (('all_a0 * 'all_a0) -> 'result) -> @@ -221,7 +221,7 @@ let eq_class_infos : (eq_bool (a0, b0)) && (eq_bool (a1, b1))) (a4, b4))) && (Location.eq_t (a5, b5)) - + let rec eq_pattern_desc : (pattern_desc * pattern_desc) -> 'result = function | (Ppat_any, Ppat_any) -> true @@ -259,7 +259,7 @@ and eq_pattern : (pattern * pattern) -> 'result = ({ ppat_desc = a0; ppat_loc = a1 }, { ppat_desc = b0; ppat_loc = b1 }) -> (eq_pattern_desc (a0, b0)) && (Location.eq_t (a1, b1)) - + let rec eq_structure_item_desc : (structure_item_desc * structure_item_desc) -> 'result = function @@ -760,7 +760,7 @@ and eq_expression : (expression * expression) -> 'result = ({ pexp_desc = a0; pexp_loc = a1 }, { pexp_desc = b0; pexp_loc = b1 }) -> (eq_expression_desc (a0, b0)) && (Location.eq_t (a1, b1)) - + let rec eq_directive_argument : (directive_argument * directive_argument) -> 'result = function diff --git a/tools/read_cmt.ml b/tools/read_cmt.ml index c0c5eb09dc..0ff9f3df77 100644 --- a/tools/read_cmt.ml +++ b/tools/read_cmt.ml @@ -16,43 +16,49 @@ let print_info_arg = ref false let target_filename = ref None let arg_list = [ - "-o", Arg.String (fun s -> - target_filename := Some s - ), " FILE (or -) : dump to file FILE (or stdout)"; + "-o", Arg.String (fun s -> target_filename := Some s), + " FILE (or -) : dump to file FILE (or stdout)"; "-annot", Arg.Set gen_annot, " : generate the corresponding .annot file"; - "-src", Arg.Set gen_ml, " : generate an equivalent of the original source file (without comments) from a .cmt or a .cmti file"; + "-src", Arg.Set gen_ml, + " : convert .cmt or .cmti back to source code (without comments)"; "-info", Arg.Set print_info_arg, " : print information on the file"; ] -let arg_usage = "read_cmt [OPTIONS] FILE.cmt : read FILE.cmt and print related information" +let arg_usage = + "read_cmt [OPTIONS] FILE.cmt : read FILE.cmt and print related information" let print_info cmt = let open Cmt_format in Printf.printf "module name: %s\n" cmt.cmt_modname; begin match cmt.cmt_annots with - Packed (_, list) -> Printf.printf "pack: %s\n" (String.concat " " list) + Packed (_, list) -> + Printf.printf "pack: %s\n" (String.concat " " list) | Implementation _ -> Printf.printf "kind: implementation\n" | Interface _ -> Printf.printf "kind: interface\n" - | Partial_implementation _ -> Printf.printf "kind: implementation with errors\n" + | Partial_implementation _ -> + Printf.printf "kind: implementation with errors\n" | Partial_interface _ -> Printf.printf "kind: interface with errors\n" end; - Printf.printf "command: %s\n" (String.concat " " (Array.to_list cmt.cmt_args)); + Printf.printf "command: %s\n" + (String.concat " " (Array.to_list cmt.cmt_args)); begin match cmt.cmt_sourcefile with None -> () | Some name -> Printf.printf "sourcefile: %s\n" name; end; Printf.printf "build directory: %s\n" cmt.cmt_builddir; - List.iter (fun dir -> Printf.printf "load path: %s\n%!" dir) cmt.cmt_loadpath; + List.iter (Printf.printf "load path: %s\n%!") cmt.cmt_loadpath; begin match cmt.cmt_source_digest with None -> () - | Some digest -> Printf.printf "source digest: %s\n" (Digest.to_hex digest); + | Some digest -> + Printf.printf "source digest: %s\n" (Digest.to_hex digest); end; begin match cmt.cmt_interface_digest with None -> () - | Some digest -> Printf.printf "interface digest: %s\n" (Digest.to_hex digest); + | Some digest -> + Printf.printf "interface digest: %s\n" (Digest.to_hex digest); end; List.iter (fun (name, digest) -> Printf.printf "import: %s %s\n" name (Digest.to_hex digest); @@ -74,7 +80,8 @@ let _ = if !gen_ml then Cmt2annot.gen_ml !target_filename filename cmt; if !print_info_arg || not (!gen_ml || !gen_annot) then print_info cmt; end else begin - Printf.fprintf stderr "Error: the file must have an extension in .cmt or .cmti.\n%!"; + Printf.fprintf stderr + "Error: the file's extension must be .cmt or .cmti.\n%!"; Arg.usage arg_list arg_usage end ) arg_usage diff --git a/tools/untypeast.ml b/tools/untypeast.ml index 26993440ae..1acbb2c31d 100644 --- a/tools/untypeast.ml +++ b/tools/untypeast.ml @@ -62,7 +62,8 @@ and untype_structure_item item = | Tstr_recmodule list -> Pstr_recmodule (List.map untype_module_binding list) | Tstr_modtype mtd -> - Pstr_modtype {pmtd_name=mtd.mtd_name; pmtd_type=option untype_module_type mtd.mtd_type; + Pstr_modtype {pmtd_name=mtd.mtd_name; + pmtd_type=option untype_module_type mtd.mtd_type; pmtd_loc=mtd.mtd_loc;pmtd_attributes=mtd.mtd_attributes;} | Tstr_open (ovf, _path, lid, attrs) -> Pstr_open (ovf, lid, attrs) | Tstr_class list -> @@ -191,7 +192,8 @@ and untype_pattern pat = | Tpat_or (p1, p2, _) -> Ppat_or (untype_pattern p1, untype_pattern p2) | Tpat_lazy p -> Ppat_lazy (untype_pattern p) in - Pat.mk ~loc:pat.pat_loc ~attrs:pat.pat_attributes desc (* todo: fix attributes on extras *) + Pat.mk ~loc:pat.pat_loc ~attrs:pat.pat_attributes desc + (* todo: fix attributes on extras *) and untype_extra (extra, loc, attrs) sexp = let desc = @@ -331,7 +333,8 @@ and untype_signature_item item = | Tsig_exception decl -> Psig_exception (untype_constructor_declaration decl) | Tsig_module md -> - Psig_module {pmd_name = md.md_name; pmd_type = untype_module_type md.md_type; + Psig_module {pmd_name = md.md_name; + pmd_type = untype_module_type md.md_type; pmd_attributes = md.md_attributes; pmd_loc = md.md_loc; } | Tsig_recmodule list -> @@ -339,10 +342,12 @@ and untype_signature_item item = {pmd_name = md.md_name; pmd_type = untype_module_type md.md_type; pmd_attributes = md.md_attributes; pmd_loc = md.md_loc}) list) | Tsig_modtype mtd -> - Psig_modtype {pmtd_name=mtd.mtd_name; pmtd_type=option untype_module_type mtd.mtd_type; + Psig_modtype {pmtd_name=mtd.mtd_name; + pmtd_type=option untype_module_type mtd.mtd_type; pmtd_attributes=mtd.mtd_attributes; pmtd_loc=mtd.mtd_loc} | Tsig_open (ovf, _path, lid, attrs) -> Psig_open (ovf, lid, attrs) - | Tsig_include (mty, _, attrs) -> Psig_include (untype_module_type mty, attrs) + | Tsig_include (mty, _, attrs) -> + Psig_include (untype_module_type mty, attrs) | Tsig_class list -> Psig_class (List.map untype_class_description list) | Tsig_class_type list -> diff --git a/tools/untypeast.mli b/tools/untypeast.mli index 0e0351ef9a..efd0a031d5 100644 --- a/tools/untypeast.mli +++ b/tools/untypeast.mli @@ -13,7 +13,8 @@ val untype_structure : Typedtree.structure -> Parsetree.structure val untype_signature : Typedtree.signature -> Parsetree.signature val untype_expression : Typedtree.expression -> Parsetree.expression -val untype_type_declaration : Typedtree.type_declaration -> Parsetree.type_declaration +val untype_type_declaration : + Typedtree.type_declaration -> Parsetree.type_declaration val untype_module_type : Typedtree.module_type -> Parsetree.module_type val lident_of_path : Path.t -> Longident.t -- cgit v1.2.1