---
name: "Warnings"
section: "3o"
platform: "linux"
package: "ocaml"
version: "5.5.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Warnings"
---

# Warnings(3o)

Warning definitions

## NAME

Warnings - Warning definitions

## Module

Module   Warnings

## 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** ;\
  }

*val ghost\_loc\_in\_file* :  **string -\> loc**

Return an empty ghost range located in a given file

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

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

*type type\_declaration\_usage\_warning* =\
  \| Declaration\
  \| Alias

*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** **Format\_doc.t**\
  \| 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** **Format\_doc.t**\
  \| 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**\
  \| Unused\_value\_declaration **of** **string**\
  \| Unused\_open **of** **string**\
  \| Unused\_type\_declaration **of** **string \* type\_declaration\_usage\_warning**\
  \| 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\
  \| Generative\_application\_expects\_unit\
  \| Degraded\_to\_partial\_match\
  \| Unnecessarily\_partial\_tuple\_pattern

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

*val parse\_options* :  **bool -\> string -\> alert option**

*val parse\_alert\_option* :  **string -\> 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 -\> 'a) -\> 'a**

Run the thunk with all warnings and alerts disabled.

*val is\_active* :  **t -\> bool**

*val is\_error* :  **t -\> bool**

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

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

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

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

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

*exception Errors*

*val check\_fatal* :  **unit -\> unit**

*val reset\_fatal* :  **unit -\> unit**

*val help\_warnings* :  **unit -\> unit**

*type state*

*val backup* :  **unit -\> state**

*val restore* :  **state -\> unit**

*val with\_state* :  **state -\> (unit -\> 'a) -\> 'a**

*val mk\_lazy* :  **(unit -\> 'a) -\> '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** ;\
  since :  **Sys.ocaml\_release\_info option** ;\
  }

*val descriptions* :  **description list**
