1
Fork 0

librustc: Remove "extern mod { ... }" from librustc, librustdoc, and tests. rs=deexterning

This commit is contained in:
Patrick Walton 2013-03-05 14:42:58 -08:00
parent 87e44af2f2
commit 6b5d1afeec
62 changed files with 1594 additions and 1338 deletions

View file

@ -1139,8 +1139,8 @@ pub mod funcs {
unsafe fn strxfrm(s: *c_char, ct: *c_char, n: size_t)
-> size_t;
// These are fine to execute on the Rust stack. They must be, in
// fact, because LLVM generates calls to them!
// These are fine to execute on the Rust stack. They must be,
// in fact, because LLVM generates calls to them!
#[rust_stack]
#[inline(always)]
unsafe fn memcpy(s: *c_void, ct: *c_void, n: size_t)

View file

@ -94,11 +94,13 @@ pub mod jit {
use core::ptr;
use core::str;
pub mod rusti {
#[nolink]
#[abi = "rust-intrinsic"]
pub extern mod rusti {
pub extern {
pub fn morestack_addr() -> *();
}
}
pub struct Closure {
code: *(),

View file

@ -122,9 +122,13 @@ pub mod intrinsic {
fn visit_closure_ptr(&self, ck: uint) -> bool;
}
pub mod rusti {
use super::{TyDesc, TyVisitor};
#[abi = "rust-intrinsic"]
pub extern mod rusti {
pub extern {
pub fn get_tydesc<T>() -> *();
pub fn visit_tydesc(++td: *TyDesc, &&tv: TyVisitor);
}
}
}

View file

@ -216,10 +216,19 @@ pub type ObjectFileRef = *ObjectFile_opaque;
pub enum SectionIterator_opaque {}
pub type SectionIteratorRef = *SectionIterator_opaque;
#[link_args = "-Lrustllvm"]
#[link_name = "rustllvm"]
#[abi = "cdecl"]
pub extern mod llvm {
pub mod llvm {
use super::{AtomicBinOp, AtomicOrdering, BasicBlockRef, Bool, BuilderRef};
use super::{ContextRef, MemoryBufferRef, ModuleRef, ObjectFileRef};
use super::{Opcode, PassManagerRef, PassManagerBuilderRef};
use super::{SectionIteratorRef, TargetDataRef, TypeKind, TypeRef, UseRef};
use super::{ValueRef};
use core::libc::{c_char, c_int, c_longlong, c_uint, c_ulonglong};
#[link_args = "-Lrustllvm -lrustllvm"]
#[link_name = "rustllvm"]
#[abi = "cdecl"]
pub extern {
/* Create and destroy contexts. */
pub unsafe fn LLVMContextCreate() -> ContextRef;
pub unsafe fn LLVMGetGlobalContext() -> ContextRef;
@ -287,8 +296,11 @@ pub extern mod llvm {
pub unsafe fn LLVMPPCFP128Type() -> TypeRef;
/* Operations on function types */
pub unsafe fn LLVMFunctionType(ReturnType: TypeRef, ParamTypes: *TypeRef,
ParamCount: c_uint, IsVarArg: Bool) -> TypeRef;
pub unsafe fn LLVMFunctionType(ReturnType: TypeRef,
ParamTypes: *TypeRef,
ParamCount: c_uint,
IsVarArg: Bool)
-> TypeRef;
pub unsafe fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool;
pub unsafe fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
pub unsafe fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
@ -299,9 +311,12 @@ pub extern mod llvm {
ElementTypes: *TypeRef,
ElementCount: c_uint,
Packed: Bool) -> TypeRef;
pub unsafe fn LLVMStructType(ElementTypes: *TypeRef, ElementCount: c_uint,
Packed: Bool) -> TypeRef;
pub unsafe fn LLVMCountStructElementTypes(StructTy: TypeRef) -> c_uint;
pub unsafe fn LLVMStructType(ElementTypes: *TypeRef,
ElementCount: c_uint,
Packed: Bool)
-> TypeRef;
pub unsafe fn LLVMCountStructElementTypes(StructTy: TypeRef)
-> c_uint;
pub unsafe fn LLVMGetStructElementTypes(StructTy: TypeRef,
Dest: *mut TypeRef);
pub unsafe fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
@ -316,7 +331,8 @@ pub extern mod llvm {
pub unsafe fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
pub unsafe fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
pub unsafe fn LLVMGetPointerAddressSpace(PointerTy: TypeRef) -> c_uint;
pub unsafe fn LLVMGetPointerAddressSpace(PointerTy: TypeRef)
-> c_uint;
pub unsafe fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
/* Operations on other types */
@ -333,9 +349,11 @@ pub extern mod llvm {
pub unsafe fn LLVMGetValueName(Val: ValueRef) -> *c_char;
pub unsafe fn LLVMSetValueName(Val: ValueRef, Name: *c_char);
pub unsafe fn LLVMDumpValue(Val: ValueRef);
pub unsafe fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
pub unsafe fn LLVMReplaceAllUsesWith(OldVal: ValueRef,
NewVal: ValueRef);
pub unsafe fn LLVMHasMetadata(Val: ValueRef) -> c_int;
pub unsafe fn LLVMGetMetadata(Val: ValueRef, KindID: c_uint) -> ValueRef;
pub unsafe fn LLVMGetMetadata(Val: ValueRef, KindID: c_uint)
-> ValueRef;
pub unsafe fn LLVMSetMetadata(Val: ValueRef,
KindID: c_uint,
Node: ValueRef);
@ -348,8 +366,11 @@ pub extern mod llvm {
/* Operations on Users */
pub unsafe fn LLVMGetNumOperands(Val: ValueRef) -> c_int;
pub unsafe fn LLVMGetOperand(Val: ValueRef, Index: c_uint) -> ValueRef;
pub unsafe fn LLVMSetOperand(Val: ValueRef, Index: c_uint, Op: ValueRef);
pub unsafe fn LLVMGetOperand(Val: ValueRef, Index: c_uint)
-> ValueRef;
pub unsafe fn LLVMSetOperand(Val: ValueRef,
Index: c_uint,
Op: ValueRef);
/* Operations on constants of any type */
pub unsafe fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
@ -385,15 +406,19 @@ pub extern mod llvm {
Text: *c_char,
Radix: u8)
-> ValueRef;
pub unsafe fn LLVMConstIntOfStringAndSize(IntTy: TypeRef, Text: *c_char,
pub unsafe fn LLVMConstIntOfStringAndSize(IntTy: TypeRef,
Text: *c_char,
SLen: c_uint,
Radix: u8) -> ValueRef;
Radix: u8)
-> ValueRef;
pub unsafe fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef;
pub unsafe fn LLVMConstRealOfString(RealTy: TypeRef,
Text: *c_char)
-> ValueRef;
pub unsafe fn LLVMConstRealOfStringAndSize(RealTy: TypeRef, Text: *c_char,
SLen: c_uint) -> ValueRef;
pub unsafe fn LLVMConstRealOfStringAndSize(RealTy: TypeRef,
Text: *c_char,
SLen: c_uint)
-> ValueRef;
pub unsafe fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef)
-> c_ulonglong;
pub unsafe fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef)
@ -561,8 +586,10 @@ pub extern mod llvm {
pub unsafe fn LLVMConstPointerCast(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
pub unsafe fn LLVMConstIntCast(ConstantVal: ValueRef, ToType: TypeRef,
isSigned: Bool) -> ValueRef;
pub unsafe fn LLVMConstIntCast(ConstantVal: ValueRef,
ToType: TypeRef,
isSigned: Bool)
-> ValueRef;
pub unsafe fn LLVMConstFPCast(ConstantVal: ValueRef,
ToType: TypeRef)
-> ValueRef;
@ -582,8 +609,10 @@ pub extern mod llvm {
IdxList: *c_uint,
NumIdx: c_uint) -> ValueRef;
pub unsafe fn LLVMConstInsertValue(AggConstant: ValueRef,
ElementValueConstant: ValueRef, IdxList: *c_uint,
NumIdx: c_uint) -> ValueRef;
ElementValueConstant: ValueRef,
IdxList: *c_uint,
NumIdx: c_uint)
-> ValueRef;
pub unsafe fn LLVMConstInlineAsm(Ty: TypeRef, AsmString: *c_char,
Constraints: *c_char, HasSideEffects: Bool,
IsAlignStack: Bool) -> ValueRef;
@ -615,7 +644,8 @@ pub extern mod llvm {
Name: *c_char,
AddressSpace: c_uint)
-> ValueRef;
pub unsafe fn LLVMGetNamedGlobal(M: ModuleRef, Name: *c_char) -> ValueRef;
pub unsafe fn LLVMGetNamedGlobal(M: ModuleRef, Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
pub unsafe fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef;
pub unsafe fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
@ -632,8 +662,11 @@ pub extern mod llvm {
IsConstant: Bool);
/* Operations on aliases */
pub unsafe fn LLVMAddAlias(M: ModuleRef, Ty: TypeRef, Aliasee: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMAddAlias(M: ModuleRef,
Ty: TypeRef,
Aliasee: ValueRef,
Name: *c_char)
-> ValueRef;
/* Operations on functions */
pub unsafe fn LLVMAddFunction(M: ModuleRef,
@ -654,8 +687,9 @@ pub extern mod llvm {
pub unsafe fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
pub unsafe fn LLVMGetGC(Fn: ValueRef) -> *c_char;
pub unsafe fn LLVMSetGC(Fn: ValueRef, Name: *c_char);
pub unsafe fn LLVMAddFunctionAttr(Fn: ValueRef, PA: c_ulonglong, HighPA:
c_ulonglong);
pub unsafe fn LLVMAddFunctionAttr(Fn: ValueRef,
PA: c_ulonglong,
HighPA: c_ulonglong);
pub unsafe fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
pub unsafe fn LLVMRemoveFunctionAttr(Fn: ValueRef,
PA: c_ulonglong,
@ -681,16 +715,20 @@ pub extern mod llvm {
pub unsafe fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef;
pub unsafe fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
pub unsafe fn LLVMCountBasicBlocks(Fn: ValueRef) -> c_uint;
pub unsafe fn LLVMGetBasicBlocks(Fn: ValueRef, BasicBlocks: *ValueRef);
pub unsafe fn LLVMGetBasicBlocks(Fn: ValueRef,
BasicBlocks: *ValueRef);
pub unsafe fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
pub unsafe fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef;
pub unsafe fn LLVMGetNextBasicBlock(BB: BasicBlockRef) -> BasicBlockRef;
pub unsafe fn LLVMGetNextBasicBlock(BB: BasicBlockRef)
-> BasicBlockRef;
pub unsafe fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef)
-> BasicBlockRef;
pub unsafe fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef;
pub unsafe fn LLVMAppendBasicBlockInContext(C: ContextRef, Fn: ValueRef,
Name: *c_char) -> BasicBlockRef;
pub unsafe fn LLVMAppendBasicBlockInContext(C: ContextRef,
Fn: ValueRef,
Name: *c_char)
-> BasicBlockRef;
pub unsafe fn LLVMInsertBasicBlockInContext(C: ContextRef,
BB: BasicBlockRef,
Name: *c_char)
@ -705,7 +743,8 @@ pub extern mod llvm {
pub unsafe fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
/* Operations on instructions */
pub unsafe fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef;
pub unsafe fn LLVMGetInstructionParent(Inst: ValueRef)
-> BasicBlockRef;
pub unsafe fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
pub unsafe fn LLVMGetLastInstruction(BB: BasicBlockRef) -> ValueRef;
pub unsafe fn LLVMGetNextInstruction(Inst: ValueRef) -> ValueRef;
@ -717,9 +756,11 @@ pub extern mod llvm {
pub unsafe fn LLVMAddInstrAttribute(Instr: ValueRef,
index: c_uint,
IA: c_uint);
pub unsafe fn LLVMRemoveInstrAttribute(Instr: ValueRef, index: c_uint,
pub unsafe fn LLVMRemoveInstrAttribute(Instr: ValueRef,
index: c_uint,
IA: c_uint);
pub unsafe fn LLVMSetInstrParamAlignment(Instr: ValueRef, index: c_uint,
pub unsafe fn LLVMSetInstrParamAlignment(Instr: ValueRef,
index: c_uint,
align: c_uint);
/* Operations on call instructions (only) */
@ -748,9 +789,11 @@ pub extern mod llvm {
Instr: ValueRef);
pub unsafe fn LLVMPositionBuilderAtEnd(Builder: BuilderRef,
Block: BasicBlockRef);
pub unsafe fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef;
pub unsafe fn LLVMGetInsertBlock(Builder: BuilderRef)
-> BasicBlockRef;
pub unsafe fn LLVMClearInsertionPosition(Builder: BuilderRef);
pub unsafe fn LLVMInsertIntoBuilder(Builder: BuilderRef, Instr: ValueRef);
pub unsafe fn LLVMInsertIntoBuilder(Builder: BuilderRef,
Instr: ValueRef);
pub unsafe fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef,
Instr: ValueRef,
Name: *c_char);
@ -769,7 +812,8 @@ pub extern mod llvm {
pub unsafe fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
pub unsafe fn LLVMBuildAggregateRet(B: BuilderRef, RetVals: *ValueRef,
N: c_uint) -> ValueRef;
pub unsafe fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
pub unsafe fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef)
-> ValueRef;
pub unsafe fn LLVMBuildCondBr(B: BuilderRef,
If: ValueRef,
Then: BasicBlockRef,
@ -793,7 +837,8 @@ pub extern mod llvm {
NumClauses: c_uint,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
pub unsafe fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef)
-> ValueRef;
pub unsafe fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
/* Add a case to the switch instruction */
@ -806,63 +851,138 @@ pub extern mod llvm {
Dest: BasicBlockRef);
/* Add a clause to the landing pad instruction */
pub unsafe fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef);
pub unsafe fn LLVMAddClause(LandingPad: ValueRef,
ClauseVal: ValueRef);
/* Set the cleanup on a landing pad instruction */
pub unsafe fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
/* Arithmetic */
pub unsafe fn LLVMBuildAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildNSWAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildNUWAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildFAdd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildNSWSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildNUWSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildFSub(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildNSWMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildNUWMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildFMul(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildUDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildSDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildExactSDiv(B: BuilderRef, LHS: ValueRef,
RHS: ValueRef, Name: *c_char)
pub unsafe fn LLVMBuildAdd(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildNSWAdd(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildNUWAdd(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildFAdd(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildSub(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildNSWSub(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildNUWSub(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildFSub(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildMul(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildNSWMul(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildNUWMul(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildFMul(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildUDiv(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildSDiv(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildExactSDiv(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildFDiv(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildURem(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildSRem(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildFRem(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildShl(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildLShr(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildAShr(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildAnd(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildOr(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildXor(B: BuilderRef,
LHS: ValueRef,
RHS: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildFDiv(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildURem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildSRem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildFRem(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildShl(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildLShr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildAShr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildAnd(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildOr(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildXor(B: BuilderRef, LHS: ValueRef, RHS: ValueRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildBinOp(B: BuilderRef,
Op: Opcode,
LHS: ValueRef,
@ -945,10 +1065,16 @@ pub extern mod llvm {
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildZExt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildSExt(B: BuilderRef, Val: ValueRef, DestTy: TypeRef,
Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildZExt(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildSExt(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildFPToUI(B: BuilderRef,
Val: ValueRef,
DestTy: TypeRef,
@ -1027,11 +1153,21 @@ pub extern mod llvm {
Ty: TypeRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildCall(B: BuilderRef, Fn: ValueRef, Args: *ValueRef,
NumArgs: c_uint, Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildSelect(B: BuilderRef, If: ValueRef, Then: ValueRef,
Else: ValueRef, Name: *c_char) -> ValueRef;
pub unsafe fn LLVMBuildVAArg(B: BuilderRef, list: ValueRef, Ty: TypeRef,
pub unsafe fn LLVMBuildCall(B: BuilderRef,
Fn: ValueRef,
Args: *ValueRef,
NumArgs: c_uint,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildSelect(B: BuilderRef,
If: ValueRef,
Then: ValueRef,
Else: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildVAArg(B: BuilderRef,
list: ValueRef,
Ty: TypeRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildExtractElement(B: BuilderRef,
@ -1063,7 +1199,9 @@ pub extern mod llvm {
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *c_char)
pub unsafe fn LLVMBuildIsNull(B: BuilderRef,
Val: ValueRef,
Name: *c_char)
-> ValueRef;
pub unsafe fn LLVMBuildIsNotNull(B: BuilderRef,
Val: ValueRef,
@ -1090,10 +1228,12 @@ pub extern mod llvm {
Path: *c_char) -> c_int;
/** Creates target data from a target layout string. */
pub unsafe fn LLVMCreateTargetData(StringRep: *c_char) -> TargetDataRef;
pub unsafe fn LLVMCreateTargetData(StringRep: *c_char)
-> TargetDataRef;
/** Adds the target data to the given pass manager. The pass manager
references the target data only weakly. */
pub unsafe fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef);
pub unsafe fn LLVMAddTargetData(TD: TargetDataRef,
PM: PassManagerRef);
/** Number of bytes clobbered when doing a Store to *T. */
pub unsafe fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef)
-> c_ulonglong;
@ -1104,7 +1244,8 @@ pub extern mod llvm {
/** Distance between successive elements in an array of T.
Includes ABI padding. */
pub unsafe fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
pub unsafe fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef)
-> c_uint;
/** Returns the preferred alignment of a type. */
pub unsafe fn LLVMPreferredAlignmentOfType(TD: TargetDataRef,
@ -1112,9 +1253,12 @@ pub extern mod llvm {
/** Returns the minimum alignment of a type. */
pub unsafe fn LLVMABIAlignmentOfType(TD: TargetDataRef,
Ty: TypeRef) -> c_uint;
/** Returns the minimum alignment of a type when part of a call frame. */
/**
* Returns the minimum alignment of a type when part of a call frame.
*/
pub unsafe fn LLVMCallFrameAlignmentOfType(TD: TargetDataRef,
Ty: TypeRef) -> c_uint;
Ty: TypeRef)
-> c_uint;
/** Disposes target data. */
pub unsafe fn LLVMDisposeTargetData(TD: TargetDataRef);
@ -1158,7 +1302,8 @@ pub extern mod llvm {
pub unsafe fn LLVMAddIndVarSimplifyPass(PM: PassManagerRef);
pub unsafe fn LLVMAddAggressiveDCEPass(PM: PassManagerRef);
pub unsafe fn LLVMAddGlobalDCEPass(PM: PassManagerRef);
pub unsafe fn LLVMAddCorrelatedValuePropagationPass(PM: PassManagerRef);
pub unsafe fn LLVMAddCorrelatedValuePropagationPass(PM:
PassManagerRef);
pub unsafe fn LLVMAddPruneEHPass(PM: PassManagerRef);
pub unsafe fn LLVMAddSimplifyLibCallsPass(PM: PassManagerRef);
pub unsafe fn LLVMAddLoopIdiomPass(PM: PassManagerRef);
@ -1167,7 +1312,8 @@ pub extern mod llvm {
pub unsafe fn LLVMAddBasicAliasAnalysisPass(PM: PassManagerRef);
pub unsafe fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
pub unsafe fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
pub unsafe fn LLVMPassManagerBuilderDispose(PMB:
PassManagerBuilderRef);
pub unsafe fn LLVMPassManagerBuilderSetOptLevel(
PMB: PassManagerBuilderRef, OptimizationLevel: c_uint);
pub unsafe fn LLVMPassManagerBuilderSetSizeLevel(
@ -1212,22 +1358,28 @@ pub extern mod llvm {
/** Returns the current section name. */
pub unsafe fn LLVMGetSectionName(SI: SectionIteratorRef) -> *c_char;
/** Returns the current section size. */
pub unsafe fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
pub unsafe fn LLVMGetSectionSize(SI: SectionIteratorRef)
-> c_ulonglong;
/** Returns the current section contents as a string buffer. */
pub unsafe fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *c_char;
pub unsafe fn LLVMGetSectionContents(SI: SectionIteratorRef)
-> *c_char;
/** Reads the given file and returns it as a memory buffer. Use
LLVMDisposeMemoryBuffer() to get rid of it. */
pub unsafe fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *c_char)
pub unsafe fn LLVMRustCreateMemoryBufferWithContentsOfFile(
Path: *c_char)
-> MemoryBufferRef;
pub unsafe fn LLVMRustWriteOutputFile(PM: PassManagerRef, M: ModuleRef,
pub unsafe fn LLVMRustWriteOutputFile(PM: PassManagerRef,
M: ModuleRef,
Triple: *c_char,
// FIXME: When #2334 is fixed, change
// c_uint to FileType
Output: *c_char, FileType: c_uint,
// FIXME: When #2334 is fixed,
// change c_uint to FileType
Output: *c_char,
FileType: c_uint,
OptLevel: c_int,
EnableSegmentedStacks: bool) -> bool;
EnableSegmentedStacks: bool)
-> bool;
/** Returns a string describing the last error caused by an LLVMRust*
call. */
@ -1238,7 +1390,8 @@ pub extern mod llvm {
/** Load a crate into the memory manager. */
pub unsafe fn LLVMRustLoadCrate(MM: *(),
Filename: *c_char) -> bool;
Filename: *c_char)
-> bool;
/** Execute the JIT engine. */
pub unsafe fn LLVMRustExecuteJIT(MM: *(),
@ -1248,31 +1401,39 @@ pub extern mod llvm {
EnableSegmentedStacks: bool) -> *();
/** Parses the bitcode in the given memory buffer. */
pub unsafe fn LLVMRustParseBitcode(MemBuf: MemoryBufferRef) -> ModuleRef;
pub unsafe fn LLVMRustParseBitcode(MemBuf: MemoryBufferRef)
-> ModuleRef;
/** Parses LLVM asm in the given file */
pub unsafe fn LLVMRustParseAssemblyFile(Filename: *c_char) -> ModuleRef;
pub unsafe fn LLVMRustParseAssemblyFile(Filename: *c_char)
-> ModuleRef;
pub unsafe fn LLVMRustAddPrintModulePass(PM: PassManagerRef, M: ModuleRef,
pub unsafe fn LLVMRustAddPrintModulePass(PM: PassManagerRef,
M: ModuleRef,
Output: *c_char);
/** Turn on LLVM pass-timing. */
pub unsafe fn LLVMRustEnableTimePasses();
/** Print the pass timings since static dtors aren't picking them up. */
/// Print the pass timings since static dtors aren't picking them up.
pub unsafe fn LLVMRustPrintPassTimings();
pub unsafe fn LLVMStructCreateNamed(C: ContextRef, Name: *c_char)
-> TypeRef;
pub unsafe fn LLVMStructSetBody(StructTy: TypeRef, ElementTypes: *TypeRef,
ElementCount: c_uint, Packed: Bool);
pub unsafe fn LLVMStructSetBody(StructTy: TypeRef,
ElementTypes: *TypeRef,
ElementCount: c_uint,
Packed: Bool);
pub unsafe fn LLVMConstNamedStruct(S: TypeRef, ConstantVals: *ValueRef,
Count: c_uint) -> ValueRef;
pub unsafe fn LLVMConstNamedStruct(S: TypeRef,
ConstantVals: *ValueRef,
Count: c_uint)
-> ValueRef;
/** Enables LLVM debug output. */
pub unsafe fn LLVMSetDebug(Enabled: c_int);
}
}
pub fn SetInstructionCallConv(Instr: ValueRef, CC: CallConv) {

View file

@ -135,15 +135,9 @@ fn should_extract_top_mod_attributes() {
assert doc.cratemod().desc() == Some(~"test");
}
#[test]
fn should_extract_foreign_mod_attributes() {
let doc = test::mk_doc(~"#[doc = \"test\"] extern mod a { }");
assert doc.cratemod().nmods()[0].desc() == Some(~"test");
}
#[test]
fn should_extract_foreign_fn_attributes() {
let doc = test::mk_doc(~"extern mod a { #[doc = \"test\"] fn a(); }");
let doc = test::mk_doc(~"extern { #[doc = \"test\"] fn a(); }");
assert doc.cratemod().nmods()[0].fns[0].desc() == Some(~"test");
}

View file

@ -371,15 +371,9 @@ mod test {
assert doc.cratemod().mods()[0].mods()[1].name() == ~"c";
}
#[test]
pub fn extract_foreign_mods() {
let doc = mk_doc(~"extern mod a { }");
assert doc.cratemod().nmods()[0].name() == ~"a";
}
#[test]
pub fn extract_fns_from_foreign_mods() {
let doc = mk_doc(~"extern mod a { fn a(); }");
let doc = mk_doc(~"extern { fn a(); }");
assert doc.cratemod().nmods()[0].fns[0].name() == ~"a";
}

View file

@ -169,18 +169,6 @@ fn should_remove_mods_from_containing_mods() {
assert vec::is_empty(doc.cratemod().mods());
}
#[test]
fn should_make_a_page_for_every_foreign_mod() {
let doc = test::mk_doc(~"extern mod a { }");
assert doc.pages.nmods()[0].name() == ~"a";
}
#[test]
fn should_remove_foreign_mods_from_containing_mods() {
let doc = test::mk_doc(~"extern mod a { }");
assert vec::is_empty(doc.cratemod().nmods());
}
#[cfg(test)]
mod test {
use astsrv;

View file

@ -115,22 +115,3 @@ fn should_record_fn_paths() {
}
}
#[test]
fn should_record_foreign_mod_paths() {
let source = ~"mod a { extern mod b { } }";
do astsrv::from_str(source) |srv| {
let doc = extract::from_srv(srv.clone(), ~"");
let doc = run(srv.clone(), doc);
assert doc.cratemod().mods()[0].nmods()[0].path() == ~[~"a"];
}
}
#[test]
fn should_record_foreign_fn_paths() {
let source = ~"extern mod a { fn b(); }";
do astsrv::from_str(source) |srv| {
let doc = extract::from_srv(srv.clone(), ~"");
let doc = run(srv.clone(), doc);
assert doc.cratemod().nmods()[0].fns[0].path() == ~[~"a"];
}
}

View file

@ -786,9 +786,11 @@ pub mod rustrt {
unsafe fn rust_uv_tcp_bind6(tcp_server: *uv_tcp_t,
++addr: *sockaddr_in6) -> libc::c_int;
unsafe fn rust_uv_tcp_getpeername(tcp_handle_ptr: *uv_tcp_t,
++name: *sockaddr_in) -> libc::c_int;
++name: *sockaddr_in)
-> libc::c_int;
unsafe fn rust_uv_tcp_getpeername6(tcp_handle_ptr: *uv_tcp_t,
++name: *sockaddr_in6) ->libc::c_int;
++name: *sockaddr_in6)
-> libc::c_int;
unsafe fn rust_uv_listen(stream: *libc::c_void,
backlog: libc::c_int,
cb: *u8) -> libc::c_int;
@ -852,7 +854,8 @@ pub mod rustrt {
-> *libc::c_void;
unsafe fn rust_uv_set_data_for_uv_handle(handle: *libc::c_void,
data: *libc::c_void);
unsafe fn rust_uv_get_data_for_req(req: *libc::c_void) -> *libc::c_void;
unsafe fn rust_uv_get_data_for_req(req: *libc::c_void)
-> *libc::c_void;
unsafe fn rust_uv_set_data_for_req(req: *libc::c_void,
data: *libc::c_void);
unsafe fn rust_uv_get_base_from_buf(++buf: uv_buf_t) -> *u8;

View file

@ -8,8 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[abi = "rust-intrinsic"]
pub extern mod rusti {
pub mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
@ -25,6 +26,7 @@ pub extern mod rusti {
fn atomic_xsub(dst: &mut int, src: int) -> int;
fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
}
}
#[inline(always)]

View file

@ -13,9 +13,11 @@
#[crate_type = "lib"];
pub extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
pub mod rustrt {
pub extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t;
}
}
pub fn fact(n: uint) -> uint {

View file

@ -10,6 +10,9 @@
#[link(name="foreign_lib", vers="0.0")];
pub extern mod rustrt {
pub mod rustrt {
pub extern {
pub fn rust_get_argc() -> libc::c_int;
}
}

View file

@ -13,7 +13,9 @@ mod issue_3882 {
len: libc::size_t,
}
extern mod c {
mod c {
extern {
fn linenoiseAddCompletion(lc: *mut Completions);
}
}
}

View file

@ -20,9 +20,11 @@ use core::os;
// because the the indirection through another dynamic linker
// stub. Kind of shocking. Might be able to make it faster still with
// an llvm intrinsic.
#[nolink]
extern mod libc {
mod libc {
#[nolink]
pub extern {
pub fn sqrt(n: float) -> float;
}
}
fn main() {

View file

@ -11,5 +11,5 @@
// error-pattern:empty #[link_name] not allowed; use #[nolink].
#[link_name = ""]
extern mod foo {
extern {
}

View file

@ -13,5 +13,5 @@
#[link_name = ""]
#[nolink]
extern mod foo {
extern {
}

View file

@ -10,9 +10,11 @@
// except according to those terms.
#[abi = "cdecl"]
extern mod test {
mod test {
#[abi = "cdecl"]
pub extern {
pub unsafe fn free();
}
}
fn main() {

View file

@ -10,9 +10,11 @@
// except according to those terms.
#[abi = "cdecl"]
extern mod test {
mod test {
#[abi = "cdecl"]
pub extern {
pub unsafe fn free();
}
}
fn main() {

View file

@ -16,6 +16,6 @@ the compiler output. */
#[link_args = "aFdEfSeVEEE"]
#[nolink]
extern mod m1 {}
extern {}
fn main() { }

View file

@ -18,10 +18,10 @@
#[link_name= "m"]
#[link_args="-foo"] // this could have been elided.
extern mod m1 {
extern {
}
#[link_name= "m"]
#[link_args="-bar"] // this is the actual error trigger.
extern mod m2 {
extern {
}

View file

@ -11,9 +11,11 @@
// error-pattern:found rust type
#[deny(ctypes)];
#[nolink]
extern mod libc {
mod libc {
#[nolink]
pub extern {
pub fn malloc(size: int) -> *u8;
}
}
fn main() {

View file

@ -10,9 +10,11 @@
// compile-flags:-D ctypes
// error-pattern:found rust type
#[nolink]
extern mod libc {
mod libc {
#[nolink]
extern {
pub fn malloc(size: int) -> *u8;
}
}
fn main() {

View file

@ -9,9 +9,11 @@
// except according to those terms.
//error-pattern:libc::c_int or libc::c_long should be used
extern mod xx {
mod xx {
pub extern {
pub fn strlen(str: *u8) -> uint;
pub fn foo(x: int, y: uint);
}
}
fn main() {

View file

@ -12,9 +12,11 @@
// Testing that runtime failure doesn't cause callbacks to abort abnormally.
// Instead the failure will be delivered after the callbacks return.
extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
mod rustrt {
pub extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t;
}
}
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {

View file

@ -17,8 +17,10 @@
extern mod std;
extern mod rustrt {
mod rustrt {
pub extern {
pub fn rust_get_argc() -> libc::c_int;
}
}
fn getbig_call_c_and_fail(i: int) {

View file

@ -79,11 +79,13 @@ fn test_ptr() {
}
}
#[abi = "cdecl"]
#[nolink]
extern mod test {
mod test {
#[abi = "cdecl"]
#[nolink]
pub extern {
pub fn rust_get_sched_id() -> libc::intptr_t;
pub fn get_task_id() -> libc::intptr_t;
}
}
#[deriving_eq]

View file

@ -8,9 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[abi = "cdecl"]
extern mod rustrt {
mod rustrt {
#[abi = "cdecl"]
pub extern {
pub fn get_task_id() -> libc::intptr_t;
}
}
pub fn main() {

View file

@ -10,11 +10,13 @@
extern mod std;
#[abi = "cdecl"]
#[nolink]
extern mod libc {
mod libc {
#[abi = "cdecl"]
#[nolink]
pub extern {
pub fn atol(x: *u8) -> int;
pub fn atoll(x: *u8) -> i64;
}
}
fn atol(s: ~str) -> int {

View file

@ -19,16 +19,18 @@ const b: bool = false;
const b: bool = true;
#[cfg(bogus)]
#[abi = "cdecl"]
extern mod rustrt {
mod rustrt {
#[cfg(bogus)]
#[abi = "cdecl"]
pub extern {
// This symbol doesn't exist and would be a link error if this
// module was translated
pub fn bogus();
}
}
#[abi = "cdecl"]
extern mod rustrt {}
#[abi = "cdecl"]
pub extern {}
}
#[cfg(bogus)]
type t = int;
@ -106,22 +108,26 @@ fn test_in_fn_ctxt() {
}
mod test_foreign_items {
pub mod rustrt {
#[abi = "cdecl"]
pub extern mod rustrt {
pub extern {
#[cfg(bogus)]
pub fn rust_getcwd() -> ~str;
pub fn rust_getcwd() -> ~str;
}
}
}
mod test_use_statements {
#[cfg(bogus)]
use flippity_foo;
pub extern mod rustrt {
pub mod rustrt {
pub extern {
#[cfg(bogus)]
use flippity_foo;
}
}
}
mod test_methods {

View file

@ -8,9 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
mod rustrt {
pub extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t;
}
}
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {

View file

@ -8,9 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
mod rustrt {
pub extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t;
}
}
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {

View file

@ -12,9 +12,11 @@
// make sure the stack pointers are maintained properly in both
// directions
extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
mod rustrt {
pub extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t;
}
}
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {

View file

@ -8,9 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
mod rustrt {
pub extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t;
}
}
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {

View file

@ -11,9 +11,11 @@
// This creates a bunch of yielding tasks that run concurrently
// while holding onto C stacks
extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
mod rustrt {
pub extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t;
}
}
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {

View file

@ -8,9 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
mod rustrt {
pub extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t;
}
}
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {

View file

@ -11,16 +11,20 @@
// xfail-fast - Somehow causes check-fast to livelock?? Probably because we're
// calling pin_task and that's having wierd side-effects.
#[abi = "cdecl"]
#[link_name = "rustrt"]
extern mod rustrt1 {
mod rustrt1 {
#[abi = "cdecl"]
#[link_name = "rustrt"]
pub extern {
pub fn rust_get_argc() -> libc::c_int;
}
}
#[abi = "cdecl"]
#[link_name = "rustrt"]
extern mod rustrt2 {
mod rustrt2 {
#[abi = "cdecl"]
#[link_name = "rustrt"]
pub extern {
pub fn rust_get_argc() -> libc::c_int;
}
}
pub fn main() {

View file

@ -10,12 +10,13 @@
extern mod std;
#[nolink]
#[abi = "cdecl"]
extern mod libc {
mod libc {
#[nolink]
#[abi = "cdecl"]
pub extern {
#[link_name = "strlen"]
pub fn my_strlen(str: *u8) -> uint;
}
}
fn strlen(str: ~str) -> uint {

View file

@ -12,11 +12,13 @@
// compile-flags:-L.
// The -L flag is also used for linking foreign libraries
// FIXME: I want to name a mod that would not link successfully
// wouthout providing a -L argument to the compiler, and that
// will also be found successfully at runtime.
extern mod WHATGOESHERE {
mod WHATGOESHERE {
// FIXME: I want to name a mod that would not link successfully
// wouthout providing a -L argument to the compiler, and that
// will also be found successfully at runtime.
pub extern {
pub fn IDONTKNOW() -> u32;
}
}
pub fn main() {

View file

@ -8,9 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[nolink]
extern mod foo {
mod foo {
#[nolink]
pub extern {
pub const errno: int;
}
}
pub fn main() {

View file

@ -10,8 +10,10 @@
// ABI is cdecl by default
extern mod rustrt {
mod rustrt {
pub extern {
pub fn get_task_id() -> libc::intptr_t;
}
}
pub fn main() {

View file

@ -11,11 +11,15 @@
// xfail-win32
// Passing enums by value
enum void { }
pub enum void { }
#[nolink]
extern mod bindgen {
mod bindgen {
use super::void;
#[nolink]
pub extern {
pub fn printf(++v: void);
}
}
pub fn main() { }

View file

@ -8,23 +8,31 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[abi = "cdecl"]
#[nolink]
extern mod bar {}
#[abi = "cdecl"]
#[nolink]
extern mod zed {}
#[abi = "cdecl"]
#[nolink]
extern mod libc {
pub fn write(fd: int, buf: *u8,
count: ::core::libc::size_t) -> ::core::libc::ssize_t;
mod bar {
#[abi = "cdecl"]
#[nolink]
pub extern {}
}
#[abi = "cdecl"]
#[nolink]
extern mod baz {}
mod zed {
#[abi = "cdecl"]
#[nolink]
pub extern {}
}
mod libc {
#[abi = "cdecl"]
#[nolink]
pub extern {
pub fn write(fd: int, buf: *u8, count: ::core::libc::size_t)
-> ::core::libc::ssize_t;
}
}
mod baz {
#[abi = "cdecl"]
#[nolink]
pub extern {}
}
pub fn main() { }

View file

@ -15,9 +15,11 @@ mod spam {
pub fn eggs() { }
}
#[abi = "cdecl"]
extern mod rustrt {
mod rustrt {
#[abi = "cdecl"]
pub extern {
pub use spam::{ham, eggs};
}
}
pub fn main() { rustrt::ham(); rustrt::eggs(); }

View file

@ -10,10 +10,12 @@
// xfail-fast Does not work with main in a submodule
#[abi = "rust-intrinsic"]
extern mod rusti {
mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
pub fn pref_align_of<T>() -> uint;
pub fn min_align_of<T>() -> uint;
}
}
#[cfg(target_os = "linux")]

View file

@ -8,8 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[abi = "rust-intrinsic"]
extern mod rusti {
mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
pub fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
pub fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
@ -25,6 +26,7 @@ extern mod rusti {
pub fn atomic_xsub(dst: &mut int, src: int) -> int;
pub fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
pub fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
}
}
pub fn main() {

View file

@ -10,9 +10,12 @@
// xfail-fast
#[legacy_modes];
#[abi = "rust-intrinsic"]
extern mod rusti {
mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
pub fn frame_address(f: &once fn(*u8));
}
}
pub fn main() {

View file

@ -8,10 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[abi = "rust-intrinsic"]
extern mod rusti {
mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
pub fn move_val_init<T>(dst: &mut T, -src: T);
pub fn move_val<T>(dst: &mut T, -src: T);
}
}
pub fn main() {

View file

@ -12,8 +12,9 @@
extern mod std;
#[abi = "rust-intrinsic"]
extern mod rusti {
mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
fn ctpop8(x: i8) -> i8;
fn ctpop16(x: i16) -> i16;
fn ctpop32(x: i32) -> i32;
@ -32,6 +33,7 @@ extern mod rusti {
fn bswap16(x: i16) -> i16;
fn bswap32(x: i32) -> i32;
fn bswap64(x: i64) -> i64;
}
}
pub fn main() {

View file

@ -14,8 +14,9 @@ extern mod std;
use std::cmp::FuzzyEq;
#[abi = "rust-intrinsic"]
extern mod rusti {
mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
fn sqrtf32(x: f32) -> f32;
fn sqrtf64(x: f64) -> f64;
fn powif32(a: f32, x: i32) -> f32;
@ -46,6 +47,7 @@ extern mod rusti {
fn ceilf64(x: f64) -> f64;
fn truncf32(x: f32) -> f32;
fn truncf64(x: f64) -> f64;
}
}
pub fn main() {

View file

@ -10,8 +10,10 @@
#[link(name = "get_task_id")];
extern mod rustrt {
mod rustrt {
pub extern {
pub fn get_task_id() -> libc::intptr_t;
}
}
pub fn main() { }

View file

@ -11,16 +11,20 @@
// xfail-test
mod a {
pub type rust_task = uint;
pub extern mod rustrt {
pub mod rustrt {
pub extern {
pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
}
}
}
mod b {
pub type rust_task = bool;
pub extern mod rustrt {
pub mod rustrt {
pub extern {
pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
}
}
}
pub fn main() { }

View file

@ -26,16 +26,19 @@ fn lgamma(n: c_double, value: &mut int) -> c_double {
}
}
#[link_name = "m"]
#[abi = "cdecl"]
extern mod m {
#[cfg(unix)]
#[link_name="lgamma_r"] pub fn lgamma(n: c_double, sign: &mut c_int)
-> c_double;
#[cfg(windows)]
#[link_name="__lgamma_r"] pub fn lgamma(n: c_double,
sign: &mut c_int) -> c_double;
mod m {
use core::libc::{c_double, c_int};
#[link_name = "m"]
#[abi = "cdecl"]
pub extern {
#[cfg(unix)]
#[link_name="lgamma_r"]
pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
#[cfg(windows)]
#[link_name="__lgamma_r"]
pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
}
}
pub fn main() {

View file

@ -37,9 +37,11 @@ mod test_single_attr_outer {
#[attr = "val"]
pub mod mod1 {}
pub mod rustrt {
#[attr = "val"]
#[abi = "cdecl"]
pub extern mod rustrt {}
pub extern {}
}
}
mod test_multi_attr_outer {
@ -55,10 +57,12 @@ mod test_multi_attr_outer {
#[attr2 = "val"]
pub mod mod1 {}
pub mod rustrt {
#[attr1 = "val"]
#[attr2 = "val"]
#[abi = "cdecl"]
pub extern mod rustrt {}
pub extern {}
}
#[attr1 = "val"]
#[attr2 = "val"]
@ -77,9 +81,11 @@ mod test_stmt_single_attr_outer {
mod mod1 {
}
mod rustrt {
#[attr = "val"]
#[abi = "cdecl"]
extern mod rustrt {
pub extern {
}
}
}
}
@ -101,10 +107,12 @@ mod test_stmt_multi_attr_outer {
mod mod1 {
}
pub mod rustrt {
#[attr1 = "val"]
#[attr2 = "val"]
#[abi = "cdecl"]
extern mod rustrt {
pub extern {
}
}
*/
}
@ -158,13 +166,15 @@ mod test_other_forms {
}
mod test_foreign_items {
pub mod rustrt {
#[abi = "cdecl"]
pub extern mod rustrt {
pub extern {
#[attr];
#[attr]
fn get_task_id() -> libc::intptr_t;
}
}
}
mod test_literals {

View file

@ -8,10 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[nolink]
#[abi = "rust-intrinsic"]
extern mod rusti {
mod rusti {
#[nolink]
#[abi = "rust-intrinsic"]
pub extern {
pub fn morestack_addr() -> *();
}
}
pub fn main() {

View file

@ -11,7 +11,8 @@
// This test attempts to force the dynamic linker to resolve
// external symbols as close to the red zone as possible.
extern mod rustrt {
mod rustrt {
pub extern {
pub fn debug_get_stk_seg() -> *u8;
pub fn rust_get_sched_id() -> libc::intptr_t;
@ -20,6 +21,7 @@ extern mod rustrt {
pub fn get_task_id() -> libc::intptr_t;
pub fn rust_sched_threads();
pub fn rust_get_task();
}
}
fn calllink01() { unsafe { rustrt::rust_get_sched_id(); } }

View file

@ -9,8 +9,11 @@
// except according to those terms.
// Issue #901
#[nolink]
extern mod libc {
mod libc {
#[nolink]
pub extern {
pub fn printf(x: ());
}
}
pub fn main() { }

View file

@ -10,10 +10,12 @@
// Issue #2303
#[abi = "rust-intrinsic"]
extern mod rusti {
mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
pub fn pref_align_of<T>() -> uint;
pub fn min_align_of<T>() -> uint;
}
}
// This is the type with the questionable alignment

View file

@ -10,10 +10,12 @@
// Issue #2303
#[abi = "rust-intrinsic"]
extern mod rusti {
mod rusti {
#[abi = "rust-intrinsic"]
pub extern {
pub fn pref_align_of<T>() -> uint;
pub fn min_align_of<T>() -> uint;
}
}
// This is the type with the questionable alignment

View file

@ -12,17 +12,21 @@
use core::comm::*;
type sched_id = int;
type task_id = *libc::c_void;
pub type sched_id = int;
pub type task_id = *libc::c_void;
type task = *libc::c_void;
type closure = *libc::c_void;
pub type task = *libc::c_void;
pub type closure = *libc::c_void;
extern mod rustrt {
mod rustrt {
use super::{closure, sched_id, task, task_id};
pub extern {
pub fn rust_new_sched(num_threads: libc::uintptr_t) -> sched_id;
pub fn rust_get_sched_id() -> sched_id;
pub fn rust_new_task_in_sched(id: sched_id) -> task_id;
pub fn start_task(id: task_id, f: closure);
}
}
pub fn main() {

View file

@ -8,13 +8,17 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
struct Quad { a: u64, b: u64, c: u64, d: u64 }
struct Floats { a: f64, b: u8, c: f64 }
pub struct Quad { a: u64, b: u64, c: u64, d: u64 }
pub struct Floats { a: f64, b: u8, c: f64 }
#[nolink]
extern mod rustrt {
mod rustrt {
use super::{Floats, Quad};
#[nolink]
pub extern {
pub fn debug_abi_1(++q: Quad) -> Quad;
pub fn debug_abi_2(++f: Floats) -> Floats;
}
}
fn test1() {

View file

@ -12,9 +12,11 @@
#[allow(ctypes)];
#[nolink]
extern mod libc {
mod libc {
#[nolink]
pub extern {
pub fn malloc(size: int) -> *u8;
}
}
pub fn main() {

View file

@ -14,13 +14,15 @@ type SIZE_T = u32;
type LPVOID = uint;
type BOOL = u8;
#[cfg(target_os = "win32")]
#[abi = "stdcall"]
extern mod kernel32 {
mod kernel32 {
#[cfg(target_os = "win32")]
#[abi = "stdcall"]
pub extern {
pub fn GetProcessHeap() -> HANDLE;
pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T)
-> LPVOID;
pub fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID) -> BOOL;
}
}