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 | Unused_tmc_attribute
120 | Tmc_breaks_tailcall
121
122
123
124
125 type alert = {
126 kind : string ;
127 message : string ;
128 def : loc ;
129 use : loc ;
130 }
131
132
133
134
135
136 val parse_options : bool -> string -> alert option
137
138
139
140
141 val parse_alert_option : string -> unit
142
143 Disable/enable alerts based on the parameter to the -alert command-line
144 option. Raises Arg.Bad if the string is not a valid specification.
145
146
147
148 val without_warnings : (unit -> 'a) -> 'a
149
150 Run the thunk with all warnings and alerts disabled.
151
152
153
154 val is_active : t -> bool
155
156
157
158
159 val is_error : t -> bool
160
161
162
163
164 val defaults_w : string
165
166
167
168
169 val defaults_warn_error : string
170
171
172
173 type reporting_information = {
174 id : string ;
175 message : string ;
176 is_error : bool ;
177 sub_locs : (loc * string) list ;
178 }
179
180
181
182
183
184 val report : t -> [ `Active of reporting_information | `Inactive ]
185
186
187
188
189 val report_alert : alert -> [ `Active of reporting_information | `Inac‐
190 tive ]
191
192
193
194
195 exception Errors
196
197
198
199
200
201 val check_fatal : unit -> unit
202
203
204
205
206 val reset_fatal : unit -> unit
207
208
209
210
211 val help_warnings : unit -> unit
212
213
214
215 type state
216
217
218
219
220
221 val backup : unit -> state
222
223
224
225
226 val restore : state -> unit
227
228
229
230
231 val with_state : state -> (unit -> 'a) -> 'a
232
233
234
235
236 val mk_lazy : (unit -> 'a) -> 'a Lazy.t
237
238 Like Lazy.of_fun , but the function is applied with the warning/alert
239 settings at the time mk_lazy is called.
240
241
242 type description = {
243 number : int ;
244 names : string list ;
245 description : string ;
246 }
247
248
249
250
251
252 val descriptions : description list
253
254
255
256
257
258
259OCamldoc 2022-07-22 Warnings(3)