diff options
| -rw-r--r-- | src/comp/metadata/tydecode.rs | 1 | ||||
| -rw-r--r-- | src/comp/metadata/tyencode.rs | 1 | ||||
| -rw-r--r-- | src/comp/middle/trans.rs | 3 | ||||
| -rw-r--r-- | src/comp/syntax/ast.rs | 1 | ||||
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 6 | ||||
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 3 |
6 files changed, 14 insertions, 1 deletions
diff --git a/src/comp/metadata/tydecode.rs b/src/comp/metadata/tydecode.rs index 0e1a01b0e15..710fcc363d8 100644 --- a/src/comp/metadata/tydecode.rs +++ b/src/comp/metadata/tydecode.rs @@ -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); diff --git a/src/comp/metadata/tyencode.rs b/src/comp/metadata/tyencode.rs index 7c3c396ec35..6f6da15a2c6 100644 --- a/src/comp/metadata/tyencode.rs +++ b/src/comp/metadata/tyencode.rs @@ -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, []); } diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index d033c2334a7..a74f358795e 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -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; diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index 6dced2bf32a..87d417d5701 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -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 = diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index b2a89a43ec5..8fa705d6418 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -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); diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index 458af7e9b12..2b0bff104cd 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -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); |
