Skip to content

Clean up config.ml #7636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Remove unused `-bs-D` and `-bs-list-conditionals` flags. https://github.com/rescript-lang/rescript/pull/7631
- Remove obsolete jsx options. https://github.com/rescript-lang/rescript/pull/7633
- Remove obsolete option `-bs-unsafe-empty-array`. https://github.com/rescript-lang/rescript/pull/7635
- Clean up `config.ml`. https://github.com/rescript-lang/rescript/pull/7636

# 12.0.0-beta.1

Expand Down
16 changes: 6 additions & 10 deletions analysis/src/Shared.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@ let tryReadCmt cmt =
else
match Cmt_format.read_cmt cmt with
| exception Cmi_format.Error err ->
Log.log
("Failed to load " ^ cmt ^ " as a cmt w/ ocaml version " ^ "406"
^ ", error: "
^
(Cmi_format.report_error Format.str_formatter err;
Format.flush_str_formatter ()));
let error_message =
Cmi_format.report_error Format.str_formatter err;
Format.flush_str_formatter ()
in
Log.log ("Invalid cmt format " ^ cmt ^ ": " ^ error_message);
None
| exception err ->
Log.log
("Invalid cmt format " ^ cmt
^ " - probably wrong ocaml version, expected " ^ Config.version ^ " : "
^ Printexc.to_string err);
Log.log ("Invalid cmt format " ^ cmt ^ ": " ^ Printexc.to_string err);
None
| x -> Some x

Expand Down
21 changes: 0 additions & 21 deletions compiler/ext/config.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
let version = "4.06.1+BS"

(* This resolves the location of the standard library starting from the location of bsc.exe,
handling different supported package layouts. *)
let standard_library =
Expand Down Expand Up @@ -31,8 +29,6 @@ let standard_library =
| _ :: _ :: _ :: _ :: rest -> build_path rest ["lib"; "ocaml"]
| _ -> ""

let standard_library_default = standard_library

let cmi_magic_number = "Caml1999I022"

and ast_impl_magic_number = "Caml1999M022"
Expand All @@ -42,20 +38,3 @@ and ast_intf_magic_number = "Caml1999N022"
and cmt_magic_number = "Caml1999T022"

let load_path = ref ([] : string list)

(* This is normally the same as in obj.ml, but we have to define it
separately because it can differ when we're in the middle of a
bootstrapping phase. *)

let print_config oc =
let p name valu = Printf.fprintf oc "%s: %s\n" name valu in
p "version" version;
p "standard_library_default" standard_library_default;
p "standard_library" standard_library;

(* print the magic number *)
p "cmi_magic_number" cmi_magic_number;
p "ast_impl_magic_number" ast_impl_magic_number;
p "ast_intf_magic_number" ast_intf_magic_number;
p "cmt_magic_number" cmt_magic_number;
flush oc
5 changes: 0 additions & 5 deletions compiler/ext/config.mli
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@

(* System configuration *)

val version : string
(* The current version number of the system *)

val standard_library : string
(* The directory containing the standard libraries *)

Expand All @@ -35,5 +32,3 @@ val ast_impl_magic_number : string
(* Magic number for file holding an implementation syntax tree *)
val cmt_magic_number : string
(* Magic number for compiled interface files *)

val print_config : out_channel -> unit