Skip to content

Commit

Permalink
Revert "remove -rectypes except for term.ml"
Browse files Browse the repository at this point in the history
Preparing landing of the native compiler, which requires -rectypes flag.

This reverts commit f975575.



git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16135 85f007b7-540e-0410-9357-904b9bb8a0f7
  • Loading branch information
mdenes committed Jan 22, 2013
1 parent e88df65 commit 62ce65d
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 36 deletions.
23 changes: 5 additions & 18 deletions Makefile.build
Expand Up @@ -675,12 +675,12 @@ install-latex:
source-doc: mli-doc $(OCAMLDOCDIR)/coq.pdf source-doc: mli-doc $(OCAMLDOCDIR)/coq.pdf


$(OCAMLDOCDIR)/coq.tex:: $(DOCMLIS:.mli=.cmi) $(OCAMLDOCDIR)/coq.tex:: $(DOCMLIS:.mli=.cmi)
$(OCAMLDOC) -latex -I $(MYCAMLP4LIB) $(MLINCLUDES)\ $(OCAMLDOC) -latex -rectypes -I $(MYCAMLP4LIB) $(MLINCLUDES)\
$(DOCMLIS) -t "Coq mlis documentation" \ $(DOCMLIS) -t "Coq mlis documentation" \
-intro $(OCAMLDOCDIR)/docintro -o $@ -intro $(OCAMLDOCDIR)/docintro -o $@


mli-doc:: $(DOCMLIS:.mli=.cmi) mli-doc:: $(DOCMLIS:.mli=.cmi)
$(OCAMLDOC) -html -I $(MYCAMLP4LIB) $(MLINCLUDES)\ $(OCAMLDOC) -html -rectypes -I $(MYCAMLP4LIB) $(MLINCLUDES)\
$(DOCMLIS) -d $(OCAMLDOCDIR)/html -colorize-code \ $(DOCMLIS) -d $(OCAMLDOCDIR)/html -colorize-code \
-t "Coq mlis documentation" -intro $(OCAMLDOCDIR)/docintro \ -t "Coq mlis documentation" -intro $(OCAMLDOCDIR)/docintro \
-css-style style.css -css-style style.css
Expand All @@ -693,9 +693,9 @@ ml-dot:: $(MLEXTRAFILES)
$(DOT) -Tpng $< -o $@ $(DOT) -Tpng $< -o $@


%_types.dot: %.mli %_types.dot: %.mli
$(OCAMLDOC) $(MLINCLUDES) $(ODOCDOTOPTS) -dot-types -o $@ $< $(OCAMLDOC) -rectypes $(MLINCLUDES) $(ODOCDOTOPTS) -dot-types -o $@ $<


OCAMLDOC_MLLIBD = $(OCAMLDOC) $(MLINCLUDES) $(ODOCDOTOPTS) -o $@ \ OCAMLDOC_MLLIBD = $(OCAMLDOC) -rectypes $(MLINCLUDES) $(ODOCDOTOPTS) -o $@ \
$(foreach lib,$(|:.mllib.d=_MLLIB_DEPENDENCIES),$(addsuffix .ml,$($(lib)))) $(foreach lib,$(|:.mllib.d=_MLLIB_DEPENDENCIES),$(addsuffix .ml,$($(lib))))


%.dot: | %.mllib.d %.dot: | %.mllib.d
Expand All @@ -714,7 +714,7 @@ tactics/tactics.dot: | tactics/tactics.mllib.d tactics/hightactics.mllib.d
$(OCAMLDOC_MLLIBD) $(OCAMLDOC_MLLIBD)


%.dot: %.mli %.dot: %.mli
$(OCAMLDOC) $(MLINCLUDES) $(ODOCDOTOPTS) -o $@ $< $(OCAMLDOC) -rectypes $(MLINCLUDES) $(ODOCDOTOPTS) -o $@ $<


$(OCAMLDOCDIR)/%.pdf: $(OCAMLDOCDIR)/%.tex $(OCAMLDOCDIR)/%.pdf: $(OCAMLDOCDIR)/%.tex
(cd $(OCAMLDOCDIR) ; pdflatex $*.tex && pdflatex $*.tex) (cd $(OCAMLDOCDIR) ; pdflatex $*.tex && pdflatex $*.tex)
Expand Down Expand Up @@ -746,19 +746,6 @@ ide/coqide_main_opt.ml: ide/coqide_main.ml4 config/Makefile # no camlp4deps here
$(SHOW)'CAMLP4O $<' $(SHOW)'CAMLP4O $<'
$(HIDE)$(CAMLP4O) $(PR_O) $(CAMLP4USE) -D$(IDEOPTINT) -impl $< -o $@ $(HIDE)$(CAMLP4O) $(PR_O) $(CAMLP4USE) -D$(IDEOPTINT) -impl $< -o $@


# Specific rule for term.ml which uses -rectypes
# Since term.mli doesn't need -rectypes, this doesn't impact the other ml files

TERM:=kernel/term

$(TERM).cmo: $(TERM).ml | $(TERM).ml.d
$(SHOW)'OCAMLC -rectypes $<'
$(HIDE)$(OCAMLC) $(MLINCLUDES) $(BYTEFLAGS) -rectypes -c $<

$(TERM).cmx: $(TERM).ml | $(TERM).ml.d
$(SHOW)'OCAMLOPT -rectypes $<'
$(HIDE)$(OCAMLOPT) $(MLINCLUDES) $(OPTFLAGS) -intf-suffix .cmi -rectypes -c $<

# pretty printing of the revision number when compiling a checked out # pretty printing of the revision number when compiling a checked out
# source tree # source tree
.PHONY: revision .PHONY: revision
Expand Down
4 changes: 0 additions & 4 deletions _tags
Expand Up @@ -22,10 +22,6 @@


<grammar/grammar.{cma,cmxa}> : use_unix <grammar/grammar.{cma,cmxa}> : use_unix


## tags for ml files

"kernel/term.ml": rectypes

## tags for camlp4 files ## tags for camlp4 files


"toplevel/whelp.ml4": use_grammar "toplevel/whelp.ml4": use_grammar
Expand Down
2 changes: 1 addition & 1 deletion configure
Expand Up @@ -1142,7 +1142,7 @@ CAMLLINK="$bytecamlc"
CAMLOPTLINK="$nativecamlc" CAMLOPTLINK="$nativecamlc"
# Caml flags # Caml flags
CAMLFLAGS=$coq_annotate_flag CAMLFLAGS=-rectypes $coq_annotate_flag
TYPEREX=$coq_typerex_wrapper TYPEREX=$coq_typerex_wrapper
# Compilation debug flags # Compilation debug flags
Expand Down
9 changes: 9 additions & 0 deletions dev/doc/debugging.txt
Expand Up @@ -21,6 +21,15 @@ Debugging from Coq toplevel using Caml trace mechanism
notations, ...), use "Set Printing All". It will affect the #trace notations, ...), use "Set Printing All". It will affect the #trace
printers too. printers too.


Note for Ocaml 3.10.x: Ocaml 3.10.x requires that modules compiled
with -rectypes are loaded in an environment with -rectypes set but
there is no way to tell the toplevel to support -rectypes. To make it
works, use "patch -p0 < dev/doc/patch.ocaml-3.10.drop.rectypes" to
hack script/coqmktop.ml, then recompile coqtop.byte. The procedure
above then works as soon as coqtop.byte is called with at least one
argument (add neutral option -byte to ensure at least one argument).


Debugging from Caml debugger Debugging from Caml debugger
============================ ============================


Expand Down
31 changes: 31 additions & 0 deletions dev/doc/patch.ocaml-3.10.drop.rectypes
@@ -0,0 +1,31 @@
Index: scripts/coqmktop.ml
===================================================================
--- scripts/coqmktop.ml (révision 12084)
+++ scripts/coqmktop.ml (copie de travail)
@@ -231,12 +231,25 @@
end;;

let ppf = Format.std_formatter;;
+ let set_rectypes_hack () =
+ if String.length (Sys.ocaml_version) >= 4 &
+ String.sub (Sys.ocaml_version) 0 4 = \"3.10\"
+ then
+ (* ocaml 3.10 does not have #rectypes but needs it *)
+ (* simulate a call with option -rectypes before *)
+ (* jumping to the ocaml toplevel *)
+ for i = 1 to Array.length Sys.argv - 1 do
+ Sys.argv.(i) <- \"-rectypes\"
+ done
+ else
+ () in
+
Mltop.set_top
{Mltop.load_obj=
(fun f -> if not (Topdirs.load_file ppf f) then failwith \"error\");
Mltop.use_file=Topdirs.dir_use ppf;
Mltop.add_dir=Topdirs.dir_directory;
- Mltop.ml_loop=(fun () -> Toploop.loop ppf) };;\n"
+ Mltop.ml_loop=(fun () -> set_rectypes_hack(); Topmain.main()) };;\n"

(* create a temporary main file to link *)
let create_tmp_main_file modules =
5 changes: 2 additions & 3 deletions myocamlbuild.ml
Expand Up @@ -302,9 +302,8 @@ let extra_rules () = begin
(** All caml files are compiled with +camlp4/5 (** All caml files are compiled with +camlp4/5
and ide files need +lablgtk2 *) and ide files need +lablgtk2 *)


flag ["compile"; "ocaml"; "rectypes" ] (A "-rectypes"); flag ["compile"; "ocaml"] (S [A"-rectypes"; camlp4incl]);
flag ["compile"; "ocaml"] camlp4incl; flag ["link"; "ocaml"] (S [A"-rectypes"; camlp4incl]);
flag ["link"; "ocaml"] camlp4incl;
flag ["ocaml"; "ide"; "compile"] lablgtkincl; flag ["ocaml"; "ide"; "compile"] lablgtkincl;
flag ["ocaml"; "ide"; "link"] lablgtkincl; flag ["ocaml"; "ide"; "link"] lablgtkincl;
flag ["ocaml"; "ide"; "link"; "byte"] flag ["ocaml"; "ide"; "link"; "byte"]
Expand Down
15 changes: 13 additions & 2 deletions scripts/coqmktop.ml
Expand Up @@ -221,7 +221,18 @@ let tmp_dynlink()=
let declare_loading_string () = let declare_loading_string () =
if not !top then if not !top then
"Mltop.remove ();;" "Mltop.remove ();;"
else "let ppf = Format.std_formatter;;\ else
"begin try\
\n (* Enable rectypes in the toplevel if it has the directive #rectypes *)\
\n begin match Hashtbl.find Toploop.directive_table \"rectypes\" with\
\n | Toploop.Directive_none f -> f ()\
\n | _ -> ()\
\n end\
\n with\
\n | Not_found -> ()\
\n end;;\
\n\
\n let ppf = Format.std_formatter;;\
\n Mltop.set_top\ \n Mltop.set_top\
\n {Mltop.load_obj=\ \n {Mltop.load_obj=\
\n (fun f -> if not (Topdirs.load_file ppf f) then Errors.error (\"Could not load plugin \"^f));\ \n (fun f -> if not (Topdirs.load_file ppf f) then Errors.error (\"Could not load plugin \"^f));\
Expand Down Expand Up @@ -288,7 +299,7 @@ let main () =
(* add topstart.cmo explicitly because we shunted ocamlmktop wrapper *) (* add topstart.cmo explicitly because we shunted ocamlmktop wrapper *)
let args = if !top then args @ [ "topstart.cmo" ] else args in let args = if !top then args @ [ "topstart.cmo" ] else args in
(* Now, with the .cma, we MUST use the -linkall option *) (* Now, with the .cma, we MUST use the -linkall option *)
let command = String.concat " " (prog::args) in let command = String.concat " " (prog::"-rectypes"::args) in
if !echo then if !echo then
begin begin
print_endline command; print_endline command;
Expand Down
16 changes: 8 additions & 8 deletions tools/coq_makefile.ml
Expand Up @@ -409,12 +409,12 @@ let variables is_install opt (args,defs) =
-I \"$(COQLIB)proofs\" -I \"$(COQLIB)tactics\" -I \"$(COQLIB)tools\" \\ -I \"$(COQLIB)proofs\" -I \"$(COQLIB)tactics\" -I \"$(COQLIB)tools\" \\
-I \"$(COQLIB)toplevel\" -I \"$(COQLIB)grammar\""; -I \"$(COQLIB)toplevel\" -I \"$(COQLIB)grammar\"";
List.iter (fun c -> print " \\ List.iter (fun c -> print " \\
-I \"$(COQLIB)\""; print c) Coq_config.plugins_dirs; print "\n"; -I $(COQLIB)/"; print c) Coq_config.plugins_dirs; print "\n";
print "ZFLAGS=$(OCAMLLIBS) $(COQSRCLIBS) -I \"$(CAMLP4LIB)\"\n\n"; print "ZFLAGS=$(OCAMLLIBS) $(COQSRCLIBS) -I $(CAMLP4LIB)\n\n";
print "CAMLC?=$(OCAMLC) -c\n"; print "CAMLC?=$(OCAMLC) -c -rectypes\n";
print "CAMLOPTC?=$(OCAMLOPT) -c\n"; print "CAMLOPTC?=$(OCAMLOPT) -c -rectypes\n";
print "CAMLLINK?=$(OCAMLC)\n"; print "CAMLLINK?=$(OCAMLC) -rectypes\n";
print "CAMLOPTLINK?=$(OCAMLOPT)\n"; print "CAMLOPTLINK?=$(OCAMLOPT) -rectypes\n";
print "GRAMMARS?=grammar.cma\n"; print "GRAMMARS?=grammar.cma\n";
print "ifeq ($(CAMLP4),camlp5) print "ifeq ($(CAMLP4),camlp5)
CAMLP4EXTEND=pa_extend.cmo q_MLast.cmo pa_macro.cmo CAMLP4EXTEND=pa_extend.cmo q_MLast.cmo pa_macro.cmo
Expand Down Expand Up @@ -610,9 +610,9 @@ let main_targets vfiles (mlifiles,ml4files,mlfiles,mllibfiles,mlpackfiles) other
begin begin
print "mlihtml: $(MLIFILES:.mli=.cmi)\n"; print "mlihtml: $(MLIFILES:.mli=.cmi)\n";
print "\t mkdir $@ || rm -rf $@/*\n"; print "\t mkdir $@ || rm -rf $@/*\n";
print "\t$(OCAMLDOC) -html -d $@ -m A $(ZDEBUG) $(ZFLAGS) $(^:.cmi=.mli)\n\n"; print "\t$(OCAMLDOC) -html -rectypes -d $@ -m A $(ZDEBUG) $(ZFLAGS) $(^:.cmi=.mli)\n\n";
print "all-mli.tex: $(MLIFILES:.mli=.cmi)\n"; print "all-mli.tex: $(MLIFILES:.mli=.cmi)\n";
print "\t$(OCAMLDOC) -latex -o $@ -m A $(ZDEBUG) $(ZFLAGS) $(^:.cmi=.mli)\n\n"; print "\t$(OCAMLDOC) -latex -rectypes -o $@ -m A $(ZDEBUG) $(ZFLAGS) $(^:.cmi=.mli)\n\n";
end; end;
if !some_vfile then if !some_vfile then
begin begin
Expand Down

0 comments on commit 62ce65d

Please sign in to comment.