Interpret extra_disabled_warnings

This commit is contained in:
Jeremie Dimino 2017-02-23 10:43:51 +00:00
parent 0281a95f2c
commit e75f0e4455
3 changed files with 19 additions and 5 deletions

View File

@ -416,8 +416,7 @@ module Library = struct
let t =
record
~ignore:["inline_tests"; "skip_from_default";
"extra_disabled_warnings"; "lint"]
~ignore:["inline_tests"; "skip_from_default"; "lint"]
[ field "name" library_name
; field_o "public_name" string
; field_o "synopsis" string
@ -445,12 +444,14 @@ module Library = struct
; field_osl "flags"
; field_osl "ocamlc_flags"
; field_osl "ocamlopt_flags"
; field "extra_disabled_warnings" (list int) ~default:[]
]
(fun name public_name synopsis install_c_headers libraries ppx_runtime_libraries
modules c_flags cxx_flags c_names cxx_names library_flags c_libraries
c_library_flags preprocess
preprocessor_deps self_build_stubs_archive js_of_ocaml virtual_deps modes
includes kind wrapped optional flags ocamlc_flags ocamlopt_flags ->
includes kind wrapped optional flags ocamlc_flags ocamlopt_flags
extra_disabled_warnings ->
{ name
; public_name
; synopsis
@ -478,7 +479,17 @@ module Library = struct
; virtual_deps
; wrapped
; optional
; flags
; flags =
if Ordered_set_lang.is_standard flags && extra_disabled_warnings <> [] then
Ordered_set_lang.append flags
(Ordered_set_lang.t
(List [ Atom "-w"
; Atom
(String.concat ~sep:""
(List.map extra_disabled_warnings ~f:(sprintf "-%d")))
]))
else
flags
; ocamlc_flags
; ocamlopt_flags
})

View File

@ -55,12 +55,14 @@ let rec map (t : t) ~f =
let standard : t = Atom ":standard"
let append a b = Sexp.List [a; b]
module Unexpanded = struct
type nonrec t = t
let t t = t
let standard = standard
let append a b = Sexp.List [a; b]
let append = append
let files t =
let rec loop acc : t -> _ = function

View File

@ -9,6 +9,7 @@ val t : Sexp.t -> t
val eval_with_standard : t -> standard:string list -> string list
val standard : t
val is_standard : t -> bool
val append : t -> t -> t
(** Map non-variable atoms *)
val map : t -> f:(string -> string) -> t