diff options
author | Florian Angeletti <florian.angeletti@inria.fr> | 2019-09-27 12:16:09 +0200 |
---|---|---|
committer | Florian Angeletti <florian.angeletti@inria.fr> | 2019-09-30 15:56:40 +0200 |
commit | a509157eb975d469db9eb934c96f913e11b4c789 (patch) | |
tree | e51936e7d3a80662560fab55692564addb4f3a5f /tools | |
parent | e6605d6a80855e36c52b205ed13319132c8fd392 (diff) | |
download | ocaml-a509157eb975d469db9eb934c96f913e11b4c789.tar.gz |
share argument implementation across executable
This commit defines five default argument modules in
Main_args.default. Those modules provide a default implementation
for the argument of ocaml, ocamlnat, ocamlc, ocamlopt, ocamldoc,
ocamlcp, ocamloptp, and expect_test.
Grouping together those implementations allow to share as much as
possible similar implementation across executables. It should make
easier to keep synchronized the various implementation, or reuse
those implementation in alternative drivers.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile | 4 | ||||
-rw-r--r-- | tools/ocamlcp.ml | 108 | ||||
-rw-r--r-- | tools/ocamloptp.ml | 139 |
3 files changed, 12 insertions, 239 deletions
diff --git a/tools/Makefile b/tools/Makefile index 1b3014a3ab..2502cb4299 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -121,7 +121,9 @@ $(call byte_and_opt,ocamlprof,$(CSLPROF_IMPORTS) profiling.cmo $(CSLPROF),) ocamlcp_cmos = config.cmo build_path_prefix_map.cmo misc.cmo profile.cmo \ warnings.cmo identifiable.cmo numbers.cmo arg_helper.cmo \ - clflags.cmo main_args.cmo + clflags.cmo \ + terminfo.cmo location.cmo load_path.cmo ccomp.cmo compenv.cmo \ + main_args.cmo $(call byte_and_opt,ocamlcp,$(ocamlcp_cmos) ocamlcp.cmo,) diff --git a/tools/ocamlcp.ml b/tools/ocamlcp.ml index 22e5e028a0..d799fff4ff 100644 --- a/tools/ocamlcp.ml +++ b/tools/ocamlcp.ml @@ -33,106 +33,14 @@ let incompatible o = exit 2 module Options = Main_args.Make_bytecomp_options (struct - let _a () = make_archive := true - let _absname = ignore - let _alert = ignore - let _annot = ignore - let _binannot = ignore - let _c = ignore - let _cc = ignore - let _cclib = ignore - let _ccopt = ignore - let _config = ignore - let _config_var = ignore - let _compat_32 = ignore - let _custom = ignore - let _dllib = ignore - let _dllpath = ignore - let _dtypes = ignore - let _for_pack = ignore - let _g = ignore - let _stop_after = ignore - let _i = ignore - let _I = ignore - let _impl _ = with_impl := true - let _intf _ = with_intf := true - let _intf_suffix = ignore - let _keep_docs = ignore - let _no_keep_docs = ignore - let _keep_locs = ignore - let _no_keep_locs = ignore - let _labels = ignore - let _linkall = ignore - let _make_runtime = ignore - let _alias_deps = ignore - let _no_alias_deps = ignore - let _app_funct = ignore - let _no_app_funct = ignore - let _no_check_prims = ignore - let _noassert = ignore - let _nolabels = ignore - let _noautolink = ignore - let _nostdlib = ignore - let _o = ignore - let _opaque = ignore - let _open = ignore - let _output_obj = ignore - let _output_complete_obj = ignore - let _output_complete_exe = ignore - let _pack = ignore - let _plugin = ignore - let _pp _ = incompatible "-pp" - let _ppx _ = incompatible "-ppx" - let _principal = ignore - let _no_principal = ignore - let _rectypes = ignore - let _no_rectypes = ignore - let _runtime_variant = ignore - let _with_runtime = ignore - let _without_runtime = ignore - let _safe_string = ignore - let _short_paths = ignore - let _strict_sequence = ignore - let _no_strict_sequence = ignore - let _strict_formats = ignore - let _no_strict_formats = ignore - let _thread = ignore - let _vmthread = ignore - let _unboxed_types = ignore - let _no_unboxed_types = ignore - let _unsafe = ignore - let _unsafe_string = ignore - let _use_prims = ignore - let _use_runtime = ignore - let _v = ignore - let _version = ignore - let _vnum = ignore - let _verbose = ignore - let _w = ignore - let _warn_error = ignore - let _warn_help = ignore - let _color = ignore - let _error_style = ignore - let _where = ignore - let _nopervasives = ignore - let _match_context_rows = ignore - let _dump_into_file = ignore - let _dno_unique_ids = ignore - let _dunique_ids = ignore - let _dsource = ignore - let _dparsetree = ignore - let _dtypedtree = ignore - let _drawlambda = ignore - let _dlambda = ignore - let _dflambda = ignore - let _dinstr = ignore - let _dcamlprimc = ignore - let _dtimings = ignore - let _dprofile = ignore - let _args = Arg.read_arg - let _args0 = Arg.read_arg0 - let anonymous = process_file -end);; + include Main_args.Default.Main + let _a () = make_archive := true + let _impl _ = with_impl := true + let _intf _ = with_intf := true + let _pp _ = incompatible "-pp" + let _ppx _ = incompatible "-ppx" + let anonymous = process_file + end);; let rev_compargs = ref ([] : string list) let rev_profargs = ref ([] : string list) diff --git a/tools/ocamloptp.ml b/tools/ocamloptp.ml index 888dbf5b58..9b92d3b0fc 100644 --- a/tools/ocamloptp.ml +++ b/tools/ocamloptp.ml @@ -33,149 +33,12 @@ let incompatible o = exit 2 module Options = Main_args.Make_optcomp_options (struct + include Main_args.Default.Optmain let _a () = make_archive := true - let _absname = ignore - let _afl_instrument = ignore - let _afl_inst_ratio = ignore - let _alert = ignore - let _annot = ignore - let _binannot = ignore - let _c = ignore - let _cc = ignore - let _cclib = ignore - let _ccopt = ignore - let _clambda_checks = ignore - let _compact = ignore - let _config = ignore - let _config_var = ignore - let _for_pack = ignore - let _g = ignore - let _stop_after = ignore - let _i = ignore - let _I = ignore let _impl _ = with_impl := true - let _inline = ignore - let _inline_toplevel = ignore - let _inlining_report = ignore - let _dump_pass = ignore - let _inline_max_depth = ignore - let _rounds = ignore - let _inline_max_unroll = ignore - let _inline_call_cost = ignore - let _inline_alloc_cost = ignore - let _inline_prim_cost = ignore - let _inline_branch_cost = ignore - let _inline_indirect_cost = ignore - let _inline_lifting_benefit = ignore - let _inline_branch_factor = ignore - let _classic_inlining = ignore - let _insn_sched = ignore let _intf _ = with_intf := true - let _intf_suffix = ignore - let _keep_docs = ignore - let _no_keep_docs = ignore - let _keep_locs = ignore - let _no_keep_locs = ignore - let _labels = ignore - let _linkall = ignore - let _alias_deps = ignore - let _no_alias_deps = ignore - let _app_funct = ignore - let _no_app_funct = ignore - let _no_float_const_prop = ignore - let _noassert = ignore - let _noautolink = ignore - let _nodynlink = ignore - let _no_insn_sched = ignore - let _nolabels = ignore - let _nostdlib = ignore - let _no_unbox_free_vars_of_closures = ignore - let _no_unbox_specialised_args = ignore - let _o = ignore - let _o2 = ignore - let _o3 = ignore - let _open = ignore - let _output_obj = ignore - let _output_complete_obj = ignore - let _p = ignore - let _pack = ignore - let _plugin = ignore let _pp _s = incompatible "-pp" let _ppx _s = incompatible "-ppx" - let _principal = ignore - let _no_principal = ignore - let _rectypes = ignore - let _no_rectypes = ignore - let _remove_unused_arguments = ignore - let _runtime_variant = ignore - let _with_runtime = ignore - let _without_runtime = ignore - let _S = ignore - let _safe_string = ignore - let _short_paths = ignore - let _strict_sequence = ignore - let _no_strict_sequence = ignore - let _strict_formats = ignore - let _no_strict_formats = ignore - let _shared = ignore - let _thread = ignore - let _unbox_closures = ignore - let _unbox_closures_factor = ignore - let _unboxed_types = ignore - let _no_unboxed_types = ignore - let _unsafe = ignore - let _unsafe_string = ignore - let _v = ignore - let _version = ignore - let _vnum = ignore - let _verbose = ignore - let _w = ignore - let _warn_error = ignore - let _warn_help = ignore - let _color = ignore - let _error_style = ignore - let _where = ignore - - let _linscan = ignore - let _nopervasives = ignore - let _match_context_rows = ignore - let _dump_into_file = ignore - let _dno_unique_ids = ignore - let _dunique_ids = ignore - let _dsource = ignore - let _dparsetree = ignore - let _dtypedtree = ignore - let _drawlambda = ignore - let _dlambda = ignore - let _drawclambda = ignore - let _dclambda = ignore - let _drawflambda = ignore - let _dflambda = ignore - let _dflambda_invariants = ignore - let _dflambda_no_invariants = ignore - let _dflambda_let = ignore - let _dflambda_verbose = ignore - let _dcmm = ignore - let _dsel = ignore - let _dcombine = ignore - let _dcse = ignore - let _dlive = ignore - let _davail = ignore - let _drunavail = ignore - let _dspill = ignore - let _dsplit = ignore - let _dinterf = ignore - let _dprefer = ignore - let _dalloc = ignore - let _dreload = ignore - let _dscheduling = ignore - let _dlinear = ignore - let _dstartup = ignore - let _dinterval = ignore - let _dtimings = ignore - let _dprofile = ignore - let _opaque = ignore - let _args = Arg.read_arg let _args0 = Arg.read_arg0 let anonymous = process_file |