1Warnings(3) OCaml library Warnings(3)
2
3
4
6 Warnings - Warning definitions
7
9 Module Warnings
10
12 Module Warnings
13 : sig end
14
15
16 Warning definitions
17
18 Warning: this module is unstable and part of Compiler_libs .
19
20
21
22
23
24 type loc = {
25 loc_start : Lexing.position ;
26 loc_end : Lexing.position ;
27 loc_ghost : bool ;
28 }
29
30
31
32
33 type field_usage_warning =
34 | Unused
35 | Not_read
36 | Not_mutated
37
38
39
40
41 type constructor_usage_warning =
42 | Unused
43 | Not_constructed
44 | Only_exported_private
45
46
47
48
49 type t =
50 | Comment_start
51 | Comment_not_end
52 | Fragile_match of string
53 | Ignored_partial_application
54 | Labels_omitted of string list
55 | Method_override of string list
56 | Partial_match of string
57 | Missing_record_field_pattern of string
58 | Non_unit_statement
59 | Redundant_case
60 | Redundant_subpat
61 | Instance_variable_override of string list
62 | Illegal_backslash
63 | Implicit_public_methods of string list
64 | Unerasable_optional_argument
65 | Undeclared_virtual_method of string
66 | Not_principal of string
67 | Non_principal_labels of string
68 | Ignored_extra_argument
69 | Nonreturning_statement
70 | Preprocessor of string
71 | Useless_record_with
72 | Bad_module_name of string
73 | All_clauses_guarded
74 | Unused_var of string
75 | Unused_var_strict of string
76 | Wildcard_arg_to_constant_constr
77 | Eol_in_string
78 | Duplicate_definitions of string * string * string * string
79 | Module_linked_twice of string * string * string
80 | Unused_value_declaration of string
81 | Unused_open of string
82 | Unused_type_declaration of string
83 | Unused_for_index of string
84 | Unused_ancestor of string
85 | Unused_constructor of string * constructor_usage_warning
86 | Unused_extension of string * bool * constructor_usage_warning
87 | Unused_rec_flag
88 | Name_out_of_scope of string * string list * bool
89 | Ambiguous_name of string list * string list * bool * string
90 | Disambiguated_name of string
91 | Nonoptional_label of string
92 | Open_shadow_identifier of string * string
93 | Open_shadow_label_constructor of string * string
94 | Bad_env_variable of string * string
95 | Attribute_payload of string * string
96 | Eliminated_optional_arguments of string list
97 | No_cmi_file of string * string option
98 | Unexpected_docstring of bool
99 | Wrong_tailcall_expectation of bool
100 | Fragile_literal_pattern
101 | Misplaced_attribute of string
102 | Duplicated_attribute of string
103 | Inlining_impossible of string
104 | Unreachable_case
105 | Ambiguous_var_in_pattern_guard of string list
106 | No_cmx_file of string
107 | Flambda_assignment_to_non_mutable_value
108 | Unused_module of string
109 | Unboxable_type_in_prim_decl of string
110 | Constraint_on_gadt
111 | Erroneous_printed_signature of string
112 | Unsafe_array_syntax_without_parsing
113 | Redefining_unit of string
114 | Unused_open_bang of string
115 | Unused_functor_parameter of string
116 | Match_on_mutable_state_prevent_uncurry
117 | Unused_field of string * field_usage_warning
118 | Missing_mli
119
120
121
122
123 type alert = {
124 kind : string ;
125 message : string ;
126 def : loc ;
127 use : loc ;
128 }
129
130
131
132
133
134 val parse_options : bool -> string -> alert option
135
136
137
138
139 val parse_alert_option : string -> unit
140
141 Disable/enable alerts based on the parameter to the -alert command-line
142 option. Raises Arg.Bad if the string is not a valid specification.
143
144
145
146 val without_warnings : (unit -> 'a) -> 'a
147
148 Run the thunk with all warnings and alerts disabled.
149
150
151
152 val is_active : t -> bool
153
154
155
156
157 val is_error : t -> bool
158
159
160
161
162 val defaults_w : string
163
164
165
166
167 val defaults_warn_error : string
168
169
170
171 type reporting_information = {
172 id : string ;
173 message : string ;
174 is_error : bool ;
175 sub_locs : (loc * string) list ;
176 }
177
178
179
180
181
182 val report : t -> [ `Active of reporting_information | `Inactive ]
183
184
185
186
187 val report_alert : alert -> [ `Active of reporting_information | `Inac‐
188 tive ]
189
190
191
192
193 exception Errors
194
195
196
197
198
199 val check_fatal : unit -> unit
200
201
202
203
204 val reset_fatal : unit -> unit
205
206
207
208
209 val help_warnings : unit -> unit
210
211
212
213 type state
214
215
216
217
218
219 val backup : unit -> state
220
221
222
223
224 val restore : state -> unit
225
226
227
228
229 val mk_lazy : (unit -> 'a) -> 'a Lazy.t
230
231 Like Lazy.of_fun , but the function is applied with the warning/alert
232 settings at the time mk_lazy is called.
233
234
235
236
237
238OCamldoc 2022-02-04 Warnings(3)