librust: cleanup warnings (except 1)
This commit is contained in:
parent
4e3b196670
commit
229a88217f
|
@ -2192,9 +2192,7 @@ pub fn type_to_str_inner(names: @TypeNames, outer0: &[TypeRef], ty: TypeRef)
|
|||
let out_ty: TypeRef = llvm::LLVMGetReturnType(ty);
|
||||
let n_args = llvm::LLVMCountParamTypes(ty) as uint;
|
||||
let args = vec::from_elem(n_args, 0 as TypeRef);
|
||||
unsafe {
|
||||
llvm::LLVMGetParamTypes(ty, vec::raw::to_ptr(args));
|
||||
}
|
||||
llvm::LLVMGetParamTypes(ty, vec::raw::to_ptr(args));
|
||||
// See [Note at-str]
|
||||
return fmt!("fn(%s) -> %s",
|
||||
tys_str(names, outer, args),
|
||||
|
|
|
@ -204,35 +204,33 @@ fn get_metadata_section(os: os,
|
|||
let si = mk_section_iter(of.llof);
|
||||
while llvm::LLVMIsSectionIteratorAtEnd(of.llof, si.llsi) == False {
|
||||
let name_buf = llvm::LLVMGetSectionName(si.llsi);
|
||||
let name = unsafe { str::raw::from_c_str(name_buf) };
|
||||
let name = str::raw::from_c_str(name_buf);
|
||||
debug!("get_metadata_section: name %s", name);
|
||||
if name == read_meta_section_name(os) {
|
||||
let cbuf = llvm::LLVMGetSectionContents(si.llsi);
|
||||
let csz = llvm::LLVMGetSectionSize(si.llsi) as uint;
|
||||
let mut found = None;
|
||||
unsafe {
|
||||
let cvbuf: *u8 = cast::transmute(cbuf);
|
||||
let vlen = encoder::metadata_encoding_version.len();
|
||||
debug!("checking %u bytes of metadata-version stamp",
|
||||
vlen);
|
||||
let minsz = uint::min(vlen, csz);
|
||||
let mut version_ok = false;
|
||||
do vec::raw::buf_as_slice(cvbuf, minsz) |buf0| {
|
||||
version_ok = (buf0 ==
|
||||
encoder::metadata_encoding_version);
|
||||
}
|
||||
if !version_ok { return None; }
|
||||
let cvbuf: *u8 = cast::transmute(cbuf);
|
||||
let vlen = encoder::metadata_encoding_version.len();
|
||||
debug!("checking %u bytes of metadata-version stamp",
|
||||
vlen);
|
||||
let minsz = uint::min(vlen, csz);
|
||||
let mut version_ok = false;
|
||||
do vec::raw::buf_as_slice(cvbuf, minsz) |buf0| {
|
||||
version_ok = (buf0 ==
|
||||
encoder::metadata_encoding_version);
|
||||
}
|
||||
if !version_ok { return None; }
|
||||
|
||||
let cvbuf1 = ptr::offset(cvbuf, vlen);
|
||||
debug!("inflating %u bytes of compressed metadata",
|
||||
csz - vlen);
|
||||
do vec::raw::buf_as_slice(cvbuf1, csz-vlen) |bytes| {
|
||||
let inflated = flate::inflate_bytes(bytes);
|
||||
found = Some(@(inflated));
|
||||
}
|
||||
if found != None {
|
||||
return found;
|
||||
}
|
||||
let cvbuf1 = ptr::offset(cvbuf, vlen);
|
||||
debug!("inflating %u bytes of compressed metadata",
|
||||
csz - vlen);
|
||||
do vec::raw::buf_as_slice(cvbuf1, csz-vlen) |bytes| {
|
||||
let inflated = flate::inflate_bytes(bytes);
|
||||
found = Some(@(inflated));
|
||||
}
|
||||
if found != None {
|
||||
return found;
|
||||
}
|
||||
}
|
||||
llvm::LLVMMoveToNextSection(si.llsi);
|
||||
|
|
|
@ -3050,7 +3050,7 @@ pub fn write_metadata(cx: &mut CrateContext, crate: &ast::crate) {
|
|||
|
||||
// Writes the current ABI version into the crate.
|
||||
pub fn write_abi_version(ccx: &mut CrateContext) {
|
||||
mk_global(ccx, ~"rust_abi_version", C_uint(ccx, abi::abi_version),
|
||||
mk_global(ccx, "rust_abi_version", C_uint(ccx, abi::abi_version),
|
||||
false);
|
||||
}
|
||||
|
||||
|
|
|
@ -618,13 +618,11 @@ pub fn InBoundsGEP(cx: block, Pointer: ValueRef, Indices: &[ValueRef]) ->
|
|||
ValueRef {
|
||||
unsafe {
|
||||
if cx.unreachable { return llvm::LLVMGetUndef(T_ptr(T_nil())); }
|
||||
unsafe {
|
||||
count_insn(cx, "inboundsgep");
|
||||
count_insn(cx, "inboundsgep");
|
||||
return llvm::LLVMBuildInBoundsGEP(B(cx), Pointer,
|
||||
vec::raw::to_ptr(Indices),
|
||||
Indices.len() as c_uint,
|
||||
noname());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1072,11 +1070,9 @@ pub fn Trap(cx: block) {
|
|||
});
|
||||
assert!((T as int != 0));
|
||||
let Args: ~[ValueRef] = ~[];
|
||||
unsafe {
|
||||
count_insn(cx, "trap");
|
||||
llvm::LLVMBuildCall(b, T, vec::raw::to_ptr(Args),
|
||||
Args.len() as c_uint, noname());
|
||||
}
|
||||
count_insn(cx, "trap");
|
||||
llvm::LLVMBuildCall(b, T, vec::raw::to_ptr(Args),
|
||||
Args.len() as c_uint, noname());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -211,9 +211,7 @@ impl CrateContext {
|
|||
int_type: int_type,
|
||||
float_type: float_type,
|
||||
opaque_vec_type: T_opaque_vec(targ_cfg),
|
||||
builder: BuilderRef_res(unsafe {
|
||||
llvm::LLVMCreateBuilderInContext(llcx)
|
||||
}),
|
||||
builder: BuilderRef_res(llvm::LLVMCreateBuilderInContext(llcx)),
|
||||
shape_cx: mk_ctxt(llmod),
|
||||
crate_map: crate_map,
|
||||
uses_gc: false,
|
||||
|
|
|
@ -242,7 +242,7 @@ fn create_basic_type(cx: @mut CrateContext, t: ty::t, _span: span) -> DIType {
|
|||
ast::ty_f32 => (~"f32", DW_ATE_float),
|
||||
ast::ty_f64 => (~"f64", DW_ATE_float)
|
||||
},
|
||||
_ => cx.sess.bug(~"debuginfo::create_basic_type - t is invalid type")
|
||||
_ => cx.sess.bug("debuginfo::create_basic_type - t is invalid type")
|
||||
};
|
||||
|
||||
let (size, align) = size_and_align_of(cx, t);
|
||||
|
@ -572,7 +572,7 @@ fn create_ty(cx: @mut CrateContext, t: ty::t, span: span) -> DIType {
|
|||
ty::ty_tup(ref elements) => {
|
||||
create_tuple(cx, t, *elements, span)
|
||||
},
|
||||
_ => cx.sess.bug(~"debuginfo: unexpected type in create_ty")
|
||||
_ => cx.sess.bug("debuginfo: unexpected type in create_ty")
|
||||
};
|
||||
|
||||
dbg_cx(cx).created_types.insert(ty_id, ty_md);
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
use core::prelude::*;
|
||||
|
||||
use middle::resolve::Impl;
|
||||
use middle::ty::param_ty;
|
||||
use middle::ty;
|
||||
use middle::typeck::check::{FnCtxt, impl_self_ty};
|
||||
|
@ -27,7 +26,6 @@ use util::ppaux;
|
|||
|
||||
use core::hashmap::HashSet;
|
||||
use core::result;
|
||||
use core::uint;
|
||||
use syntax::ast;
|
||||
use syntax::ast_util;
|
||||
use syntax::codemap::span;
|
||||
|
|
Loading…
Reference in New Issue