rustc: Add a new "C stack cdecl" native ABI
This commit is contained in:
parent
657e3ffaf5
commit
f7d0c1cec3
6 changed files with 14 additions and 1 deletions
|
@ -263,6 +263,7 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
|
|||
'c' { abi = ast::native_abi_cdecl; }
|
||||
'l' { abi = ast::native_abi_llvm; }
|
||||
's' { abi = ast::native_abi_x86stdcall; }
|
||||
'C' { abi = ast::native_abi_c_stack_cdecl; }
|
||||
}
|
||||
let func = parse_ty_fn(st, sd);
|
||||
ret ty::mk_native_fn(st.tcx, abi, func.args, func.ty);
|
||||
|
|
|
@ -147,6 +147,7 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
|
|||
native_abi_cdecl. { w.write_char('c'); }
|
||||
native_abi_llvm. { w.write_char('l'); }
|
||||
native_abi_x86stdcall. { w.write_char('s'); }
|
||||
native_abi_c_stack_cdecl. { w.write_char('C'); }
|
||||
}
|
||||
enc_ty_fn(w, cx, args, out, return_val, []);
|
||||
}
|
||||
|
|
|
@ -5715,6 +5715,9 @@ fn register_native_fn(ccx: @crate_ctxt, sp: span, path: [str], name: str,
|
|||
uses_retptr = false;
|
||||
cast_to_i32 = true;
|
||||
}
|
||||
ast::native_abi_c_stack_cdecl. {
|
||||
fail "C stack cdecl ABI shouldn't have a wrapper";
|
||||
}
|
||||
}
|
||||
|
||||
let lltaskptr;
|
||||
|
|
|
@ -419,6 +419,7 @@ tag native_abi {
|
|||
native_abi_llvm;
|
||||
native_abi_rust_intrinsic;
|
||||
native_abi_x86stdcall;
|
||||
native_abi_c_stack_cdecl;
|
||||
}
|
||||
|
||||
type native_mod =
|
||||
|
|
|
@ -2012,7 +2012,11 @@ fn parse_item_native_mod(p: parser, attrs: [ast::attribute]) -> @ast::item {
|
|||
abi = ast::native_abi_rust_intrinsic;
|
||||
} else if str::eq(t, "x86stdcall") {
|
||||
abi = ast::native_abi_x86stdcall;
|
||||
} else { p.fatal("unsupported abi: " + t); }
|
||||
} else if str::eq(t, "c-stack-cdecl") {
|
||||
abi = ast::native_abi_c_stack_cdecl;
|
||||
} else {
|
||||
p.fatal("unsupported abi: " + t);
|
||||
}
|
||||
}
|
||||
expect_word(p, "mod");
|
||||
let id = parse_ident(p);
|
||||
|
|
|
@ -408,6 +408,9 @@ fn print_item(s: ps, item: @ast::item) {
|
|||
word_nbsp(s, "\"rust-intrinsic\"");
|
||||
}
|
||||
ast::native_abi_x86stdcall. { word_nbsp(s, "\"x86stdcall\""); }
|
||||
ast::native_abi_c_stack_cdecl. {
|
||||
word_nbsp(s, "\"c-stack-cdecl\"");
|
||||
}
|
||||
}
|
||||
word_nbsp(s, "mod");
|
||||
word_nbsp(s, item.ident);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue