Skip to content

Commit

Permalink
Resolve conflicts in driver/
Browse files Browse the repository at this point in the history
  • Loading branch information
mshinwell authored and ncik-roberts committed Oct 19, 2023
1 parent bf1835d commit e4c6ddd
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 278 deletions.
20 changes: 6 additions & 14 deletions driver/compenv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,6 @@ let parse_warnings error v =
let read_one_param ppf position name v =
let set name options s = setter ppf (fun b -> b) name options s in
let clear name options s = setter ppf (fun b -> not b) name options s in
<<<<<<< HEAD
let handled =
match !extra_params with
| Some h -> h ppf position name v
| None -> false
in
if not handled then
||||||| merged common ancestors
=======
let compat name s =
let error_if_unset = function
| true -> true
Expand All @@ -260,7 +251,12 @@ let read_one_param ppf position name v =
in
setter ppf error_if_unset name [ ref true ] s
in
>>>>>>> ocaml/5.1
let handled =
match !extra_params with
| Some h -> h ppf position name v
| None -> false
in
if not handled then
match name with
| "g" -> set "g" [ Clflags.debug ] v
| "bin-annot" -> set "bin-annot" [ Clflags.binary_annotations ] v
Expand Down Expand Up @@ -504,14 +500,10 @@ let read_one_param ppf position name v =
end
| "dump-into-file" -> Clflags.dump_into_file := true
| "dump-dir" -> Clflags.dump_dir := Some v
<<<<<<< HEAD

| "extension" -> Language_extension.enable_of_string_exn v
| "disable-all-extensions" ->
if check_bool ppf name v then Language_extension.disallow_extensions ()
||||||| merged common ancestors
=======
>>>>>>> ocaml/5.1

| _ ->
if !warnings_for_discarded_params &&
Expand Down
32 changes: 1 addition & 31 deletions driver/compmisc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,14 @@ let init_path ?(auto_include=auto_include) ?(dir="") () =
!Compenv.first_include_dirs
in
let exp_dirs =
<<<<<<< HEAD
List.map (Misc.expand_directory Config.standard_library) dirs in
Load_path.init (dir :: List.rev_append exp_dirs (Clflags.std_include_dir ()));
Env.reset_cache ~preserve_persistent_env:false
||||||| merged common ancestors
List.map (Misc.expand_directory Config.standard_library) dirs in
Load_path.init (dir :: List.rev_append exp_dirs (Clflags.std_include_dir ()));
Env.reset_cache ()
=======
List.map (Misc.expand_directory Config.standard_library) dirs
in
let dirs =
(if !Clflags.no_cwd then [] else [dir])
@ List.rev_append exp_dirs (Clflags.std_include_dir ())
in
Load_path.init ~auto_include dirs;
Env.reset_cache ()
>>>>>>> ocaml/5.1
Env.reset_cache ~preserve_persistent_env:false

(* Return the initial environment in which compilation proceeds. *)

Expand Down Expand Up @@ -105,13 +95,7 @@ let rec make_directory dir =
Sys.mkdir dir 0o777
end

<<<<<<< HEAD
let with_ppf_dump ?stdout ~file_prefix f =
||||||| merged common ancestors
let with_ppf_dump ~file_prefix f =
=======
let with_ppf_dump ~file_prefix f =
>>>>>>> ocaml/5.1
let with_ch ch =
let ppf = Format.formatter_of_out_channel ch in
ppf,
Expand All @@ -121,26 +105,12 @@ let with_ppf_dump ~file_prefix f =
in
let ppf_dump, finally =
match !Clflags.dump_dir, !Clflags.dump_into_file with
<<<<<<< HEAD
| None, false ->
let formatter =
if Option.is_some stdout then Format.std_formatter
else Format.err_formatter
in
formatter, ignore
||||||| merged common ancestors
if not !Clflags.dump_into_file
then Format.err_formatter, ignore
else
let ch = open_out (file_prefix ^ ".dump") in
let ppf = Format.formatter_of_out_channel ch in
ppf,
(fun () ->
Format.pp_print_flush ppf ();
close_out ch)
=======
| None, false -> Format.err_formatter, ignore
>>>>>>> ocaml/5.1
| None, true -> with_ch (open_out (file_prefix ^ ".dump"))
| Some d, _ ->
let () = make_directory Filename.(dirname @@ concat d @@ file_prefix) in
Expand Down
6 changes: 0 additions & 6 deletions driver/compmisc.mli
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,10 @@ val initial_env : unit -> Env.t
val set_from_env : 'a option ref -> 'a Clflags.env_reader -> unit
val read_clflags_from_env : unit -> unit

<<<<<<< HEAD
val with_ppf_dump : ?stdout:unit ->
file_prefix:string -> (Format.formatter -> 'a) -> 'a
||||||| merged common ancestors
val with_ppf_dump : file_prefix:string -> (Format.formatter -> 'a) -> 'a
=======
val with_ppf_dump : file_prefix:string -> (Format.formatter -> 'a) -> 'a

val auto_include : Load_path.auto_include_callback
(** [auto_include find_in_dir fn] is a callback function to be passed to
{!Load_path.init} and automatically adds [-I +lib] to the load path after
displaying an alert. *)
>>>>>>> ocaml/5.1
100 changes: 10 additions & 90 deletions driver/main_args.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ let mk_annot f =

let mk_binannot f =
"-bin-annot", Arg.Unit f, " Save typedtree in <filename>.cmt"
;;

let mk_binannot_cms f =
"-bin-annot-cms", Arg.Unit f, " Save shapes in <filename>.cms"
Expand Down Expand Up @@ -171,15 +172,8 @@ let mk_inline_toplevel f =

let mk_inlining_report f =
"-inlining-report", Arg.Unit f, " Emit `.<round>.inlining' file(s) (one per \
<<<<<<< HEAD
round) showing the inliner's decisions (Flambda 1 and 2)"
;;
||||||| merged common ancestors
round) showing the inliner's decisions"
;;
=======
round) showing the inliner's decisions"
>>>>>>> ocaml/5.1

let mk_dump_pass f =
"-dump-pass", Arg.String f,
Expand Down Expand Up @@ -212,15 +206,8 @@ let mk_inline_max_unroll f =
let mk_classic_inlining f =
"-Oclassic", Arg.Unit f, " Make inlining decisions at function definition \
time rather than at the call site (replicates previous behaviour of the \
<<<<<<< HEAD
compiler). Implies -linscan (and causes -nolinscan to be ignored)."
;;
||||||| merged common ancestors
compiler)"
;;
=======
compiler)"
>>>>>>> ocaml/5.1

let mk_inline_cost arg descr default f =
Printf.sprintf "-inline-%s-cost" arg,
Expand Down Expand Up @@ -287,6 +274,7 @@ let mk_keep_locs f =

let mk_no_keep_locs f =
"-no-keep-locs", Arg.Unit f, " Do not keep locations in .cmi files"
;;

let mk_probes f =
if Config.probes then
Expand Down Expand Up @@ -495,7 +483,8 @@ let mk_thread f =
" (deprecated) same as -I +threads"

let mk_dtimings f =
"-dtimings", Arg.Unit f, " Print timings information for each pass"
"-dtimings", Arg.Unit f, " Print timings information for each pass";
;;

let mk_dtimings_precision f =
"-dtimings-precision", Arg.Int f,
Expand Down Expand Up @@ -524,18 +513,8 @@ let mk_unboxed_types f =
let mk_no_unboxed_types f =
"-no-unboxed-types", Arg.Unit f,
" unannotated unboxable types will not be unboxed (default)"
<<<<<<< HEAD
;;
||||||| merged common ancestors
;;

let mk_force_tmc f =
"-force-tmc", Arg.Unit f, " Rewrite all possible TMC calls"
;;

=======
>>>>>>> ocaml/5.1

let mk_unsafe f =
"-unsafe", Arg.Unit f,
" Do not compile bounds checking on array and string access"
Expand Down Expand Up @@ -651,10 +630,7 @@ let mk_use_prims f =

let mk_dump_into_file f =
"-dump-into-file", Arg.Unit f, " dump output like -dlambda into <target>.dump"

let mk_dump_dir f =
"-dump-dir", Arg.String f,
"<dir> dump output like -dlambda into <dir>/<target>.dump"
;;

let mk_extension f =
let available_extensions =
Expand Down Expand Up @@ -707,9 +683,7 @@ let mk_dparsetree f =

let mk_dtypedtree f =
"-dtypedtree", Arg.Unit f, " (undocumented)"

let mk_dshape f =
"-dshape", Arg.Unit f, " (undocumented)"
;;

let mk_dshape f =
"-dshape", Arg.Unit f, " (undocumented)"
Expand Down Expand Up @@ -743,54 +717,22 @@ let mk_dclambda f =
"-dclambda", Arg.Unit f, " (undocumented)"

let mk_dflambda f =
<<<<<<< HEAD
"-dflambda", Arg.Unit f, " Print Flambda (1 or 2) terms on exit from Flambda"
;;
||||||| merged common ancestors
"-dflambda", Arg.Unit f, " Print Flambda terms"
;;
=======
"-dflambda", Arg.Unit f, " Print Flambda terms"
>>>>>>> ocaml/5.1

let mk_drawflambda f =
<<<<<<< HEAD
"-drawflambda", Arg.Unit f, " Print Flambda terms after closure conversion\n\
\ (for Flambda 2, after [Lambda_to_flambda])"
;;
||||||| merged common ancestors
"-drawflambda", Arg.Unit f, " Print Flambda terms after closure conversion"
;;
=======
"-drawflambda", Arg.Unit f, " Print Flambda terms after closure conversion"
>>>>>>> ocaml/5.1

let mk_dflambda_invariants f =
<<<<<<< HEAD
"-dflambda-invariants", Arg.Unit f, " Check Flambda (1 and 2) invariants"
;;
||||||| merged common ancestors
"-dflambda-invariants", Arg.Unit f, " Check Flambda invariants \
around each pass"
;;
=======
"-dflambda-invariants", Arg.Unit f, " Check Flambda invariants \
around each pass"
>>>>>>> ocaml/5.1

let mk_dflambda_no_invariants f =
<<<<<<< HEAD
"-dflambda-no-invariants", Arg.Unit f, " Do not check Flambda (1 and 2) \
invariants"
;;
||||||| merged common ancestors
"-dflambda-no-invariants", Arg.Unit f, " Do not Check Flambda invariants \
around each pass"
;;
=======
"-dflambda-no-invariants", Arg.Unit f, " Do not Check Flambda invariants \
around each pass"
>>>>>>> ocaml/5.1

let mk_dflambda_let f =
"-dflambda-let", Arg.Int f, "<stamp> Print when the given Flambda 1 [Let] \
Expand Down Expand Up @@ -858,6 +800,10 @@ let mk_debug_ocaml f =
"-debug-ocaml", Arg.Unit f, " Debugging output for the compiler\n\
(internal use only)"

let mk_debug_ocaml f =
"-debug-ocaml", Arg.Unit f, " Debugging output for the compiler\n\
(internal use only)"

let mk_opaque f =
"-opaque", Arg.Unit f,
" Does not generate cross-module optimization information\n\
Expand Down Expand Up @@ -933,14 +879,9 @@ module type Common_options = sig
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
<<<<<<< HEAD
val _unsafe_string : unit -> unit
val _verbose_types : unit -> unit
val _no_verbose_types : unit -> unit
||||||| merged common ancestors
val _unsafe_string : unit -> unit
=======
>>>>>>> ocaml/5.1
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
Expand Down Expand Up @@ -1286,11 +1227,7 @@ struct
mk_dprofile F._dprofile;
mk_dump_into_file F._dump_into_file;
mk_dump_dir F._dump_dir;
<<<<<<< HEAD
mk_debug_ocaml F._debug_ocaml;
||||||| merged common ancestors
=======
>>>>>>> ocaml/5.1

mk_args F._args;
mk_args0 F._args0;
Expand Down Expand Up @@ -1339,15 +1276,9 @@ struct
mk_unboxed_types F._unboxed_types;
mk_no_unboxed_types F._no_unboxed_types;
mk_unsafe F._unsafe;
<<<<<<< HEAD
mk_unsafe_string F._unsafe_string;
mk_verbose_types F._verbose_types;
mk_no_verbose_types F._no_verbose_types;
||||||| merged common ancestors
mk_unsafe_string F._unsafe_string;
=======
mk_unsafe_string;
>>>>>>> ocaml/5.1
mk_version F._version;
mk__version F._version;
mk_no_version F._no_version;
Expand Down Expand Up @@ -1805,13 +1736,8 @@ module Default = struct
let _strict_formats = set strict_formats
let _strict_sequence = set strict_sequence
let _unboxed_types = set unboxed_types
<<<<<<< HEAD
let _unsafe_string = set unsafe_string
let _verbose_types = set verbose_types
||||||| merged common ancestors
let _unsafe_string = set unsafe_string
=======
>>>>>>> ocaml/5.1
let _w s =
Warnings.parse_options false s |> Option.iter Location.(prerr_alert none)
let _debug_ocaml = set debug_ocaml
Expand Down Expand Up @@ -1959,13 +1885,7 @@ module Default = struct
let _dtimings_precision n = timings_precision := n
let _dump_into_file = set dump_into_file
let _dump_dir s = dump_dir := Some s
<<<<<<< HEAD
let _for_pack s = for_package := (Some (String.capitalize_ascii s))
||||||| merged common ancestors
let _for_pack s = for_package := (Some s)
=======
let _for_pack s = for_package := (Some s)
>>>>>>> ocaml/5.1
let _g = set debug
let _no_g = clear debug
let _i = set print_types
Expand Down
11 changes: 0 additions & 11 deletions driver/main_args.mli
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,9 @@ module type Common_options = sig
val _no_strict_formats : unit -> unit
val _unboxed_types : unit -> unit
val _no_unboxed_types : unit -> unit
<<<<<<< HEAD
val _unsafe_string : unit -> unit
val _verbose_types : unit -> unit
val _no_verbose_types : unit -> unit
||||||| merged common ancestors
val _unsafe_string : unit -> unit
=======
>>>>>>> ocaml/5.1
val _version : unit -> unit
val _vnum : unit -> unit
val _w : string -> unit
Expand Down Expand Up @@ -252,15 +247,9 @@ module type Optcomp_options = sig
val _afl_inst_ratio : int -> unit
val _function_sections : unit -> unit
val _save_ir_after : string -> unit
<<<<<<< HEAD
val _probes : unit -> unit
val _no_probes : unit -> unit
end;;
||||||| merged common ancestors
end;;
=======
end
>>>>>>> ocaml/5.1

module type Opttop_options = sig
include Toplevel_options
Expand Down
Loading

0 comments on commit e4c6ddd

Please sign in to comment.