let protect_warning exn =
  match protected exn with
    | Some(src,reason) -> Warning(src,reason)
    | None -> raise exn