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
34 val ghost_loc_in_file : string -> loc
35
36 Return an empty ghost range located in a given file
37
38
39 type field_usage_warning =
40 | Unused
41 | Not_read
42 | Not_mutated
43
44
45
46
47 type constructor_usage_warning =
48 | Unused
49 | Not_constructed
50 | Only_exported_private
51
52
53
54
55 type t =
56 | Comment_start
57 | Comment_not_end
58 | Fragile_match of string
59 | Ignored_partial_application
60 | Labels_omitted of string list
61 | Method_override of string list
62 | Partial_match of string
63 | Missing_record_field_pattern of string
64 | Non_unit_statement
65 | Redundant_case
66 | Redundant_subpat
67 | Instance_variable_override of string list
68 | Illegal_backslash
69 | Implicit_public_methods of string list
70 | Unerasable_optional_argument
71 | Undeclared_virtual_method of string
72 | Not_principal of string
73 | Non_principal_labels of string
74 | Ignored_extra_argument
75 | Nonreturning_statement
76 | Preprocessor of string
77 | Useless_record_with
78 | Bad_module_name of string
79 | All_clauses_guarded
80 | Unused_var of string
81 | Unused_var_strict of string
82 | Wildcard_arg_to_constant_constr
83 | Eol_in_string
84 | Duplicate_definitions of string * string * string * string
85 | Module_linked_twice of string * string * string
86 | Unused_value_declaration of string
87 | Unused_open of string
88 | Unused_type_declaration of string
89 | Unused_for_index of string
90 | Unused_ancestor of string
91 | Unused_constructor of string * constructor_usage_warning
92 | Unused_extension of string * bool * constructor_usage_warning
93 | Unused_rec_flag
94 | Name_out_of_scope of string * string list * bool
95 | Ambiguous_name of string list * string list * bool * string
96 | Disambiguated_name of string
97 | Nonoptional_label of string
98 | Open_shadow_identifier of string * string
99 | Open_shadow_label_constructor of string * string
100 | Bad_env_variable of string * string
101 | Attribute_payload of string * string
102 | Eliminated_optional_arguments of string list
103 | No_cmi_file of string * string option
104 | Unexpected_docstring of bool
105 | Wrong_tailcall_expectation of bool
106 | Fragile_literal_pattern
107 | Misplaced_attribute of string
108 | Duplicated_attribute of string
109 | Inlining_impossible of string
110 | Unreachable_case
111 | Ambiguous_var_in_pattern_guard of string list
112 | No_cmx_file of string
113 | Flambda_assignment_to_non_mutable_value
114 | Unused_module of string
115 | Unboxable_type_in_prim_decl of string
116 | Constraint_on_gadt
117 | Erroneous_printed_signature of string
118 | Unsafe_array_syntax_without_parsing
119 | Redefining_unit of string
120 | Unused_open_bang of string
121 | Unused_functor_parameter of string
122 | Match_on_mutable_state_prevent_uncurry
123 | Unused_field of string * field_usage_warning
124 | Missing_mli
125 | Unused_tmc_attribute
126 | Tmc_breaks_tailcall
127
128
129
130
131 type alert = {
132 kind : string ;
133 message : string ;
134 def : loc ;
135 use : loc ;
136 }
137
138
139
140
141
142 val parse_options : bool -> string -> alert option
143
144
145
146
147 val parse_alert_option : string -> unit
148
149 Disable/enable alerts based on the parameter to the -alert command-line
150 option. Raises Arg.Bad if the string is not a valid specification.
151
152
153
154 val without_warnings : (unit -> 'a) -> 'a
155
156 Run the thunk with all warnings and alerts disabled.
157
158
159
160 val is_active : t -> bool
161
162
163
164
165 val is_error : t -> bool
166
167
168
169
170 val defaults_w : string
171
172
173
174
175 val defaults_warn_error : string
176
177
178
179 type reporting_information = {
180 id : string ;
181 message : string ;
182 is_error : bool ;
183 sub_locs : (loc * string) list ;
184 }
185
186
187
188
189
190 val report : t -> [ `Active of reporting_information | `Inactive ]
191
192
193
194
195 val report_alert : alert -> [ `Active of reporting_information | `Inac‐
196 tive ]
197
198
199
200
201 exception Errors
202
203
204
205
206
207 val check_fatal : unit -> unit
208
209
210
211
212 val reset_fatal : unit -> unit
213
214
215
216
217 val help_warnings : unit -> unit
218
219
220
221 type state
222
223
224
225
226
227 val backup : unit -> state
228
229
230
231
232 val restore : state -> unit
233
234
235
236
237 val with_state : state -> (unit -> 'a) -> 'a
238
239
240
241
242 val mk_lazy : (unit -> 'a) -> 'a Lazy.t
243
244 Like Lazy.of_fun , but the function is applied with the warning/alert
245 settings at the time mk_lazy is called.
246
247
248 type description = {
249 number : int ;
250 names : string list ;
251 description : string ;
252 since : Sys.ocaml_release_info option ;
253 }
254
255
256
257
258
259 val descriptions : description list
260
261
262
263
264
265
266OCamldoc 2023-07-20 Warnings(3)