Warnings(3) OCaml library Warnings(3)

# [NAME](#NAME)

Warnings - Warning definitions

# [Module](#Module)

Module Warnings

# [Documentation](#Documentation)

Module **Warnings**  
: **sig end**

Warning definitions

Warning: this module is unstable and part of **Compiler\_libs** .

*type loc* = {  
loc\_start : **Lexing.position** ;  
loc\_end : **Lexing.position** ;  
loc\_ghost : **bool** ;  
}

*type field\_usage\_warning* =  
| Unused  
| Not\_read  
| Not\_mutated

*type constructor\_usage\_warning* =  
| Unused  
| Not\_constructed  
| Only\_exported\_private

*type t* =  
| Comment\_start  
| Comment\_not\_end  
| Fragile\_match **of** **string**  
| Ignored\_partial\_application  
| Labels\_omitted **of** **string list**  
| Method\_override **of** **string list**  
| Partial\_match **of** **string**  
| Missing\_record\_field\_pattern **of** **string**  
| Non\_unit\_statement  
| Redundant\_case  
| Redundant\_subpat  
| Instance\_variable\_override **of** **string list**  
| Illegal\_backslash  
| Implicit\_public\_methods **of** **string list**  
| Unerasable\_optional\_argument  
| Undeclared\_virtual\_method **of** **string**  
| Not\_principal **of** **string**  
| Non\_principal\_labels **of** **string**  
| Ignored\_extra\_argument  
| Nonreturning\_statement  
| Preprocessor **of** **string**  
| Useless\_record\_with  
| Bad\_module\_name **of** **string**  
| All\_clauses\_guarded  
| Unused\_var **of** **string**  
| Unused\_var\_strict **of** **string**  
| Wildcard\_arg\_to\_constant\_constr  
| Eol\_in\_string  
| Duplicate\_definitions **of** **string * string * string * string**  
| Module\_linked\_twice **of** **string * string * string**  
| Unused\_value\_declaration **of** **string**  
| Unused\_open **of** **string**  
| Unused\_type\_declaration **of** **string**  
| Unused\_for\_index **of** **string**  
| Unused\_ancestor **of** **string**  
| Unused\_constructor **of** **string * constructor\_usage\_warning**  
| Unused\_extension **of** **string * bool * constructor\_usage\_warning**  
| Unused\_rec\_flag  
| Name\_out\_of\_scope **of** **string * string list * bool**  
| Ambiguous\_name **of** **string list * string list * bool * string**  
| Disambiguated\_name **of** **string**  
| Nonoptional\_label **of** **string**  
| Open\_shadow\_identifier **of** **string * string**  
| Open\_shadow\_label\_constructor **of** **string * string**  
| Bad\_env\_variable **of** **string * string**  
| Attribute\_payload **of** **string * string**  
| Eliminated\_optional\_arguments **of** **string list**  
| No\_cmi\_file **of** **string * string option**  
| Unexpected\_docstring **of** **bool**  
| Wrong\_tailcall\_expectation **of** **bool**  
| Fragile\_literal\_pattern  
| Misplaced\_attribute **of** **string**  
| Duplicated\_attribute **of** **string**  
| Inlining\_impossible **of** **string**  
| Unreachable\_case  
| Ambiguous\_var\_in\_pattern\_guard **of** **string list**  
| No\_cmx\_file **of** **string**  
| Flambda\_assignment\_to\_non\_mutable\_value  
| Unused\_module **of** **string**  
| Unboxable\_type\_in\_prim\_decl **of** **string**  
| Constraint\_on\_gadt  
| Erroneous\_printed\_signature **of** **string**  
| Unsafe\_array\_syntax\_without\_parsing  
| Redefining\_unit **of** **string**  
| Unused\_open\_bang **of** **string**  
| Unused\_functor\_parameter **of** **string**  
| Match\_on\_mutable\_state\_prevent\_uncurry  
| Unused\_field **of** **string * field\_usage\_warning**  
| Missing\_mli  
| Unused\_tmc\_attribute  
| Tmc\_breaks\_tailcall

*type alert* = {  
kind : **string** ;  
message : **string** ;  
def : **loc** ;  
use : **loc** ;  
}

*val parse\_options* : **bool -&gt; string -&gt; alert option**

*val parse\_alert\_option* : **string -&gt; unit**

Disable/enable alerts based on the parameter to the -alert command-line option. Raises **Arg.Bad** if the string is not a valid specification.

*val without\_warnings* : **(unit -&gt; 'a) -&gt; 'a**

Run the thunk with all warnings and alerts disabled.

*val is\_active* : **t -&gt; bool**

*val is\_error* : **t -&gt; bool**

*val defaults\_w* : **string**

*val defaults\_warn\_error* : **string**

*type reporting\_information* = {  
id : **string** ;  
message : **string** ;  
is\_error : **bool** ;  
sub\_locs : **(loc * string) list** ;  
}

*val report* : **t -&gt; \[ \`Active of reporting\_information | \`Inactive ]**

*val report\_alert* : **alert -&gt; \[ \`Active of reporting\_information | \`Inactive ]**

*exception Errors*

*val check\_fatal* : **unit -&gt; unit**

*val reset\_fatal* : **unit -&gt; unit**

*val help\_warnings* : **unit -&gt; unit**

*type state*

*val backup* : **unit -&gt; state**

*val restore* : **state -&gt; unit**

*val with\_state* : **state -&gt; (unit -&gt; 'a) -&gt; 'a**

*val mk\_lazy* : **(unit -&gt; 'a) -&gt; 'a Lazy.t**

Like **Lazy.of\_fun** , but the function is applied with the warning/alert settings at the time **mk\_lazy** is called.

*type description* = {  
number : **int** ;  
names : **string list** ;  
description : **string** ;  
}

*val descriptions* : **description list**

2026-10-27 OCamldoc

---

Document: Warnings(3o) from ocaml-4 4.14.4-r4 (Chainguard OS)
Source: https://github.com/ocaml/ocaml
