-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy patharm64-issue-debug-upstream.patch
67 lines (63 loc) · 2.29 KB
/
arm64-issue-debug-upstream.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
diff --git a/driver/compenv.ml b/driver/compenv.ml
index 8b1c4e5559..3e7de2533d 100644
--- a/driver/compenv.ml
+++ b/driver/compenv.ml
@@ -489,6 +489,7 @@ let read_one_param ppf position name v =
let read_OCAMLPARAM ppf position =
try
let s = Sys.getenv "OCAMLPARAM" in
+ Warnings.parsed_ocamlparam := s;
if s <> "" then
let (before, after) =
try
diff --git a/utils/warnings.ml b/utils/warnings.ml
index 895ef2be07..dc7a23b6c9 100644
--- a/utils/warnings.ml
+++ b/utils/warnings.ml
@@ -459,7 +459,10 @@ let name_to_number =
(* Must be the max number returned by the [number] function. *)
-let letter = function
+let parsed_ocamlparam = ref "<not-set>"
+
+(* CR-soon xclerc for xclerc: remove the `for_debug` parameter... *)
+let letter for_debug = function
| 'a' ->
let rec loop i = if i = 0 then [] else i :: loop (i - 1) in
loop last_warning_number
@@ -488,7 +491,9 @@ let letter = function
| 'x' -> [14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 30]
| 'y' -> [26]
| 'z' -> [27]
- | _ -> assert false
+ | chr ->
+ let ocamlparam_from_env = match Sys.getenv_opt "OCAMLPARAM" with None -> "-" | Some value -> value in
+ Misc.fatal_errorf "Warnings.letter %C (for_debug=%S, ocamlparam_from_env=%S ocamlparam_from_compenv=%S)" chr for_debug ocamlparam_from_env !parsed_ocamlparam
;;
type state =
@@ -745,7 +750,7 @@ let parse_opt error active errflag s =
| None -> if c = lc then Clear else Set
| Some m -> m
in
- List.iter (action modifier) (letter lc)
+ List.iter (action modifier) (letter s lc)
| Num(n1,n2,modifier) ->
for n = n1 to Int.min n2 last_warning_number do action modifier n done
in
@@ -1131,7 +1136,7 @@ let help_warnings () =
print_endline " A all warnings";
for i = Char.code 'b' to Char.code 'z' do
let c = Char.chr i in
- match letter c with
+ match letter "<help-warnings>" c with
| [] -> ()
| [n] ->
Printf.printf " %c Alias for warning %i.\n" (Char.uppercase_ascii c) n
diff --git a/utils/warnings.mli b/utils/warnings.mli
index 3d9ea91f38..70d17a9181 100644
--- a/utils/warnings.mli
+++ b/utils/warnings.mli
@@ -161,3 +161,5 @@ type description =
description : string; }
val descriptions : description list
+
+val parsed_ocamlparam : string ref