Module Builtin_attributes

module Builtin_attributes: sig .. end

Support for some of the builtin attributes

  • ocaml.deprecated
  • ocaml.alert
  • ocaml.error
  • ocaml.ppwarning
  • ocaml.warning
  • ocaml.warnerror
  • ocaml.explicit_arity (for camlp4/camlp5)
  • ocaml.warn_on_literal_pattern
  • ocaml.deprecated_mutable
  • ocaml.immediate
  • ocaml.immediate64
  • ocaml.boxed / ocaml.unboxed

Warning: this module is unstable and part of compiler-libs.


let check_alerts: (Location.t, Parsetree.attributes, string) => unit;
let check_alerts_inclusion:
  (
    ~def: Location.t,
    ~use: Location.t,
    Location.t,
    Parsetree.attributes,
    Parsetree.attributes,
    string
  ) =>
  unit;
let alerts_of_attrs: Parsetree.attributes => Misc.alerts;
let alerts_of_sig: Parsetree.signature => Misc.alerts;
let alerts_of_str: Parsetree.structure => Misc.alerts;
let check_deprecated_mutable:
  (Location.t, Parsetree.attributes, string) => unit;
let check_deprecated_mutable_inclusion:
  (
    ~def: Location.t,
    ~use: Location.t,
    Location.t,
    Parsetree.attributes,
    Parsetree.attributes,
    string
  ) =>
  unit;
let check_no_alert: Parsetree.attributes => unit;
let error_of_extension: Parsetree.extension => Location.error;
let warning_attribute: (~ppwarning: bool=?, Parsetree.attribute) => unit;

Apply warning settings from the specified attribute. "ocaml.warning"/"ocaml.warnerror" (and variants without the prefix) are processed and other attributes are ignored.

Also implement ocaml.ppwarning (unless ~ppwarning:false is passed).

let warning_scope:
  (~ppwarning: bool=?, Parsetree.attributes, unit => 'a) => 'a;

Execute a function in a new scope for warning settings. This means that the effect of any call to warning_attribute during the execution of this function will be discarded after execution.

The function also takes a list of attributes which are processed with warning_attribute in the fresh scope before the function is executed.

let warn_on_literal_pattern: Parsetree.attributes => bool;
let explicit_arity: Parsetree.attributes => bool;
let immediate: Parsetree.attributes => bool;
let immediate64: Parsetree.attributes => bool;
let has_unboxed: Parsetree.attributes => bool;
let has_boxed: Parsetree.attributes => bool;