Skip to content

Commit

Permalink
librust: cleanup warnings (except 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aatch authored and James Miller committed Jun 20, 2013
1 parent 4e3b196 commit 229a882
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 42 deletions.
4 changes: 1 addition & 3 deletions src/librustc/lib/llvm.rs
Expand Up @@ -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),
Expand Down
44 changes: 21 additions & 23 deletions src/librustc/metadata/loader.rs
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/base.rs
Expand Up @@ -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);
}

Expand Down
12 changes: 4 additions & 8 deletions src/librustc/middle/trans/build.rs
Expand Up @@ -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());
}
}
}

Expand Down Expand Up @@ -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());
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/librustc/middle/trans/context.rs
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/trans/debuginfo.rs
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/middle/typeck/check/vtable.rs
Expand Up @@ -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};
Expand All @@ -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;
Expand Down

0 comments on commit 229a882

Please sign in to comment.