Protect against use of Core functions that add exception handlers that exit

Summary:
Several Core functions silently wrap argument functions with catch-all
exception handlers that exit.  This diff protects against these from
ever being used by deprecating them, which causes compilation failure if
they are used.

Reviewed By: jvillard

Differential Revision: D4271781

fbshipit-source-id: a096171
master
Josh Berdine 8 years ago committed by Facebook Github Bot
parent 2a8bf53e9e
commit 733e2531b3

@ -25,7 +25,9 @@ module Sys = struct
with Unix.Unix_error _ -> `Unknown
end
include (Core.Std : module type of Core.Std with module Sys := Sys)
include
(Core.Std : module type of Core.Std
with module Sys := Sys)
let ( @ ) = Caml.List.append
@ -34,7 +36,7 @@ let ( @ ) = Caml.List.append
module IntSet = Caml.Set.Make(Int)
(** Compare police: generic compare mostly disabled. *)
(* Compare police: generic compare mostly disabled. *)
let compare = No_polymorphic_compare.compare
let equal = No_polymorphic_compare.equal

@ -0,0 +1,58 @@
(*
* Copyright (c) 2016 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*)
open Core.Std
(* Core's Gc and Signal modules wrap handler functions in catch-all exception handlers that
exit. This defeats the timeout mechanisms. So deprecate the offending functions to cause a
compilation failure if they are used. *)
module Gc : sig
module Expert : sig
module Alarm : sig
include module type of Gc.Expert.Alarm
val create : (unit -> unit) -> t
[@@deprecated "Adds a catch-all exception handler that exits, use [Caml.Gc.create_alarm]"]
end
include module type of Gc.Expert with module Alarm := Alarm
val add_finalizer : 'a Heap_block.t -> ('a Heap_block.t -> unit) -> unit
[@@deprecated "Adds a catch-all exception handler that exits, use [Caml.Gc.finalise]"]
val add_finalizer_exn : 'a -> ('a -> unit) -> unit
[@@deprecated "Adds a catch-all exception handler that exits, use [Caml.Gc.finalise]"]
end
include (module type of Gc with module Expert := Expert)
end
module Signal : sig
module Expert : sig
include module type of Signal.Expert
val signal : Signal.t -> behavior -> behavior
[@@deprecated "Adds a catch-all exception handler that exits, use [Caml.Sys.signal]"]
val set : Signal.t -> behavior -> unit
[@@deprecated "Adds a catch-all exception handler that exits, use [Caml.Sys.set_signal]"]
val handle : Signal.t -> (Signal.t -> unit) -> unit
[@@deprecated "Adds a catch-all exception handler that exits, use [Caml.Sys.set_signal]"]
end
include (module type of Signal with module Expert := Expert)
end
include
(module type of Core.Std
with module Gc := Gc
and module Signal := Signal)
module IntSet : Caml.Set.S with type elt = Int.t
(* Compare police: generic compare mostly disabled. *)
val compare : No_polymorphic_compare.compare
val equal : No_polymorphic_compare.compare
val failwithf : ('a, Format.formatter, unit, 'b) format4 -> 'a
val invalid_argf : ('a, Format.formatter, unit, 'b) format4 -> 'a
Loading…
Cancel
Save