Skip to content

Commit

Permalink
Enable almost all warnings; fix or suppress them
Browse files Browse the repository at this point in the history
  • Loading branch information
aantron committed Nov 25, 2016
1 parent 996e942 commit dadb926
Show file tree
Hide file tree
Showing 34 changed files with 429 additions and 329 deletions.
6 changes: 6 additions & 0 deletions _tags
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# -*- conf -*-
not <src/ssl/*>: safe_string

# Warnings. The order is important. This is not fully legitimate as it appears
# to depend on how Ocamlbuild internally handles lists of warn() tags.
<src/camlp4/*.ml> or <src/ppx/*.ml>: warn(-4)
<src/camlp4/*.ml>: warn(-3)
<**/*>: warn(+A-29-58)

# Syntax extension
<src/camlp4/*.ml>: syntax(camlp4o)

Expand Down
2 changes: 1 addition & 1 deletion doc/examples/unix/parallelize.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let rec launch () =
| None ->
Lwt.return_unit
| Some line ->
let%lwt exit_status = Lwt_process.exec (Lwt_process.shell line) in
let%lwt _ = Lwt_process.exec (Lwt_process.shell line) in
launch ()

(* Creates the initial <N> threads, where <N> is the number of
Expand Down
2 changes: 0 additions & 2 deletions doc/examples/unix/relay.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

(* Relay data from an address to another. *)

open Lwt.Infix

(* +-----------------------------------------------------------------+
| Relaying |
+-----------------------------------------------------------------+ *)
Expand Down
15 changes: 7 additions & 8 deletions src/camlp4/pa_lwt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
* 02111-1307, USA.
*)

open Camlp4
open Camlp4.PreCast
open Syntax
open! Syntax

(* Generate the catching function from a macth-case.
Expand Down Expand Up @@ -54,9 +53,9 @@ let gen_binding l =
let rec aux n = function
| [] ->
assert false
| [(_loc, p, e)] ->
| [(_loc, _p, e)] ->
<:binding< $lid:"__pa_lwt_" ^ string_of_int n$ = $e$ >>
| (_loc, p, e) :: l ->
| (_loc, _p, e) :: l ->
<:binding< $lid:"__pa_lwt_" ^ string_of_int n$ = $e$ and $aux (n + 1) l$ >>
in
aux 0 l
Expand All @@ -65,7 +64,7 @@ let gen_bind l e =
let rec aux n = function
| [] ->
e
| (_loc, p, e) :: l ->
| (_loc, p, _e) :: l ->
if !Pa_lwt_options.debug then
<:expr< Lwt.backtrace_bind (fun exn -> try raise exn with exn -> exn) $lid:"__pa_lwt_" ^ string_of_int n$ (fun $p$ -> $aux (n + 1) l$) >>
else
Expand All @@ -77,7 +76,7 @@ let gen_top_bind _loc l =
let rec aux n vars = function
| [] ->
<:expr< Lwt.return ($tup:Ast.exCom_of_list (List.rev vars)$) >>
| (_loc, p, e) :: l ->
| (_loc, _p, _e) :: l ->
let id = "__pa_lwt_" ^ string_of_int n in
if !Pa_lwt_options.debug then
<:expr< Lwt.backtrace_bind (fun exn -> try raise exn with exn -> exn) $lid:id$ (fun $lid:id$ -> $aux (n + 1) (<:expr< $lid:id$ >> :: vars) l$) >>
Expand Down Expand Up @@ -209,7 +208,7 @@ EXTEND Gram
>>
| _ ->
<:str_item<
let $tup:Ast.paCom_of_list (List.map (fun (_loc, p, e) -> p) l)$ =
let $tup:Ast.paCom_of_list (List.map (fun (_loc, p, _e) -> p) l)$ =
Lwt_main.run begin
let $gen_binding l$ in
$gen_top_bind _loc l$
Expand All @@ -225,7 +224,7 @@ END
y] if the strict sequence flag is used. *)
let map_anonymous_bind = object
inherit Ast.map as super
method expr e = match super#expr e with
method! expr e = match super#expr e with
| <:expr@_loc< $lid:f$ $a$ $b$ >> when f = ">>" ->
if !Pa_lwt_options.strict_sequence then
<:expr< Lwt.bind $a$ (fun () -> $b$) >>
Expand Down
14 changes: 2 additions & 12 deletions src/camlp4/pa_lwt_log.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ let levels = [
"Debug";
]

let module_name _loc =
let file_name = Loc.file_name _loc in
if file_name = "" then
""
else
String.capitalize (Filename.basename (try
Filename.chop_extension file_name
with Invalid_argument _ ->
file_name))

let rec apply e = function
| [] -> e
| x :: l -> let _loc = Ast.loc_of_expr x in apply <:expr< $e$ $x$ >> l
Expand Down Expand Up @@ -69,7 +59,7 @@ let split e =
`Log(ign, func, section, level, acc)
else
`Not_a_log
| <:expr@loc< $a$ $b$ >> -> begin
| <:expr@_loc< $a$ $b$ >> -> begin
match b with
| <:expr< ~section >> ->
aux `Label (b :: acc) a
Expand All @@ -94,7 +84,7 @@ let map =
object
inherit Ast.map as super

method expr e =
method! expr e =
let _loc = Ast.loc_of_expr e in
match split e with
| `Delete false ->
Expand Down
Loading

0 comments on commit dadb926

Please sign in to comment.