Permalink
Browse files

silenced warnings from ours deprecations (#885)

* silenced warnings from ours deprecations

This PR silences warnings from bap code during compilation of
bap itself. Also, it turned out that few modules in `bap.mli`
were deprecated in a way that doesn't emit warnings at all:

Just for the record, the next doesn't deprecate `module A`,
because according to the documentation for attributes of level 3:
> They are not attached to any specific node in the syntax tree

```
module A = struct
  [@@@deprecated "[since ...]"]
  ...
end
```

And the next works as expected, although in this case we have
do the deprecation in the end of module, which makes it less
readable. But anyway, looks like we don't have any other choice.

```
module A = struct
  ...
end [@@deprecated "[since ...]"]
```

* fixed the documentation
  • Loading branch information...
gitoleg committed Oct 6, 2018
1 parent 1e9ac45 commit c080b918984807a621320f5ea200985173a52da0
@@ -7,6 +7,8 @@ open Graphlib.Std
open Bap_future.Std
module Std : sig
[@@@warning "-D"]
(** {2 Overview}
{3 Layered Architecture}
@@ -616,12 +618,11 @@ module Std : sig
module Make(T : Base) : S with type t = T.t
end
(**/**)
(** Legacy
@deprecated Definitions in this module are deprecated
**)
module Legacy : sig
[@@@deprecated "[since 2018-03] Definitions in this module are deprecated"]
module Monad : sig
[@@@deprecated
"[since 2018-03] The module is deprecated in favor of new monads library"]
open Core_kernel.Std
module type Basic = Monad.Basic
module type Basic2 = Monad.Basic2
@@ -665,7 +666,10 @@ module Std : sig
end
end
end
[@@deprecated
"[since 2018-03] The module is deprecated in favor of new monads library"]
end
[@@deprecated "[since 2018-03] Definitions in this module are deprecated"]
(**/**)
@@ -2240,7 +2244,7 @@ module Std : sig
end
(** Result of a computation.
@deprecated Use the Primus Framework.
@deprecated Use the Primus Framework.
*)
type result
[@@deprecated "[since 2018-03] in favor of the Primus Framework"]
@@ -2256,7 +2260,6 @@ module Std : sig
Bili.
@deprecated Use the Primus Framework.
*)
class type storage = object('s)
@@ -2268,10 +2271,10 @@ module Std : sig
end
[@@deprecated "[since 2018-03] in favor of the Primus Framework"]
(** Predefined storage classes *)
(** Predefined storage classes
@deprecated Use the Primus Framework
*)
module Storage : sig
[@@@deprecated "[since 2018-03] in favor of the Primus Framework"]
[@@@warning "-D"]
(** linear storage literally implements operational
semantics, but has O(N) lookup and uses space
@@ -2285,6 +2288,8 @@ module Std : sig
update method. *)
class sparse : storage
end
[@@deprecated "[since 2018-03] in favor of the Primus Framework"]
(** Value of a result.
We slightly diverge from an operational semantics by allowing
@@ -2342,8 +2347,6 @@ module Std : sig
@deprecated Use the Primus Framework
*)
module Result : sig
[@@@deprecated "[since 2018-03] in favor of the Primus Framework"]
[@@@warning "-D"]
(** result identifier *)
type id
@@ -2389,6 +2392,7 @@ module Std : sig
module Value : Printable.S with type t = value
include Printable.S with type t := t
end
[@@deprecated "[since 2018-03] in favor of the Primus Framework"]
(** Tries on BIL.
@@ -2694,8 +2698,6 @@ module Std : sig
@deprecated Use the Primus Framework
*)
module Context : sig
[@@@deprecated "[since 2018-03] in favor of the Primus Framework"]
[@@@warning "-D"]
class t : object('s)
@@ -2711,7 +2713,7 @@ module Std : sig
for debugging and introspection. *)
method bindings : (var * Bil.result) seq
end
end
end [@@deprecated "[since 2018-03] in favor of the Primus Framework"]
module Type_error : module type of Type.Error with type t = Type.Error.t
@@ -2862,8 +2864,6 @@ module Std : sig
@deprecated Use the Primus Framework
*)
module Expi : sig
[@@@deprecated "[since 2018-03] in favor of the Primus Framework"]
[@@@warning "-D"]
open Bil.Result
(**
@@ -3064,9 +3064,11 @@ module Std : sig
with type ('a,'e) state = ('a,'e) M.t
include S with type ('a,'e) state = ('a,'e) Monad.State.t
end
end [@@deprecated "[since 2018-03] in favor of the Primus Framework"]
(** Expression {{!Expi}interpreter} *)
(** Expression {{!Expi}interpreter}
@deprecated Use the Primus Framework
*)
class ['a] expi : ['a] Expi.t
[@@deprecated "[since 2018-03] in favor of the Primus Framework"]
@@ -3089,10 +3091,10 @@ module Std : sig
ctxt#bindings |> Seq.to_list;;
- : (var * Bil.result) list = [(x, [0x1] false)]
v}
@deprecated Use the Primus Framework
*)
module Bili : sig
[@@@deprecated "[since 2018-03] in favor of the Primus Framework"]
[@@@warning "-D"]
open Bil.Result
@@ -3128,9 +3130,12 @@ module Std : sig
module Make(M : Monad.State.S2) : S with type ('a,'e) state = ('a,'e) M.t
include S with type ('a,'e) state = ('a,'e) Monad.State.t
end
end [@@deprecated "[since 2018-03] in favor of the Primus Framework"]
(** BIL {{!Bili}interpreter} *)
(** BIL {{!Bili}interpreter}
@deprecated Use the Primus Framework
*)
class ['a] bili : ['a] Bili.t
[@@deprecated "[since 2018-03] in favor of the Primus Framework"]
@@ -3507,7 +3512,6 @@ module Std : sig
(** [eval x] evaluate expression [x] to a value. *)
val eval : t -> Bil.value
[@@warning "-D"]
include Regular.S with type t := t
val pp_adt : t printer
@@ -4377,9 +4381,6 @@ module Std : sig
@deprecated Use the Primus Framework.
*)
module Biri : sig
[@@@deprecated "[since 2018-03] in favor of the Primus Framework"]
[@@@warning "-D"]
open Bil.Result
(** Biri evaluates terms in the context of a whole program (since
@@ -4507,10 +4508,14 @@ module Std : sig
S with type ('a,'e) state = ('a,'e) M.t
include S with type ('a,'e) state = ('a,'e) Monad.State.t
end
end [@@deprecated "[since 2018-03] in favor of the Primus Framework"]
(** BIR {{!Biri}interpreter} *)
(** BIR {{!Biri}interpreter}
@deprecated Use the Primus Framework
*)
class ['a] biri : ['a] Biri.t
[@@deprecated "[since 2018-03] in favor of the Primus Framework"]
(** {3 Some predefined tags} *)
@@ -5104,10 +5109,11 @@ module Std : sig
This interface must be implemented by a backend plugin, and
registered with [Image.register] function in order to be
accessible for loading images.*)
accessible for loading images.
@deprecated Use new Ogre-powered loader interface
*)
module Backend : sig
[@@@deprecated "[since 2017-08] Use new loader Ogre-powered loader interface"]
(** memory access permissions *)
type perm = R | W | X | Or of perm * perm
@@ -5156,7 +5162,7 @@ module Std : sig
(** the actual interface to be implemented *)
type t = Bigstring.t -> Img.t option
end
end [@@deprecated "[since 2017-08] Use new Ogre-powered loader interface"]
(** Binary Image. *)
module Image : sig
@@ -5331,7 +5337,9 @@ module Std : sig
val available_backends : unit -> string list
(** [register_backend ~name backend] tries to register [backend] under
the specified [name]. *)
the specified [name].
@deprecated use register_loader instead
*)
val register_backend : name:string -> Backend.t -> [ `Ok | `Duplicate ]
[@@deprecated "[since 2017-07] use register_loader instead"]
@@ -7713,10 +7721,12 @@ module Std : sig
We represent a taint with a term identifier, to designate that a
taint was produced by a term with the given id. A taint set is
usually associated with each variable of a given term. This set
defines a set of taints with which a variable is tainted.*)
defines a set of taints with which a variable is tainted.
@deprecated use the Bap Taint Framework
*)
module Taint : sig
[@@@deprecated "[since 2018-03] use the Bap Taint Framework instead"]
[@@@warning "-D"]
type t = tid
type set = Tid.Set.t [@@deriving bin_io, compare, sexp]
@@ -7843,7 +7853,7 @@ module Std : sig
val pp_map : map printer
module Map : Regular.S with type t = map
end
end [@@deprecated "[since 2018-03] use the Bap Taint Framework instead"]
type 'a source = 'a Source.t
@@ -1,6 +1,7 @@
open Core_kernel.Std
open Bap.Std
[@@@warning "-D"]
exception Parse_error of string
@@ -1,9 +1,10 @@
open Core_kernel.Std
open Bap.Std
open Monads.Std
open Bap_llvm_binary
[@@@warning "-D"]
let make_addr arch addr =
match Arch.addr_size arch with
| `r32 -> Addr.of_int64 ~width:32 addr
@@ -6,7 +6,6 @@ open Bap_future.Std
open Bap_strings.Std
module Std : sig
(** Primus - The Microexecution Framework.
@@ -57,6 +56,8 @@ module Std : sig
it can modify other components (depending on their interface).
*)
[@@@warning "-D"]
module Primus : sig
(** Machine Exception.
@@ -5,6 +5,8 @@ open Monads.Std
module SM = Monad.State
open SM.Monad_infix
[@@@warning "-D"]
type policy = [`Random | `Fixed of int64 | `Interval of int64 * int64 ]
[@@deriving sexp_of]
@@ -22,8 +24,10 @@ class ['a] main
?random_seed
?(reg_policy=`Random)
?(mem_policy=`Random) () =
object(self)
inherit ['a] expi as super
initializer Option.iter random_seed ~f:Random.init
method! eval_unknown _ t = self#emit reg_policy t
@@ -1,5 +1,7 @@
open Bap.Std
[@@@warning "-D"]
type policy = [
| `Random
| `Fixed of int64 | `Interval of int64 * int64 ]
@@ -32,6 +32,8 @@ let merge_visited = Map.merge ~f:(fun ~key -> function
class context
?(max_steps=Int.max_value)
?(max_loop= min 10 (max_steps / 10)) p = object(self : 's)
[@@@warning "-D"]
inherit Biri.context p
val blk : blk term option = None
@@ -117,6 +119,7 @@ end
class ['a] main ?(deterministic=false) p =
object(self)
constraint 'a = #context
[@@@warning "-D"]
inherit ['a] Biri.t as super
method! enter_term cls t =
@@ -17,6 +17,7 @@ class context :
?max_steps:int ->
?max_loop:int ->
program term -> object('s)
[@@@warning "-D"]
inherit Biri.context
method visited : int Tid.Map.t
@@ -2,8 +2,9 @@ open Core_kernel.Std
open OUnit2
open Or_error
open Word_size
open Bap.Std
[@@@warning "-D"]
open Backend
let ident = Int64.of_int
@@ -90,6 +91,7 @@ let () = List.iter ~f:(fun (name,backend) ->
| `Ok -> ()
| `Duplicate -> failwith name)
backends
[@@warning "-D"]
let print_list r =
let sexp_of_addr_list = sexp_of_list sexp_of_addr in
@@ -34,12 +34,13 @@ let printer = function
let assert_exp value exp ctxt =
assert_equal ~ctxt ~printer value (Exp.eval exp)
let assert_prg value prg ctxt =
let assert_prg value prg ctxt =
let open Monad.State.Monad_infix in
let bili = new bili in
assert_equal ~ctxt ~printer value @@
let res = bili#eval prg >>= fun () -> bili#lookup r >>| Bil.Result.value in
Monad.State.eval res (new Bili.context)
[@@warning "-D"]
let suite () =
"Bili" >::: [
@@ -2,6 +2,8 @@ open Core_kernel
open OUnit2
open Bap.Std
[@@@warning "-D"]
let width = 8
let typ = Type.imm width
let int x = Bil.int (Word.of_int ~width x)
@@ -2,6 +2,8 @@ open Core_kernel.Std
open Bap.Std
open OUnit2
[@@@warning "-D"]
module Dis = Disasm_expert.Basic
module type Bitwidth = sig
Oops, something went wrong.

0 comments on commit c080b91

Please sign in to comment.