diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-08-02 14:30:00 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-08-02 21:57:59 -0700 |
| commit | 9457ebee550d8f77ffc9b895acddae8946ee631e (patch) | |
| tree | b7612d4ec3135ab61b5a02f68259943e88b87936 /src | |
| parent | 887c65697056b23be69b9b11f41637d07327626e (diff) | |
| download | rust-9457ebee550d8f77ffc9b895acddae8946ee631e.tar.gz rust-9457ebee550d8f77ffc9b895acddae8946ee631e.zip | |
librustc: Disallow "unsafe" for external functions
Diffstat (limited to 'src')
36 files changed, 1705 insertions, 1825 deletions
diff --git a/src/libextra/flate.rs b/src/libextra/flate.rs index d330b0ea163..8024b9aa159 100644 --- a/src/libextra/flate.rs +++ b/src/libextra/flate.rs @@ -25,17 +25,17 @@ pub mod rustrt { #[link_name = "rustrt"] extern { - pub unsafe fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void, - src_buf_len: size_t, - pout_len: *mut size_t, - flags: c_int) - -> *c_void; + pub fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void, + src_buf_len: size_t, + pout_len: *mut size_t, + flags: c_int) + -> *c_void; - pub unsafe fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void, - src_buf_len: size_t, - pout_len: *mut size_t, - flags: c_int) - -> *c_void; + pub fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void, + src_buf_len: size_t, + pout_len: *mut size_t, + flags: c_int) + -> *c_void; } } diff --git a/src/libextra/rl.rs b/src/libextra/rl.rs index 08e1c240a4c..8aff8d38887 100644 --- a/src/libextra/rl.rs +++ b/src/libextra/rl.rs @@ -20,13 +20,13 @@ pub mod rustrt { use std::libc::{c_char, c_int}; extern { - pub unsafe fn linenoise(prompt: *c_char) -> *c_char; - pub unsafe fn linenoiseHistoryAdd(line: *c_char) -> c_int; - pub unsafe fn linenoiseHistorySetMaxLen(len: c_int) -> c_int; - pub unsafe fn linenoiseHistorySave(file: *c_char) -> c_int; - pub unsafe fn linenoiseHistoryLoad(file: *c_char) -> c_int; - pub unsafe fn linenoiseSetCompletionCallback(callback: *u8); - pub unsafe fn linenoiseAddCompletion(completions: *(), line: *c_char); + pub fn linenoise(prompt: *c_char) -> *c_char; + pub fn linenoiseHistoryAdd(line: *c_char) -> c_int; + pub fn linenoiseHistorySetMaxLen(len: c_int) -> c_int; + pub fn linenoiseHistorySave(file: *c_char) -> c_int; + pub fn linenoiseHistoryLoad(file: *c_char) -> c_int; + pub fn linenoiseSetCompletionCallback(callback: *u8); + pub fn linenoiseAddCompletion(completions: *(), line: *c_char); } } diff --git a/src/libextra/time.rs b/src/libextra/time.rs index 6595904a082..d95ac6d6c25 100644 --- a/src/libextra/time.rs +++ b/src/libextra/time.rs @@ -23,16 +23,13 @@ pub mod rustrt { #[abi = "cdecl"] extern { - pub unsafe fn get_time(sec: &mut i64, nsec: &mut i32); - - pub unsafe fn precise_time_ns(ns: &mut u64); - - pub unsafe fn rust_tzset(); - - pub unsafe fn rust_gmtime(sec: i64, nsec: i32, result: &mut Tm); - pub unsafe fn rust_localtime(sec: i64, nsec: i32, result: &mut Tm); - pub unsafe fn rust_timegm(tm: &Tm) -> i64; - pub unsafe fn rust_mktime(tm: &Tm) -> i64; + pub fn get_time(sec: &mut i64, nsec: &mut i32); + pub fn precise_time_ns(ns: &mut u64); + pub fn rust_tzset(); + pub fn rust_gmtime(sec: i64, nsec: i32, result: &mut Tm); + pub fn rust_localtime(sec: i64, nsec: i32, result: &mut Tm); + pub fn rust_timegm(tm: &Tm) -> i64; + pub fn rust_mktime(tm: &Tm) -> i64; } } diff --git a/src/libextra/unicode.rs b/src/libextra/unicode.rs index 9b502216fc1..4949ee79e5d 100644 --- a/src/libextra/unicode.rs +++ b/src/libextra/unicode.rs @@ -162,14 +162,13 @@ pub mod icu { #[link_name = "icuuc"] #[abi = "cdecl"] extern { - pub unsafe fn u_hasBinaryProperty(c: UChar32, which: UProperty) - -> UBool; - pub unsafe fn u_isdigit(c: UChar32) -> UBool; - pub unsafe fn u_islower(c: UChar32) -> UBool; - pub unsafe fn u_isspace(c: UChar32) -> UBool; - pub unsafe fn u_isupper(c: UChar32) -> UBool; - pub unsafe fn u_tolower(c: UChar32) -> UChar32; - pub unsafe fn u_toupper(c: UChar32) -> UChar32; + pub fn u_hasBinaryProperty(c: UChar32, which: UProperty) -> UBool; + pub fn u_isdigit(c: UChar32) -> UBool; + pub fn u_islower(c: UChar32) -> UBool; + pub fn u_isspace(c: UChar32) -> UBool; + pub fn u_isupper(c: UChar32) -> UBool; + pub fn u_tolower(c: UChar32) -> UChar32; + pub fn u_toupper(c: UChar32) -> UChar32; } } } diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index 57563948b0f..6c631a104aa 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -275,1863 +275,1808 @@ pub mod llvm { extern { /* Create and destroy contexts. */ #[fast_ffi] - pub unsafe fn LLVMContextCreate() -> ContextRef; + pub fn LLVMContextCreate() -> ContextRef; #[fast_ffi] - pub unsafe fn LLVMContextDispose(C: ContextRef); + pub fn LLVMContextDispose(C: ContextRef); #[fast_ffi] - pub unsafe fn LLVMGetMDKindIDInContext(C: ContextRef, - Name: *c_char, - SLen: c_uint) + pub fn LLVMGetMDKindIDInContext(C: ContextRef, + Name: *c_char, + SLen: c_uint) -> c_uint; /* Create and destroy modules. */ #[fast_ffi] - pub unsafe fn LLVMModuleCreateWithNameInContext(ModuleID: *c_char, - C: ContextRef) + pub fn LLVMModuleCreateWithNameInContext(ModuleID: *c_char, + C: ContextRef) -> ModuleRef; #[fast_ffi] - pub unsafe fn LLVMGetModuleContext(M: ModuleRef) -> ContextRef; + pub fn LLVMGetModuleContext(M: ModuleRef) -> ContextRef; #[fast_ffi] - pub unsafe fn LLVMDisposeModule(M: ModuleRef); + pub fn LLVMDisposeModule(M: ModuleRef); /** Data layout. See Module::getDataLayout. */ #[fast_ffi] - pub unsafe fn LLVMGetDataLayout(M: ModuleRef) -> *c_char; + pub fn LLVMGetDataLayout(M: ModuleRef) -> *c_char; #[fast_ffi] - pub unsafe fn LLVMSetDataLayout(M: ModuleRef, Triple: *c_char); + pub fn LLVMSetDataLayout(M: ModuleRef, Triple: *c_char); /** Target triple. See Module::getTargetTriple. */ #[fast_ffi] - pub unsafe fn LLVMGetTarget(M: ModuleRef) -> *c_char; + pub fn LLVMGetTarget(M: ModuleRef) -> *c_char; #[fast_ffi] - pub unsafe fn LLVMSetTarget(M: ModuleRef, Triple: *c_char); + pub fn LLVMSetTarget(M: ModuleRef, Triple: *c_char); /** See Module::dump. */ #[fast_ffi] - pub unsafe fn LLVMDumpModule(M: ModuleRef); + pub fn LLVMDumpModule(M: ModuleRef); /** See Module::setModuleInlineAsm. */ #[fast_ffi] - pub unsafe fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *c_char); + pub fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *c_char); /** See llvm::LLVMTypeKind::getTypeID. */ - pub unsafe fn LLVMGetTypeKind(Ty: TypeRef) -> TypeKind; + pub fn LLVMGetTypeKind(Ty: TypeRef) -> TypeKind; /** See llvm::LLVMType::getContext. */ #[fast_ffi] - pub unsafe fn LLVMGetTypeContext(Ty: TypeRef) -> ContextRef; + pub fn LLVMGetTypeContext(Ty: TypeRef) -> ContextRef; /* Operations on integer types */ #[fast_ffi] - pub unsafe fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef; + pub fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef; + pub fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef; + pub fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef; + pub fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef; + pub fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMIntTypeInContext(C: ContextRef, - NumBits: c_uint) -> TypeRef; + pub fn LLVMIntTypeInContext(C: ContextRef, NumBits: c_uint) + -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint; + pub fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint; /* Operations on real types */ #[fast_ffi] - pub unsafe fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef; + pub fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef; + pub fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMX86FP80TypeInContext(C: ContextRef) -> TypeRef; + pub fn LLVMX86FP80TypeInContext(C: ContextRef) -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMFP128TypeInContext(C: ContextRef) -> TypeRef; + pub fn LLVMFP128TypeInContext(C: ContextRef) -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMPPCFP128TypeInContext(C: ContextRef) -> TypeRef; + pub fn LLVMPPCFP128TypeInContext(C: ContextRef) -> TypeRef; /* Operations on function types */ #[fast_ffi] - pub unsafe fn LLVMFunctionType(ReturnType: TypeRef, - ParamTypes: *TypeRef, - ParamCount: c_uint, - IsVarArg: Bool) - -> TypeRef; + pub fn LLVMFunctionType(ReturnType: TypeRef, + ParamTypes: *TypeRef, + ParamCount: c_uint, + IsVarArg: Bool) + -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool; + pub fn LLVMIsFunctionVarArg(FunctionTy: TypeRef) -> Bool; #[fast_ffi] - pub unsafe fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef; + pub fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint; + pub fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint; #[fast_ffi] - pub unsafe fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *TypeRef); + pub fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *TypeRef); /* Operations on struct types */ #[fast_ffi] - pub unsafe fn LLVMStructTypeInContext(C: ContextRef, - ElementTypes: *TypeRef, - ElementCount: c_uint, - Packed: Bool) -> TypeRef; + pub fn LLVMStructTypeInContext(C: ContextRef, + ElementTypes: *TypeRef, + ElementCount: c_uint, + Packed: Bool) + -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMCountStructElementTypes(StructTy: TypeRef) - -> c_uint; + pub fn LLVMCountStructElementTypes(StructTy: TypeRef) -> c_uint; #[fast_ffi] - pub unsafe fn LLVMGetStructElementTypes(StructTy: TypeRef, - Dest: *mut TypeRef); + pub fn LLVMGetStructElementTypes(StructTy: TypeRef, + Dest: *mut TypeRef); #[fast_ffi] - pub unsafe fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool; + pub fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool; /* Operations on array, pointer, and vector types (sequence types) */ #[fast_ffi] - pub unsafe fn LLVMArrayType(ElementType: TypeRef, - ElementCount: c_uint) -> TypeRef; + pub fn LLVMArrayType(ElementType: TypeRef, ElementCount: c_uint) + -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMPointerType(ElementType: TypeRef, - AddressSpace: c_uint) -> TypeRef; + pub fn LLVMPointerType(ElementType: TypeRef, AddressSpace: c_uint) + -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMVectorType(ElementType: TypeRef, - ElementCount: c_uint) -> TypeRef; + pub fn LLVMVectorType(ElementType: TypeRef, ElementCount: c_uint) + -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMGetElementType(Ty: TypeRef) -> TypeRef; + pub fn LLVMGetElementType(Ty: TypeRef) -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint; + pub fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint; #[fast_ffi] - pub unsafe fn LLVMGetPointerAddressSpace(PointerTy: TypeRef) - -> c_uint; + pub fn LLVMGetPointerAddressSpace(PointerTy: TypeRef) -> c_uint; #[fast_ffi] - pub unsafe fn LLVMGetPointerToGlobal(EE: ExecutionEngineRef, - V: ValueRef) - -> *(); + pub fn LLVMGetPointerToGlobal(EE: ExecutionEngineRef, V: ValueRef) + -> *(); #[fast_ffi] - pub unsafe fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint; + pub fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint; /* Operations on other types */ #[fast_ffi] - pub unsafe fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef; + pub fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMLabelTypeInContext(C: ContextRef) -> TypeRef; + pub fn LLVMLabelTypeInContext(C: ContextRef) -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMMetadataTypeInContext(C: ContextRef) -> TypeRef; + pub fn LLVMMetadataTypeInContext(C: ContextRef) -> TypeRef; /* Operations on all values */ #[fast_ffi] - pub unsafe fn LLVMTypeOf(Val: ValueRef) -> TypeRef; + pub fn LLVMTypeOf(Val: ValueRef) -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMGetValueName(Val: ValueRef) -> *c_char; + pub fn LLVMGetValueName(Val: ValueRef) -> *c_char; #[fast_ffi] - pub unsafe fn LLVMSetValueName(Val: ValueRef, Name: *c_char); + pub fn LLVMSetValueName(Val: ValueRef, Name: *c_char); #[fast_ffi] - pub unsafe fn LLVMDumpValue(Val: ValueRef); + pub fn LLVMDumpValue(Val: ValueRef); #[fast_ffi] - pub unsafe fn LLVMReplaceAllUsesWith(OldVal: ValueRef, - NewVal: ValueRef); + pub fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef); #[fast_ffi] - pub unsafe fn LLVMHasMetadata(Val: ValueRef) -> c_int; + pub fn LLVMHasMetadata(Val: ValueRef) -> c_int; #[fast_ffi] - pub unsafe fn LLVMGetMetadata(Val: ValueRef, KindID: c_uint) - -> ValueRef; + pub fn LLVMGetMetadata(Val: ValueRef, KindID: c_uint) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMSetMetadata(Val: ValueRef, - KindID: c_uint, - Node: ValueRef); + pub fn LLVMSetMetadata(Val: ValueRef, KindID: c_uint, Node: ValueRef); /* Operations on Uses */ #[fast_ffi] - pub unsafe fn LLVMGetFirstUse(Val: ValueRef) -> UseRef; + pub fn LLVMGetFirstUse(Val: ValueRef) -> UseRef; #[fast_ffi] - pub unsafe fn LLVMGetNextUse(U: UseRef) -> UseRef; + pub fn LLVMGetNextUse(U: UseRef) -> UseRef; #[fast_ffi] - pub unsafe fn LLVMGetUser(U: UseRef) -> ValueRef; + pub fn LLVMGetUser(U: UseRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetUsedValue(U: UseRef) -> ValueRef; + pub fn LLVMGetUsedValue(U: UseRef) -> ValueRef; /* Operations on Users */ #[fast_ffi] - pub unsafe fn LLVMGetNumOperands(Val: ValueRef) -> c_int; + pub fn LLVMGetNumOperands(Val: ValueRef) -> c_int; #[fast_ffi] - pub unsafe fn LLVMGetOperand(Val: ValueRef, Index: c_uint) - -> ValueRef; + pub fn LLVMGetOperand(Val: ValueRef, Index: c_uint) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMSetOperand(Val: ValueRef, - Index: c_uint, - Op: ValueRef); + pub fn LLVMSetOperand(Val: ValueRef, Index: c_uint, Op: ValueRef); /* Operations on constants of any type */ #[fast_ffi] - pub unsafe fn LLVMConstNull(Ty: TypeRef) -> ValueRef; + pub fn LLVMConstNull(Ty: TypeRef) -> ValueRef; /* all zeroes */ #[fast_ffi] - pub unsafe fn LLVMConstAllOnes(Ty: TypeRef) -> ValueRef; + pub fn LLVMConstAllOnes(Ty: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstICmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef) -> ValueRef; + pub fn LLVMConstICmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstFCmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef) -> ValueRef; + pub fn LLVMConstFCmp(Pred: c_ushort, V1: ValueRef, V2: ValueRef) + -> ValueRef; /* only for int/vector */ #[fast_ffi] - pub unsafe fn LLVMGetUndef(Ty: TypeRef) -> ValueRef; + pub fn LLVMGetUndef(Ty: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMIsConstant(Val: ValueRef) -> Bool; + pub fn LLVMIsConstant(Val: ValueRef) -> Bool; #[fast_ffi] - pub unsafe fn LLVMIsNull(Val: ValueRef) -> Bool; + pub fn LLVMIsNull(Val: ValueRef) -> Bool; #[fast_ffi] - pub unsafe fn LLVMIsUndef(Val: ValueRef) -> Bool; + pub fn LLVMIsUndef(Val: ValueRef) -> Bool; #[fast_ffi] - pub unsafe fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef; + pub fn LLVMConstPointerNull(Ty: TypeRef) -> ValueRef; /* Operations on metadata */ #[fast_ffi] - pub unsafe fn LLVMMDStringInContext(C: ContextRef, - Str: *c_char, - SLen: c_uint) + pub fn LLVMMDStringInContext(C: ContextRef, + Str: *c_char, + SLen: c_uint) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMMDNodeInContext(C: ContextRef, - Vals: *ValueRef, - Count: c_uint) + pub fn LLVMMDNodeInContext(C: ContextRef, + Vals: *ValueRef, + Count: c_uint) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMAddNamedMetadataOperand(M: ModuleRef, Str: *c_char, - Val: ValueRef); + pub fn LLVMAddNamedMetadataOperand(M: ModuleRef, + Str: *c_char, + Val: ValueRef); /* Operations on scalar constants */ #[fast_ffi] - pub unsafe fn LLVMConstInt(IntTy: TypeRef, - N: c_ulonglong, - SignExtend: Bool) + pub fn LLVMConstInt(IntTy: TypeRef, N: c_ulonglong, SignExtend: Bool) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstIntOfString(IntTy: TypeRef, - Text: *c_char, - Radix: u8) + pub fn LLVMConstIntOfString(IntTy: TypeRef, Text: *c_char, Radix: u8) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstIntOfStringAndSize(IntTy: TypeRef, - Text: *c_char, - SLen: c_uint, - Radix: u8) - -> ValueRef; + pub fn LLVMConstIntOfStringAndSize(IntTy: TypeRef, + Text: *c_char, + SLen: c_uint, + Radix: u8) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef; + pub fn LLVMConstReal(RealTy: TypeRef, N: f64) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstRealOfString(RealTy: TypeRef, - Text: *c_char) + pub fn LLVMConstRealOfString(RealTy: TypeRef, Text: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstRealOfStringAndSize(RealTy: TypeRef, - Text: *c_char, - SLen: c_uint) - -> ValueRef; + pub fn LLVMConstRealOfStringAndSize(RealTy: TypeRef, + Text: *c_char, + SLen: c_uint) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) - -> c_ulonglong; + pub fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong; #[fast_ffi] - pub unsafe fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) - -> c_longlong; + pub fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong; /* Operations on composite constants */ #[fast_ffi] - pub unsafe fn LLVMConstStringInContext(C: ContextRef, - Str: *c_char, - Length: c_uint, - DontNullTerminate: Bool) + pub fn LLVMConstStringInContext(C: ContextRef, + Str: *c_char, + Length: c_uint, + DontNullTerminate: Bool) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstStructInContext(C: ContextRef, - ConstantVals: *ValueRef, - Count: c_uint, - Packed: Bool) -> ValueRef; + pub fn LLVMConstStructInContext(C: ContextRef, + ConstantVals: *ValueRef, + Count: c_uint, + Packed: Bool) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstArray(ElementTy: TypeRef, - ConstantVals: *ValueRef, - Length: c_uint) - -> ValueRef; + pub fn LLVMConstArray(ElementTy: TypeRef, + ConstantVals: *ValueRef, + Length: c_uint) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstVector(ScalarConstantVals: *ValueRef, - Size: c_uint) -> ValueRef; + pub fn LLVMConstVector(ScalarConstantVals: *ValueRef, Size: c_uint) + -> ValueRef; /* Constant expressions */ #[fast_ffi] - pub unsafe fn LLVMAlignOf(Ty: TypeRef) -> ValueRef; + pub fn LLVMAlignOf(Ty: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMSizeOf(Ty: TypeRef) -> ValueRef; + pub fn LLVMSizeOf(Ty: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef; + pub fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstNSWNeg(ConstantVal: ValueRef) -> ValueRef; + pub fn LLVMConstNSWNeg(ConstantVal: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstNUWNeg(ConstantVal: ValueRef) -> ValueRef; + pub fn LLVMConstNUWNeg(ConstantVal: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef; + pub fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef; + pub fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstAdd(LHSConstant: ValueRef, - RHSConstant: ValueRef) - -> ValueRef; + pub fn LLVMConstAdd(LHSConstant: ValueRef, RHSConstant: ValueRef) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstNSWAdd(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstNSWAdd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstNUWAdd(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstNUWAdd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstFAdd(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstFAdd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstSub(LHSConstant: ValueRef, - RHSConstant: ValueRef) - -> ValueRef; + pub fn LLVMConstSub(LHSConstant: ValueRef, RHSConstant: ValueRef) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstNSWSub(LHSConstant: ValueRef, - RHSConstant: ValueRef) - -> ValueRef; + pub fn LLVMConstNSWSub(LHSConstant: ValueRef, RHSConstant: ValueRef) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstNUWSub(LHSConstant: ValueRef, - RHSConstant: ValueRef) - -> ValueRef; + pub fn LLVMConstNUWSub(LHSConstant: ValueRef, RHSConstant: ValueRef) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstFSub(LHSConstant: ValueRef, - RHSConstant: ValueRef) - -> ValueRef; + pub fn LLVMConstFSub(LHSConstant: ValueRef, RHSConstant: ValueRef) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstMul(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstMul(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstNSWMul(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstNSWMul(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstNUWMul(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstNUWMul(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstFMul(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstFMul(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstUDiv(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstUDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstSDiv(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstSDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstExactSDiv(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstExactSDiv(LHSConstant: ValueRef, + RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstFDiv(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstFDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstURem(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstURem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstSRem(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstSRem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstFRem(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstFRem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstAnd(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstAnd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstOr(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstOr(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstXor(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstXor(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstShl(LHSConstant: ValueRef, - RHSConstant: ValueRef) + pub fn LLVMConstShl(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstLShr(LHSConstant: ValueRef, - RHSConstant: ValueRef) -> ValueRef; + pub fn LLVMConstLShr(LHSConstant: ValueRef, RHSConstant: ValueRef) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstAShr(LHSConstant: ValueRef, - RHSConstant: ValueRef) -> ValueRef; + pub fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstGEP(ConstantVal: ValueRef, - ConstantIndices: *ValueRef, - NumIndices: c_uint) -> ValueRef; + pub fn LLVMConstGEP(ConstantVal: ValueRef, + ConstantIndices: *ValueRef, + NumIndices: c_uint) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstInBoundsGEP(ConstantVal: ValueRef, - ConstantIndices: *ValueRef, - NumIndices: c_uint) + pub fn LLVMConstInBoundsGEP(ConstantVal: ValueRef, + ConstantIndices: *ValueRef, + NumIndices: c_uint) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstTrunc(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstTrunc(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstSExt(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstSExt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstZExt(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstZExt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstFPTrunc(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstFPTrunc(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstFPExt(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstFPExt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstUIToFP(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstUIToFP(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstSIToFP(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstSIToFP(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstFPToUI(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstFPToUI(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstFPToSI(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstFPToSI(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstPtrToInt(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstPtrToInt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstIntToPtr(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstIntToPtr(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstBitCast(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstBitCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstZExtOrBitCast(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstZExtOrBitCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstSExtOrBitCast(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstSExtOrBitCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstTruncOrBitCast(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstTruncOrBitCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstPointerCast(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstPointerCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstIntCast(ConstantVal: ValueRef, - ToType: TypeRef, - isSigned: Bool) - -> ValueRef; + pub fn LLVMConstIntCast(ConstantVal: ValueRef, + ToType: TypeRef, + isSigned: Bool) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstFPCast(ConstantVal: ValueRef, - ToType: TypeRef) + pub fn LLVMConstFPCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstSelect(ConstantCondition: ValueRef, - ConstantIfTrue: ValueRef, - ConstantIfFalse: ValueRef) - -> ValueRef; + pub fn LLVMConstSelect(ConstantCondition: ValueRef, + ConstantIfTrue: ValueRef, + ConstantIfFalse: ValueRef) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstExtractElement(VectorConstant: ValueRef, - IndexConstant: ValueRef) -> ValueRef; + pub fn LLVMConstExtractElement(VectorConstant: ValueRef, + IndexConstant: ValueRef) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstInsertElement(VectorConstant: ValueRef, - ElementValueConstant: ValueRef, - IndexConstant: ValueRef) -> ValueRef; + pub fn LLVMConstInsertElement(VectorConstant: ValueRef, + ElementValueConstant: ValueRef, + IndexConstant: ValueRef) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstShuffleVector(VectorAConstant: ValueRef, - VectorBConstant: ValueRef, - MaskConstant: ValueRef) -> ValueRef; + pub fn LLVMConstShuffleVector(VectorAConstant: ValueRef, + VectorBConstant: ValueRef, + MaskConstant: ValueRef) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstExtractValue(AggConstant: ValueRef, - IdxList: *c_uint, - NumIdx: c_uint) -> ValueRef; + pub fn LLVMConstExtractValue(AggConstant: ValueRef, + IdxList: *c_uint, + NumIdx: c_uint) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstInsertValue(AggConstant: ValueRef, - ElementValueConstant: ValueRef, - IdxList: *c_uint, - NumIdx: c_uint) - -> ValueRef; + pub fn LLVMConstInsertValue(AggConstant: ValueRef, + ElementValueConstant: ValueRef, + IdxList: *c_uint, + NumIdx: c_uint) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMConstInlineAsm(Ty: TypeRef, AsmString: *c_char, - Constraints: *c_char, HasSideEffects: Bool, - IsAlignStack: Bool) -> ValueRef; + pub fn LLVMConstInlineAsm(Ty: TypeRef, + AsmString: *c_char, + Constraints: *c_char, + HasSideEffects: Bool, + IsAlignStack: Bool) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBlockAddress(F: ValueRef, BB: BasicBlockRef) - -> ValueRef; + pub fn LLVMBlockAddress(F: ValueRef, BB: BasicBlockRef) -> ValueRef; /* Operations on global variables, functions, and aliases (globals) */ #[fast_ffi] - pub unsafe fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef; + pub fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef; #[fast_ffi] - pub unsafe fn LLVMIsDeclaration(Global: ValueRef) -> Bool; + pub fn LLVMIsDeclaration(Global: ValueRef) -> Bool; #[fast_ffi] - pub unsafe fn LLVMGetLinkage(Global: ValueRef) -> c_uint; + pub fn LLVMGetLinkage(Global: ValueRef) -> c_uint; #[fast_ffi] - pub unsafe fn LLVMSetLinkage(Global: ValueRef, Link: c_uint); + pub fn LLVMSetLinkage(Global: ValueRef, Link: c_uint); #[fast_ffi] - pub unsafe fn LLVMGetSection(Global: ValueRef) -> *c_char; + pub fn LLVMGetSection(Global: ValueRef) -> *c_char; #[fast_ffi] - pub unsafe fn LLVMSetSection(Global: ValueRef, Section: *c_char); + pub fn LLVMSetSection(Global: ValueRef, Section: *c_char); #[fast_ffi] - pub unsafe fn LLVMGetVisibility(Global: ValueRef) -> c_uint; + pub fn LLVMGetVisibility(Global: ValueRef) -> c_uint; #[fast_ffi] - pub unsafe fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint); + pub fn LLVMSetVisibility(Global: ValueRef, Viz: c_uint); #[fast_ffi] - pub unsafe fn LLVMGetAlignment(Global: ValueRef) -> c_uint; + pub fn LLVMGetAlignment(Global: ValueRef) -> c_uint; #[fast_ffi] - pub unsafe fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint); + pub fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint); /* Operations on global variables */ #[fast_ffi] - pub unsafe fn LLVMAddGlobal(M: ModuleRef, - Ty: TypeRef, - Name: *c_char) + pub fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMAddGlobalInAddressSpace(M: ModuleRef, - Ty: TypeRef, - Name: *c_char, - AddressSpace: c_uint) + pub fn LLVMAddGlobalInAddressSpace(M: ModuleRef, + Ty: TypeRef, + Name: *c_char, + AddressSpace: c_uint) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetNamedGlobal(M: ModuleRef, Name: *c_char) - -> ValueRef; + pub fn LLVMGetNamedGlobal(M: ModuleRef, Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef; + pub fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef; + pub fn LLVMGetLastGlobal(M: ModuleRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef; + pub fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetPreviousGlobal(GlobalVar: ValueRef) -> ValueRef; + pub fn LLVMGetPreviousGlobal(GlobalVar: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMDeleteGlobal(GlobalVar: ValueRef); + pub fn LLVMDeleteGlobal(GlobalVar: ValueRef); #[fast_ffi] - pub unsafe fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef; + pub fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMSetInitializer(GlobalVar: ValueRef, + pub fn LLVMSetInitializer(GlobalVar: ValueRef, ConstantVal: ValueRef); #[fast_ffi] - pub unsafe fn LLVMIsThreadLocal(GlobalVar: ValueRef) -> Bool; + pub fn LLVMIsThreadLocal(GlobalVar: ValueRef) -> Bool; #[fast_ffi] - pub unsafe fn LLVMSetThreadLocal(GlobalVar: ValueRef, - IsThreadLocal: Bool); + pub fn LLVMSetThreadLocal(GlobalVar: ValueRef, IsThreadLocal: Bool); #[fast_ffi] - pub unsafe fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool; + pub fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool; #[fast_ffi] - pub unsafe fn LLVMSetGlobalConstant(GlobalVar: ValueRef, - IsConstant: Bool); + pub fn LLVMSetGlobalConstant(GlobalVar: ValueRef, IsConstant: Bool); /* Operations on aliases */ #[fast_ffi] - pub unsafe fn LLVMAddAlias(M: ModuleRef, - Ty: TypeRef, - Aliasee: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMAddAlias(M: ModuleRef, + Ty: TypeRef, + Aliasee: ValueRef, + Name: *c_char) + -> ValueRef; /* Operations on functions */ #[fast_ffi] - pub unsafe fn LLVMAddFunction(M: ModuleRef, - Name: *c_char, - FunctionTy: TypeRef) + pub fn LLVMAddFunction(M: ModuleRef, + Name: *c_char, + FunctionTy: TypeRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetNamedFunction(M: ModuleRef, - Name: *c_char) -> ValueRef; + pub fn LLVMGetNamedFunction(M: ModuleRef, Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef; + pub fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef; + pub fn LLVMGetLastFunction(M: ModuleRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef; + pub fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef; + pub fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMDeleteFunction(Fn: ValueRef); + pub fn LLVMDeleteFunction(Fn: ValueRef); #[fast_ffi] - pub unsafe fn LLVMGetOrInsertFunction(M: ModuleRef, Name: *c_char, - FunctionTy: TypeRef) -> ValueRef; + pub fn LLVMGetOrInsertFunction(M: ModuleRef, + Name: *c_char, + FunctionTy: TypeRef) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint; + pub fn LLVMGetIntrinsicID(Fn: ValueRef) -> c_uint; #[fast_ffi] - pub unsafe fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint; + pub fn LLVMGetFunctionCallConv(Fn: ValueRef) -> c_uint; #[fast_ffi] - pub unsafe fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint); + pub fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint); #[fast_ffi] - pub unsafe fn LLVMGetGC(Fn: ValueRef) -> *c_char; + pub fn LLVMGetGC(Fn: ValueRef) -> *c_char; #[fast_ffi] - pub unsafe fn LLVMSetGC(Fn: ValueRef, Name: *c_char); + pub fn LLVMSetGC(Fn: ValueRef, Name: *c_char); #[fast_ffi] - pub unsafe fn LLVMAddFunctionAttr(Fn: ValueRef, - PA: c_uint, - HighPA: c_uint); + pub fn LLVMAddFunctionAttr(Fn: ValueRef, PA: c_uint, HighPA: c_uint); #[fast_ffi] - pub unsafe fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong; + pub fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong; #[fast_ffi] - pub unsafe fn LLVMRemoveFunctionAttr(Fn: ValueRef, - PA: c_ulonglong, - HighPA: c_ulonglong); + pub fn LLVMRemoveFunctionAttr(Fn: ValueRef, + PA: c_ulonglong, + HighPA: c_ulonglong); /* Operations on parameters */ #[fast_ffi] - pub unsafe fn LLVMCountParams(Fn: ValueRef) -> c_uint; + pub fn LLVMCountParams(Fn: ValueRef) -> c_uint; #[fast_ffi] - pub unsafe fn LLVMGetParams(Fn: ValueRef, Params: *ValueRef); + pub fn LLVMGetParams(Fn: ValueRef, Params: *ValueRef); #[fast_ffi] - pub unsafe fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef; + pub fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef; + pub fn LLVMGetParamParent(Inst: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef; + pub fn LLVMGetFirstParam(Fn: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetLastParam(Fn: ValueRef) -> ValueRef; + pub fn LLVMGetLastParam(Fn: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetNextParam(Arg: ValueRef) -> ValueRef; + pub fn LLVMGetNextParam(Arg: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetPreviousParam(Arg: ValueRef) -> ValueRef; + pub fn LLVMGetPreviousParam(Arg: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMAddAttribute(Arg: ValueRef, PA: c_uint); + pub fn LLVMAddAttribute(Arg: ValueRef, PA: c_uint); #[fast_ffi] - pub unsafe fn LLVMRemoveAttribute(Arg: ValueRef, PA: c_uint); + pub fn LLVMRemoveAttribute(Arg: ValueRef, PA: c_uint); #[fast_ffi] - pub unsafe fn LLVMGetAttribute(Arg: ValueRef) -> c_uint; + pub fn LLVMGetAttribute(Arg: ValueRef) -> c_uint; #[fast_ffi] - pub unsafe fn LLVMSetParamAlignment(Arg: ValueRef, align: c_uint); + pub fn LLVMSetParamAlignment(Arg: ValueRef, align: c_uint); /* Operations on basic blocks */ #[fast_ffi] - pub unsafe fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef; + pub fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMValueIsBasicBlock(Val: ValueRef) -> Bool; + pub fn LLVMValueIsBasicBlock(Val: ValueRef) -> Bool; #[fast_ffi] - pub unsafe fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef; + pub fn LLVMValueAsBasicBlock(Val: ValueRef) -> BasicBlockRef; #[fast_ffi] - pub unsafe fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef; + pub fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMCountBasicBlocks(Fn: ValueRef) -> c_uint; + pub fn LLVMCountBasicBlocks(Fn: ValueRef) -> c_uint; #[fast_ffi] - pub unsafe fn LLVMGetBasicBlocks(Fn: ValueRef, - BasicBlocks: *ValueRef); + pub fn LLVMGetBasicBlocks(Fn: ValueRef, BasicBlocks: *ValueRef); #[fast_ffi] - pub unsafe fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef; + pub fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef; #[fast_ffi] - pub unsafe fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef; + pub fn LLVMGetLastBasicBlock(Fn: ValueRef) -> BasicBlockRef; #[fast_ffi] - pub unsafe fn LLVMGetNextBasicBlock(BB: BasicBlockRef) - -> BasicBlockRef; + pub fn LLVMGetNextBasicBlock(BB: BasicBlockRef) -> BasicBlockRef; #[fast_ffi] - pub unsafe fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef) - -> BasicBlockRef; + pub fn LLVMGetPreviousBasicBlock(BB: BasicBlockRef) -> BasicBlockRef; #[fast_ffi] - pub unsafe fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef; + pub fn LLVMGetEntryBasicBlock(Fn: ValueRef) -> BasicBlockRef; #[fast_ffi] - pub unsafe fn LLVMAppendBasicBlockInContext(C: ContextRef, - Fn: ValueRef, - Name: *c_char) - -> BasicBlockRef; + pub fn LLVMAppendBasicBlockInContext(C: ContextRef, + Fn: ValueRef, + Name: *c_char) + -> BasicBlockRef; #[fast_ffi] - pub unsafe fn LLVMInsertBasicBlockInContext(C: ContextRef, - BB: BasicBlockRef, - Name: *c_char) - -> BasicBlockRef; + pub fn LLVMInsertBasicBlockInContext(C: ContextRef, + BB: BasicBlockRef, + Name: *c_char) + -> BasicBlockRef; #[fast_ffi] - pub unsafe fn LLVMDeleteBasicBlock(BB: BasicBlockRef); + pub fn LLVMDeleteBasicBlock(BB: BasicBlockRef); #[fast_ffi] - pub unsafe fn LLVMMoveBasicBlockAfter(BB: BasicBlockRef, MoveAfter: BasicBlockRef); + pub fn LLVMMoveBasicBlockAfter(BB: BasicBlockRef, + MoveAfter: BasicBlockRef); #[fast_ffi] - pub unsafe fn LLVMMoveBasicBlockBefore(BB: BasicBlockRef, MoveBefore: BasicBlockRef); + pub fn LLVMMoveBasicBlockBefore(BB: BasicBlockRef, + MoveBefore: BasicBlockRef); /* Operations on instructions */ #[fast_ffi] - pub unsafe fn LLVMGetInstructionParent(Inst: ValueRef) - -> BasicBlockRef; + pub fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef; #[fast_ffi] - pub unsafe fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef; + pub fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetLastInstruction(BB: BasicBlockRef) -> ValueRef; + pub fn LLVMGetLastInstruction(BB: BasicBlockRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetNextInstruction(Inst: ValueRef) -> ValueRef; + pub fn LLVMGetNextInstruction(Inst: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetPreviousInstruction(Inst: ValueRef) -> ValueRef; + pub fn LLVMGetPreviousInstruction(Inst: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMInstructionEraseFromParent(Inst: ValueRef); + pub fn LLVMInstructionEraseFromParent(Inst: ValueRef); /* Operations on call sites */ #[fast_ffi] - pub unsafe fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint); + pub fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint); #[fast_ffi] - pub unsafe fn LLVMGetInstructionCallConv(Instr: ValueRef) -> c_uint; + pub fn LLVMGetInstructionCallConv(Instr: ValueRef) -> c_uint; #[fast_ffi] - pub unsafe fn LLVMAddInstrAttribute(Instr: ValueRef, - index: c_uint, - IA: c_uint); + pub fn LLVMAddInstrAttribute(Instr: ValueRef, + index: c_uint, + IA: c_uint); #[fast_ffi] - pub unsafe fn LLVMRemoveInstrAttribute(Instr: ValueRef, - index: c_uint, - IA: c_uint); + pub fn LLVMRemoveInstrAttribute(Instr: ValueRef, + index: c_uint, + IA: c_uint); #[fast_ffi] - pub unsafe fn LLVMSetInstrParamAlignment(Instr: ValueRef, - index: c_uint, - align: c_uint); + pub fn LLVMSetInstrParamAlignment(Instr: ValueRef, + index: c_uint, + align: c_uint); /* Operations on call instructions (only) */ #[fast_ffi] - pub unsafe fn LLVMIsTailCall(CallInst: ValueRef) -> Bool; + pub fn LLVMIsTailCall(CallInst: ValueRef) -> Bool; #[fast_ffi] - pub unsafe fn LLVMSetTailCall(CallInst: ValueRef, IsTailCall: Bool); + pub fn LLVMSetTailCall(CallInst: ValueRef, IsTailCall: Bool); /* Operations on phi nodes */ #[fast_ffi] - pub unsafe fn LLVMAddIncoming(PhiNode: ValueRef, - IncomingValues: *ValueRef, - IncomingBlocks: *BasicBlockRef, - Count: c_uint); + pub fn LLVMAddIncoming(PhiNode: ValueRef, + IncomingValues: *ValueRef, + IncomingBlocks: *BasicBlockRef, + Count: c_uint); #[fast_ffi] - pub unsafe fn LLVMCountIncoming(PhiNode: ValueRef) -> c_uint; + pub fn LLVMCountIncoming(PhiNode: ValueRef) -> c_uint; #[fast_ffi] - pub unsafe fn LLVMGetIncomingValue(PhiNode: ValueRef, - Index: c_uint) + pub fn LLVMGetIncomingValue(PhiNode: ValueRef, Index: c_uint) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMGetIncomingBlock(PhiNode: ValueRef, - Index: c_uint) -> BasicBlockRef; + pub fn LLVMGetIncomingBlock(PhiNode: ValueRef, Index: c_uint) + -> BasicBlockRef; /* Instruction builders */ #[fast_ffi] - pub unsafe fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef; + pub fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef; #[fast_ffi] - pub unsafe fn LLVMPositionBuilder(Builder: BuilderRef, - Block: BasicBlockRef, - Instr: ValueRef); + pub fn LLVMPositionBuilder(Builder: BuilderRef, + Block: BasicBlockRef, + Instr: ValueRef); #[fast_ffi] - pub unsafe fn LLVMPositionBuilderBefore(Builder: BuilderRef, - Instr: ValueRef); + pub fn LLVMPositionBuilderBefore(Builder: BuilderRef, + Instr: ValueRef); #[fast_ffi] - pub unsafe fn LLVMPositionBuilderAtEnd(Builder: BuilderRef, - Block: BasicBlockRef); + pub fn LLVMPositionBuilderAtEnd(Builder: BuilderRef, + Block: BasicBlockRef); #[fast_ffi] - pub unsafe fn LLVMGetInsertBlock(Builder: BuilderRef) - -> BasicBlockRef; + pub fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef; #[fast_ffi] - pub unsafe fn LLVMClearInsertionPosition(Builder: BuilderRef); + pub fn LLVMClearInsertionPosition(Builder: BuilderRef); #[fast_ffi] - pub unsafe fn LLVMInsertIntoBuilder(Builder: BuilderRef, - Instr: ValueRef); + pub fn LLVMInsertIntoBuilder(Builder: BuilderRef, Instr: ValueRef); #[fast_ffi] - pub unsafe fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef, - Instr: ValueRef, - Name: *c_char); + pub fn LLVMInsertIntoBuilderWithName(Builder: BuilderRef, + Instr: ValueRef, + Name: *c_char); #[fast_ffi] - pub unsafe fn LLVMDisposeBuilder(Builder: BuilderRef); + pub fn LLVMDisposeBuilder(Builder: BuilderRef); #[fast_ffi] - pub unsafe fn LLVMDisposeExecutionEngine(EE: ExecutionEngineRef); + pub fn LLVMDisposeExecutionEngine(EE: ExecutionEngineRef); /* Metadata */ #[fast_ffi] - pub unsafe fn LLVMSetCurrentDebugLocation(Builder: BuilderRef, - L: ValueRef); + pub fn LLVMSetCurrentDebugLocation(Builder: BuilderRef, L: ValueRef); #[fast_ffi] - pub unsafe fn LLVMGetCurrentDebugLocation(Builder: BuilderRef) - -> ValueRef; + pub fn LLVMGetCurrentDebugLocation(Builder: BuilderRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMSetInstDebugLocation(Builder: BuilderRef, - Inst: ValueRef); + pub fn LLVMSetInstDebugLocation(Builder: BuilderRef, Inst: ValueRef); /* Terminators */ #[fast_ffi] - pub unsafe fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef; + pub fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef; + #[fast_ffi] + pub fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef; + pub fn LLVMBuildAggregateRet(B: BuilderRef, + RetVals: *ValueRef, + N: c_uint) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildAggregateRet(B: BuilderRef, RetVals: *ValueRef, - N: c_uint) -> ValueRef; + pub fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) + pub fn LLVMBuildCondBr(B: BuilderRef, + If: ValueRef, + Then: BasicBlockRef, + Else: BasicBlockRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildCondBr(B: BuilderRef, - If: ValueRef, - Then: BasicBlockRef, - Else: BasicBlockRef) + pub fn LLVMBuildSwitch(B: BuilderRef, + V: ValueRef, + Else: BasicBlockRef, + NumCases: c_uint) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildSwitch(B: BuilderRef, V: ValueRef, - Else: BasicBlockRef, NumCases: c_uint) + pub fn LLVMBuildIndirectBr(B: BuilderRef, + Addr: ValueRef, + NumDests: c_uint) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildIndirectBr(B: BuilderRef, Addr: ValueRef, - NumDests: c_uint) -> ValueRef; - #[fast_ffi] - pub unsafe fn LLVMBuildInvoke(B: BuilderRef, - Fn: ValueRef, - Args: *ValueRef, - NumArgs: c_uint, - Then: BasicBlockRef, - Catch: BasicBlockRef, - Name: *c_char) -> ValueRef; - #[fast_ffi] - pub unsafe fn LLVMBuildLandingPad(B: BuilderRef, - Ty: TypeRef, - PersFn: ValueRef, - NumClauses: c_uint, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildInvoke(B: BuilderRef, + Fn: ValueRef, + Args: *ValueRef, + NumArgs: c_uint, + Then: BasicBlockRef, + Catch: BasicBlockRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) + pub fn LLVMBuildLandingPad(B: BuilderRef, + Ty: TypeRef, + PersFn: ValueRef, + NumClauses: c_uint, + Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef; + pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef; + #[fast_ffi] + pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef; /* Add a case to the switch instruction */ #[fast_ffi] - pub unsafe fn LLVMAddCase(Switch: ValueRef, - OnVal: ValueRef, - Dest: BasicBlockRef); + pub fn LLVMAddCase(Switch: ValueRef, + OnVal: ValueRef, + Dest: BasicBlockRef); /* Add a destination to the indirectbr instruction */ #[fast_ffi] - pub unsafe fn LLVMAddDestination(IndirectBr: ValueRef, - Dest: BasicBlockRef); + pub fn LLVMAddDestination(IndirectBr: ValueRef, Dest: BasicBlockRef); /* Add a clause to the landing pad instruction */ #[fast_ffi] - pub unsafe fn LLVMAddClause(LandingPad: ValueRef, - ClauseVal: ValueRef); + pub fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef); /* Set the cleanup on a landing pad instruction */ #[fast_ffi] - pub unsafe fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool); + pub fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool); /* Arithmetic */ #[fast_ffi] - pub unsafe fn LLVMBuildAdd(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildAdd(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildNSWAdd(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildNSWAdd(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildNUWAdd(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildNUWAdd(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildFAdd(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildFAdd(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildSub(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildSub(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildNSWSub(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildNSWSub(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildNUWSub(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildNUWSub(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildFSub(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildFSub(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildMul(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildMul(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildNSWMul(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildNSWMul(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildNUWMul(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildNUWMul(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildFMul(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildFMul(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildUDiv(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildUDiv(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildSDiv(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildSDiv(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildExactSDiv(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildExactSDiv(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildFDiv(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildFDiv(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildURem(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildURem(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildSRem(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildSRem(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildFRem(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildFRem(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildShl(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildShl(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildLShr(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildLShr(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildAShr(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildAShr(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildAnd(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildAnd(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildOr(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildOr(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildXor(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildXor(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildBinOp(B: BuilderRef, - Op: Opcode, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) + pub fn LLVMBuildBinOp(B: BuilderRef, + Op: Opcode, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildNeg(B: BuilderRef, - V: ValueRef, - Name: *c_char) + pub fn LLVMBuildNeg(B: BuilderRef, V: ValueRef, Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildNSWNeg(B: BuilderRef, - V: ValueRef, - Name: *c_char) + pub fn LLVMBuildNSWNeg(B: BuilderRef, V: ValueRef, Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildNUWNeg(B: BuilderRef, - V: ValueRef, - Name: *c_char) + pub fn LLVMBuildNUWNeg(B: BuilderRef, V: ValueRef, Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildFNeg(B: BuilderRef, - V: ValueRef, - Name: *c_char) + pub fn LLVMBuildFNeg(B: BuilderRef, V: ValueRef, Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildNot(B: BuilderRef, - V: ValueRef, - Name: *c_char) + pub fn LLVMBuildNot(B: BuilderRef, V: ValueRef, Name: *c_char) -> ValueRef; /* Memory */ #[fast_ffi] - pub unsafe fn LLVMBuildMalloc(B: BuilderRef, - Ty: TypeRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildMalloc(B: BuilderRef, Ty: TypeRef, Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildArrayMalloc(B: BuilderRef, - Ty: TypeRef, - Val: ValueRef, - Name: *c_char) -> ValueRef; + pub fn LLVMBuildArrayMalloc(B: BuilderRef, + Ty: TypeRef, + Val: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildAlloca(B: BuilderRef, - Ty: TypeRef, - Name: *c_char) + pub fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildArrayAlloca(B: BuilderRef, - Ty: TypeRef, - Val: ValueRef, - Name: *c_char) -> ValueRef; + pub fn LLVMBuildArrayAlloca(B: BuilderRef, + Ty: TypeRef, + Val: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildFree(B: BuilderRef, - PointerVal: ValueRef) -> ValueRef; + pub fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildLoad(B: BuilderRef, - PointerVal: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildLoad(B: BuilderRef, + PointerVal: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildStore(B: BuilderRef, - Val: ValueRef, - Ptr: ValueRef) - -> ValueRef; + pub fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildGEP(B: BuilderRef, - Pointer: ValueRef, - Indices: *ValueRef, - NumIndices: c_uint, - Name: *c_char) + pub fn LLVMBuildGEP(B: BuilderRef, + Pointer: ValueRef, + Indices: *ValueRef, + NumIndices: c_uint, + Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildInBoundsGEP(B: BuilderRef, Pointer: ValueRef, - Indices: *ValueRef, NumIndices: c_uint, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildInBoundsGEP(B: BuilderRef, + Pointer: ValueRef, + Indices: *ValueRef, + NumIndices: c_uint, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildStructGEP(B: BuilderRef, - Pointer: ValueRef, - Idx: c_uint, - Name: *c_char) + pub fn LLVMBuildStructGEP(B: BuilderRef, + Pointer: ValueRef, + Idx: c_uint, + Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildGlobalString(B: BuilderRef, - Str: *c_char, - Name: *c_char) + pub fn LLVMBuildGlobalString(B: BuilderRef, + Str: *c_char, + Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildGlobalStringPtr(B: BuilderRef, - Str: *c_char, - Name: *c_char) + pub fn LLVMBuildGlobalStringPtr(B: BuilderRef, + Str: *c_char, + Name: *c_char) -> ValueRef; /* Casts */ #[fast_ffi] - pub unsafe fn LLVMBuildTrunc(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) -> ValueRef; + pub fn LLVMBuildTrunc(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildZExt(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildZExt(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildSExt(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildSExt(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildFPToUI(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) -> ValueRef; + pub fn LLVMBuildFPToUI(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildFPToSI(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) -> ValueRef; + pub fn LLVMBuildFPToSI(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildUIToFP(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) -> ValueRef; + pub fn LLVMBuildUIToFP(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildSIToFP(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) -> ValueRef; + pub fn LLVMBuildSIToFP(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildFPTrunc(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) -> ValueRef; + pub fn LLVMBuildFPTrunc(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildFPExt(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) -> ValueRef; + pub fn LLVMBuildFPExt(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildPtrToInt(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) -> ValueRef; + pub fn LLVMBuildPtrToInt(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildIntToPtr(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) -> ValueRef; + pub fn LLVMBuildIntToPtr(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildBitCast(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) -> ValueRef; + pub fn LLVMBuildBitCast(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildZExtOrBitCast(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) + pub fn LLVMBuildZExtOrBitCast(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildSExtOrBitCast(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) + pub fn LLVMBuildSExtOrBitCast(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildTruncOrBitCast(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) - -> ValueRef; - #[fast_ffi] - pub unsafe fn LLVMBuildCast(B: BuilderRef, Op: Opcode, Val: ValueRef, - DestTy: TypeRef, Name: *c_char) -> ValueRef; - #[fast_ffi] - pub unsafe fn LLVMBuildPointerCast(B: BuilderRef, + pub fn LLVMBuildTruncOrBitCast(B: BuilderRef, Val: ValueRef, DestTy: TypeRef, Name: *c_char) + -> ValueRef; + #[fast_ffi] + pub fn LLVMBuildCast(B: BuilderRef, + Op: Opcode, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) -> ValueRef; + #[fast_ffi] + pub fn LLVMBuildPointerCast(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildIntCast(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) -> ValueRef; + pub fn LLVMBuildIntCast(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildFPCast(B: BuilderRef, - Val: ValueRef, - DestTy: TypeRef, - Name: *c_char) -> ValueRef; + pub fn LLVMBuildFPCast(B: BuilderRef, + Val: ValueRef, + DestTy: TypeRef, + Name: *c_char) + -> ValueRef; /* Comparisons */ #[fast_ffi] - pub unsafe fn LLVMBuildICmp(B: BuilderRef, Op: c_uint, LHS: ValueRef, - RHS: ValueRef, Name: *c_char) -> ValueRef; + pub fn LLVMBuildICmp(B: BuilderRef, + Op: c_uint, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildFCmp(B: BuilderRef, Op: c_uint, LHS: ValueRef, - RHS: ValueRef, Name: *c_char) -> ValueRef; + pub fn LLVMBuildFCmp(B: BuilderRef, + Op: c_uint, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; /* Miscellaneous instructions */ #[fast_ffi] - pub unsafe fn LLVMBuildPhi(B: BuilderRef, - Ty: TypeRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildCall(B: BuilderRef, - Fn: ValueRef, - Args: *ValueRef, - NumArgs: c_uint, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildCall(B: BuilderRef, + Fn: ValueRef, + Args: *ValueRef, + NumArgs: c_uint, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildSelect(B: BuilderRef, - If: ValueRef, - Then: ValueRef, - Else: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildSelect(B: BuilderRef, + If: ValueRef, + Then: ValueRef, + Else: ValueRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildVAArg(B: BuilderRef, - list: ValueRef, - Ty: TypeRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildVAArg(B: BuilderRef, + list: ValueRef, + Ty: TypeRef, + Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildExtractElement(B: BuilderRef, - VecVal: ValueRef, - Index: ValueRef, - Name: *c_char) + pub fn LLVMBuildExtractElement(B: BuilderRef, + VecVal: ValueRef, + Index: ValueRef, + Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildInsertElement(B: BuilderRef, - VecVal: ValueRef, - EltVal: ValueRef, - Index: ValueRef, - Name: *c_char) + pub fn LLVMBuildInsertElement(B: BuilderRef, + VecVal: ValueRef, + EltVal: ValueRef, + Index: ValueRef, + Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildShuffleVector(B: BuilderRef, - V1: ValueRef, - V2: ValueRef, - Mask: ValueRef, - Name: *c_char) + pub fn LLVMBuildShuffleVector(B: BuilderRef, + V1: ValueRef, + V2: ValueRef, + Mask: ValueRef, + Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildExtractValue(B: BuilderRef, - AggVal: ValueRef, - Index: c_uint, - Name: *c_char) + pub fn LLVMBuildExtractValue(B: BuilderRef, + AggVal: ValueRef, + Index: c_uint, + Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildInsertValue(B: BuilderRef, - AggVal: ValueRef, - EltVal: ValueRef, - Index: c_uint, - Name: *c_char) + pub fn LLVMBuildInsertValue(B: BuilderRef, + AggVal: ValueRef, + EltVal: ValueRef, + Index: c_uint, + Name: *c_char) -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildIsNull(B: BuilderRef, - Val: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildIsNotNull(B: BuilderRef, - Val: ValueRef, - Name: *c_char) - -> ValueRef; + pub fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *c_char) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMBuildPtrDiff(B: BuilderRef, - LHS: ValueRef, - RHS: ValueRef, - Name: *c_char) -> ValueRef; + pub fn LLVMBuildPtrDiff(B: BuilderRef, + LHS: ValueRef, + RHS: ValueRef, + Name: *c_char) + -> ValueRef; /* Atomic Operations */ - pub unsafe fn LLVMBuildAtomicLoad(B: BuilderRef, - PointerVal: ValueRef, - Name: *c_char, - Order: AtomicOrdering, - Alignment: c_uint) - -> ValueRef; + pub fn LLVMBuildAtomicLoad(B: BuilderRef, + PointerVal: ValueRef, + Name: *c_char, + Order: AtomicOrdering, + Alignment: c_uint) + -> ValueRef; - pub unsafe fn LLVMBuildAtomicStore(B: BuilderRef, - Val: ValueRef, - Ptr: ValueRef, - Order: AtomicOrdering, - Alignment: c_uint) - -> ValueRef; + pub fn LLVMBuildAtomicStore(B: BuilderRef, + Val: ValueRef, + Ptr: ValueRef, + Order: AtomicOrdering, + Alignment: c_uint) + -> ValueRef; - pub unsafe fn LLVMBuildAtomicCmpXchg(B: BuilderRef, - LHS: ValueRef, - CMP: ValueRef, - RHS: ValueRef, - Order: AtomicOrdering) - -> ValueRef; - pub unsafe fn LLVMBuildAtomicRMW(B: BuilderRef, - Op: AtomicBinOp, - LHS: ValueRef, - RHS: ValueRef, - Order: AtomicOrdering) - -> ValueRef; + pub fn LLVMBuildAtomicCmpXchg(B: BuilderRef, + LHS: ValueRef, + CMP: ValueRef, + RHS: ValueRef, + Order: AtomicOrdering) + -> ValueRef; + pub fn LLVMBuildAtomicRMW(B: BuilderRef, + Op: AtomicBinOp, + LHS: ValueRef, + RHS: ValueRef, + Order: AtomicOrdering) + -> ValueRef; - pub unsafe fn LLVMBuildAtomicFence(B: BuilderRef, Order: AtomicOrdering); + pub fn LLVMBuildAtomicFence(B: BuilderRef, Order: AtomicOrdering); /* Selected entries from the downcasts. */ #[fast_ffi] - pub unsafe fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef; + pub fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef; /** Writes a module to the specified path. Returns 0 on success. */ #[fast_ffi] - pub unsafe fn LLVMWriteBitcodeToFile(M: ModuleRef, - Path: *c_char) -> c_int; + pub fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: *c_char) -> c_int; /** Creates target data from a target layout string. */ #[fast_ffi] - 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 fn LLVMCreateTargetData(StringRep: *c_char) -> TargetDataRef; + /// Adds the target data to the given pass manager. The pass manager + /// references the target data only weakly. #[fast_ffi] - pub unsafe fn LLVMAddTargetData(TD: TargetDataRef, - PM: PassManagerRef); + pub fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef); /** Number of bytes clobbered when doing a Store to *T. */ #[fast_ffi] - pub unsafe fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef) - -> c_ulonglong; + pub fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef) + -> c_ulonglong; /** Number of bytes clobbered when doing a Store to *T. */ #[fast_ffi] - pub unsafe fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef) - -> c_ulonglong; + pub fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef) + -> c_ulonglong; /** Distance between successive elements in an array of T. Includes ABI padding. */ #[fast_ffi] - pub unsafe fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) - -> c_uint; + pub fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint; /** Returns the preferred alignment of a type. */ #[fast_ffi] - pub unsafe fn LLVMPreferredAlignmentOfType(TD: TargetDataRef, - Ty: TypeRef) -> c_uint; + pub fn LLVMPreferredAlignmentOfType(TD: TargetDataRef, Ty: TypeRef) + -> c_uint; /** Returns the minimum alignment of a type. */ #[fast_ffi] - pub unsafe fn LLVMABIAlignmentOfType(TD: TargetDataRef, - Ty: TypeRef) -> c_uint; + pub fn LLVMABIAlignmentOfType(TD: TargetDataRef, Ty: TypeRef) + -> c_uint; - /** Computes the byte offset of the indexed struct element for a target. */ + /// Computes the byte offset of the indexed struct element for a + /// target. #[fast_ffi] - pub unsafe fn LLVMOffsetOfElement(TD: TargetDataRef, - StructTy: TypeRef, - Element: c_uint) - -> c_ulonglong; + pub fn LLVMOffsetOfElement(TD: TargetDataRef, + StructTy: TypeRef, + Element: c_uint) + -> c_ulonglong; /** * Returns the minimum alignment of a type when part of a call frame. */ #[fast_ffi] - pub unsafe fn LLVMCallFrameAlignmentOfType(TD: TargetDataRef, - Ty: TypeRef) - -> c_uint; + pub fn LLVMCallFrameAlignmentOfType(TD: TargetDataRef, Ty: TypeRef) + -> c_uint; /** Disposes target data. */ #[fast_ffi] - pub unsafe fn LLVMDisposeTargetData(TD: TargetDataRef); + pub fn LLVMDisposeTargetData(TD: TargetDataRef); /** Creates a pass manager. */ #[fast_ffi] - pub unsafe fn LLVMCreatePassManager() -> PassManagerRef; + pub fn LLVMCreatePassManager() -> PassManagerRef; /** Creates a function-by-function pass manager */ #[fast_ffi] - pub unsafe fn LLVMCreateFunctionPassManagerForModule(M:ModuleRef) -> PassManagerRef; + pub fn LLVMCreateFunctionPassManagerForModule(M: ModuleRef) + -> PassManagerRef; /** Disposes a pass manager. */ #[fast_ffi] - pub unsafe fn LLVMDisposePassManager(PM: PassManagerRef); + pub fn LLVMDisposePassManager(PM: PassManagerRef); /** Runs a pass manager on a module. */ #[fast_ffi] - pub unsafe fn LLVMRunPassManager(PM: PassManagerRef, - M: ModuleRef) -> Bool; + pub fn LLVMRunPassManager(PM: PassManagerRef, M: ModuleRef) -> Bool; /** Runs the function passes on the provided function. */ #[fast_ffi] - pub unsafe fn LLVMRunFunctionPassManager(FPM:PassManagerRef, F:ValueRef) -> Bool; + pub fn LLVMRunFunctionPassManager(FPM: PassManagerRef, F: ValueRef) + -> Bool; /** Initializes all the function passes scheduled in the manager */ #[fast_ffi] - pub unsafe fn LLVMInitializeFunctionPassManager(FPM:PassManagerRef) -> Bool; + pub fn LLVMInitializeFunctionPassManager(FPM: PassManagerRef) -> Bool; /** Finalizes all the function passes scheduled in the manager */ #[fast_ffi] - pub unsafe fn LLVMFinalizeFunctionPassManager(FPM:PassManagerRef) -> Bool; + pub fn LLVMFinalizeFunctionPassManager(FPM: PassManagerRef) -> Bool; #[fast_ffi] - pub unsafe fn LLVMInitializePasses(); + pub fn LLVMInitializePasses(); #[fast_ffi] - pub unsafe fn LLVMAddPass(PM:PassManagerRef,P:PassRef); + pub fn LLVMAddPass(PM: PassManagerRef, P: PassRef); #[fast_ffi] - pub unsafe fn LLVMCreatePass(PassName:*c_char) -> PassRef; + pub fn LLVMCreatePass(PassName: *c_char) -> PassRef; #[fast_ffi] - pub unsafe fn LLVMDestroyPass(P: PassRef); + pub fn LLVMDestroyPass(P: PassRef); /** Adds a verification pass. */ #[fast_ffi] - pub unsafe fn LLVMAddVerifierPass(PM: PassManagerRef); + pub fn LLVMAddVerifierPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddGlobalOptimizerPass(PM: PassManagerRef); + pub fn LLVMAddGlobalOptimizerPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddIPSCCPPass(PM: PassManagerRef); + pub fn LLVMAddIPSCCPPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddDeadArgEliminationPass(PM: PassManagerRef); + pub fn LLVMAddDeadArgEliminationPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddInstructionCombiningPass(PM: PassManagerRef); + pub fn LLVMAddInstructionCombiningPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddCFGSimplificationPass(PM: PassManagerRef); + pub fn LLVMAddCFGSimplificationPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddFunctionInliningPass(PM: PassManagerRef); + pub fn LLVMAddFunctionInliningPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddFunctionAttrsPass(PM: PassManagerRef); + pub fn LLVMAddFunctionAttrsPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddScalarReplAggregatesPass(PM: PassManagerRef); + pub fn LLVMAddScalarReplAggregatesPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddScalarReplAggregatesPassSSA(PM: PassManagerRef); + pub fn LLVMAddScalarReplAggregatesPassSSA(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddJumpThreadingPass(PM: PassManagerRef); + pub fn LLVMAddJumpThreadingPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddConstantPropagationPass(PM: PassManagerRef); + pub fn LLVMAddConstantPropagationPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddReassociatePass(PM: PassManagerRef); + pub fn LLVMAddReassociatePass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddLoopRotatePass(PM: PassManagerRef); + pub fn LLVMAddLoopRotatePass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddLICMPass(PM: PassManagerRef); + pub fn LLVMAddLICMPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddLoopUnswitchPass(PM: PassManagerRef); + pub fn LLVMAddLoopUnswitchPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddLoopDeletionPass(PM: PassManagerRef); + pub fn LLVMAddLoopDeletionPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddLoopUnrollPass(PM: PassManagerRef); + pub fn LLVMAddLoopUnrollPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddGVNPass(PM: PassManagerRef); + pub fn LLVMAddGVNPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddMemCpyOptPass(PM: PassManagerRef); + pub fn LLVMAddMemCpyOptPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddSCCPPass(PM: PassManagerRef); + pub fn LLVMAddSCCPPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddDeadStoreEliminationPass(PM: PassManagerRef); + pub fn LLVMAddDeadStoreEliminationPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddStripDeadPrototypesPass(PM: PassManagerRef); + pub fn LLVMAddStripDeadPrototypesPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddConstantMergePass(PM: PassManagerRef); + pub fn LLVMAddConstantMergePass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddArgumentPromotionPass(PM: PassManagerRef); + pub fn LLVMAddArgumentPromotionPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddTailCallEliminationPass(PM: PassManagerRef); + pub fn LLVMAddTailCallEliminationPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddIndVarSimplifyPass(PM: PassManagerRef); + pub fn LLVMAddIndVarSimplifyPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddAggressiveDCEPass(PM: PassManagerRef); + pub fn LLVMAddAggressiveDCEPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddGlobalDCEPass(PM: PassManagerRef); + pub fn LLVMAddGlobalDCEPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddCorrelatedValuePropagationPass(PM: - PassManagerRef); + pub fn LLVMAddCorrelatedValuePropagationPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddPruneEHPass(PM: PassManagerRef); + pub fn LLVMAddPruneEHPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddSimplifyLibCallsPass(PM: PassManagerRef); + pub fn LLVMAddSimplifyLibCallsPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddLoopIdiomPass(PM: PassManagerRef); + pub fn LLVMAddLoopIdiomPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddEarlyCSEPass(PM: PassManagerRef); + pub fn LLVMAddEarlyCSEPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddTypeBasedAliasAnalysisPass(PM: PassManagerRef); + pub fn LLVMAddTypeBasedAliasAnalysisPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMAddBasicAliasAnalysisPass(PM: PassManagerRef); + pub fn LLVMAddBasicAliasAnalysisPass(PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef; + pub fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef; #[fast_ffi] - pub unsafe fn LLVMPassManagerBuilderDispose(PMB: - PassManagerBuilderRef); + pub fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef); #[fast_ffi] - pub unsafe fn LLVMPassManagerBuilderSetOptLevel( - PMB: PassManagerBuilderRef, OptimizationLevel: c_uint); + pub fn LLVMPassManagerBuilderSetOptLevel(PMB: PassManagerBuilderRef, + OptimizationLevel: c_uint); #[fast_ffi] - pub unsafe fn LLVMPassManagerBuilderSetSizeLevel( - PMB: PassManagerBuilderRef, Value: Bool); + pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: PassManagerBuilderRef, + Value: Bool); #[fast_ffi] - pub unsafe fn LLVMPassManagerBuilderSetDisableUnitAtATime( - PMB: PassManagerBuilderRef, Value: Bool); + pub fn LLVMPassManagerBuilderSetDisableUnitAtATime( + PMB: PassManagerBuilderRef, + Value: Bool); #[fast_ffi] - pub unsafe fn LLVMPassManagerBuilderSetDisableUnrollLoops( - PMB: PassManagerBuilderRef, Value: Bool); + pub fn LLVMPassManagerBuilderSetDisableUnrollLoops( + PMB: PassManagerBuilderRef, + Value: Bool); #[fast_ffi] - pub unsafe fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls - (PMB: PassManagerBuilderRef, Value: Bool); + pub fn LLVMPassManagerBuilderSetDisableSimplifyLibCalls( + PMB: PassManagerBuilderRef, + Value: Bool); #[fast_ffi] - pub unsafe fn LLVMPassManagerBuilderUseInlinerWithThreshold - (PMB: PassManagerBuilderRef, threshold: c_uint); + pub fn LLVMPassManagerBuilderUseInlinerWithThreshold( + PMB: PassManagerBuilderRef, + threshold: c_uint); #[fast_ffi] - pub unsafe fn LLVMPassManagerBuilderPopulateModulePassManager - (PMB: PassManagerBuilderRef, PM: PassManagerRef); + pub fn LLVMPassManagerBuilderPopulateModulePassManager( + PMB: PassManagerBuilderRef, + PM: PassManagerRef); #[fast_ffi] - pub unsafe fn LLVMPassManagerBuilderPopulateFunctionPassManager - (PMB: PassManagerBuilderRef, PM: PassManagerRef); + pub fn LLVMPassManagerBuilderPopulateFunctionPassManager( + PMB: PassManagerBuilderRef, + PM: PassManagerRef); /** Destroys a memory buffer. */ #[fast_ffi] - pub unsafe fn LLVMDisposeMemoryBuffer(MemBuf: MemoryBufferRef); + pub fn LLVMDisposeMemoryBuffer(MemBuf: MemoryBufferRef); /* Stuff that's in rustllvm/ because it's not upstream yet. */ /** Opens an object file. */ #[fast_ffi] - pub unsafe fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef) - -> ObjectFileRef; + pub fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef) -> ObjectFileRef; /** Closes an object file. */ #[fast_ffi] - pub unsafe fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef); + pub fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef); /** Enumerates the sections in an object file. */ #[fast_ffi] - pub unsafe fn LLVMGetSections(ObjFile: ObjectFileRef) - -> SectionIteratorRef; + pub fn LLVMGetSections(ObjFile: ObjectFileRef) -> SectionIteratorRef; /** Destroys a section iterator. */ #[fast_ffi] - pub unsafe fn LLVMDisposeSectionIterator(SI: SectionIteratorRef); + pub fn LLVMDisposeSectionIterator(SI: SectionIteratorRef); /** Returns true if the section iterator is at the end of the section list: */ #[fast_ffi] - pub unsafe fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef, - SI: SectionIteratorRef) -> Bool; + pub fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef, + SI: SectionIteratorRef) + -> Bool; /** Moves the section iterator to point to the next section. */ #[fast_ffi] - pub unsafe fn LLVMMoveToNextSection(SI: SectionIteratorRef); + pub fn LLVMMoveToNextSection(SI: SectionIteratorRef); /** Returns the current section name. */ #[fast_ffi] - pub unsafe fn LLVMGetSectionName(SI: SectionIteratorRef) -> *c_char; + pub fn LLVMGetSectionName(SI: SectionIteratorRef) -> *c_char; /** Returns the current section size. */ #[fast_ffi] - pub unsafe fn LLVMGetSectionSize(SI: SectionIteratorRef) - -> c_ulonglong; + pub fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong; /** Returns the current section contents as a string buffer. */ #[fast_ffi] - pub unsafe fn LLVMGetSectionContents(SI: SectionIteratorRef) - -> *c_char; + pub fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *c_char; /** Reads the given file and returns it as a memory buffer. Use LLVMDisposeMemoryBuffer() to get rid of it. */ #[fast_ffi] - pub unsafe fn LLVMRustCreateMemoryBufferWithContentsOfFile( - Path: *c_char) - -> MemoryBufferRef; + pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *c_char) + -> MemoryBufferRef; #[fast_ffi] - pub unsafe fn LLVMRustWriteOutputFile(PM: PassManagerRef, - M: ModuleRef, - Triple: *c_char, - Feature: *c_char, - Output: *c_char, - // FIXME: When #2334 is fixed, - // change c_uint to FileType - FileType: c_uint, - OptLevel: c_int, - EnableSegmentedStacks: bool) - -> bool; + pub fn LLVMRustWriteOutputFile(PM: PassManagerRef, + M: ModuleRef, + Triple: *c_char, + Feature: *c_char, + Output: *c_char, + // FIXME: When #2334 is fixed, + // change c_uint to FileType + FileType: c_uint, + OptLevel: c_int, + EnableSegmentedStacks: bool) + -> bool; /** Returns a string describing the last error caused by an LLVMRust* call. */ #[fast_ffi] - pub unsafe fn LLVMRustGetLastError() -> *c_char; + pub fn LLVMRustGetLastError() -> *c_char; /** Prepare the JIT. Returns a memory manager that can load crates. */ #[fast_ffi] - pub unsafe fn LLVMRustPrepareJIT(__morestack: *()) -> *(); + pub fn LLVMRustPrepareJIT(__morestack: *()) -> *(); /** Load a crate into the memory manager. */ #[fast_ffi] - pub unsafe fn LLVMRustLoadCrate(MM: *(), - Filename: *c_char) - -> bool; + pub fn LLVMRustLoadCrate(MM: *(), Filename: *c_char) -> bool; /** Execute the JIT engine. */ #[fast_ffi] - pub unsafe fn LLVMRustBuildJIT(MM: *(), - M: ModuleRef, - EnableSegmentedStacks: bool) -> ExecutionEngineRef; + pub fn LLVMRustBuildJIT(MM: *(), + M: ModuleRef, + EnableSegmentedStacks: bool) + -> ExecutionEngineRef; /** Parses the bitcode in the given memory buffer. */ #[fast_ffi] - pub unsafe fn LLVMRustParseBitcode(MemBuf: MemoryBufferRef) - -> ModuleRef; + pub fn LLVMRustParseBitcode(MemBuf: MemoryBufferRef) -> ModuleRef; /** Parses LLVM asm in the given file */ #[fast_ffi] - pub unsafe fn LLVMRustParseAssemblyFile(Filename: *c_char, - C: ContextRef) - -> ModuleRef; + pub fn LLVMRustParseAssemblyFile(Filename: *c_char, C: ContextRef) + -> ModuleRef; #[fast_ffi] - pub unsafe fn LLVMRustAddPrintModulePass(PM: PassManagerRef, - M: ModuleRef, - Output: *c_char); + pub fn LLVMRustAddPrintModulePass(PM: PassManagerRef, + M: ModuleRef, + Output: *c_char); /** Turn on LLVM pass-timing. */ #[fast_ffi] - pub unsafe fn LLVMRustEnableTimePasses(); + pub fn LLVMRustEnableTimePasses(); /// Print the pass timings since static dtors aren't picking them up. #[fast_ffi] - pub unsafe fn LLVMRustPrintPassTimings(); + pub fn LLVMRustPrintPassTimings(); #[fast_ffi] - pub unsafe fn LLVMRustStartMultithreading() -> bool; + pub fn LLVMRustStartMultithreading() -> bool; #[fast_ffi] - pub unsafe fn LLVMStructCreateNamed(C: ContextRef, Name: *c_char) - -> TypeRef; + pub fn LLVMStructCreateNamed(C: ContextRef, Name: *c_char) -> TypeRef; #[fast_ffi] - pub unsafe fn LLVMStructSetBody(StructTy: TypeRef, - ElementTypes: *TypeRef, - ElementCount: c_uint, - Packed: Bool); + pub fn LLVMStructSetBody(StructTy: TypeRef, + ElementTypes: *TypeRef, + ElementCount: c_uint, + Packed: Bool); #[fast_ffi] - pub unsafe fn LLVMConstNamedStruct(S: TypeRef, - ConstantVals: *ValueRef, - Count: c_uint) - -> ValueRef; + pub fn LLVMConstNamedStruct(S: TypeRef, + ConstantVals: *ValueRef, + Count: c_uint) + -> ValueRef; /** Enables LLVM debug output. */ #[fast_ffi] - pub unsafe fn LLVMSetDebug(Enabled: c_int); + pub fn LLVMSetDebug(Enabled: c_int); /** Prepares inline assembly. */ #[fast_ffi] - pub unsafe fn LLVMInlineAsm(Ty: TypeRef, AsmString: *c_char, - Constraints: *c_char, SideEffects: Bool, - AlignStack: Bool, Dialect: c_uint) - -> ValueRef; + pub fn LLVMInlineAsm(Ty: TypeRef, + AsmString: *c_char, + Constraints: *c_char, + SideEffects: Bool, + AlignStack: Bool, + Dialect: c_uint) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMDIBuilderCreate(M: ModuleRef) -> DIBuilderRef; + pub fn LLVMDIBuilderCreate(M: ModuleRef) -> DIBuilderRef; #[fast_ffi] - pub unsafe fn LLVMDIBuilderDispose(Builder: DIBuilderRef); + pub fn LLVMDIBuilderDispose(Builder: DIBuilderRef); #[fast_ffi] - pub unsafe fn LLVMDIBuilderFinalize(Builder: DIBuilderRef); + pub fn LLVMDIBuilderFinalize(Builder: DIBuilderRef); - #[fast_ffi] - pub unsafe fn LLVMDIBuilderCreateCompileUnit( - Builder: DIBuilderRef, - Lang: c_uint, - File: *c_char, - Dir: *c_char, - Producer: *c_char, - isOptimized: bool, - Flags: *c_char, - RuntimeVer: c_uint, - SplitName: *c_char); - - #[fast_ffi] - pub unsafe fn LLVMDIBuilderCreateFile( - Builder: DIBuilderRef, - Filename: *c_char, - Directory: *c_char) -> DIFile; - - #[fast_ffi] - pub unsafe fn LLVMDIBuilderCreateSubroutineType( - Builder: DIBuilderRef, - File: DIFile, - ParameterTypes: DIArray) -> DICompositeType; + #[fast_ffi] + pub fn LLVMDIBuilderCreateCompileUnit(Builder: DIBuilderRef, + Lang: c_uint, + File: *c_char, + Dir: *c_char, + Producer: *c_char, + isOptimized: bool, + Flags: *c_char, + RuntimeVer: c_uint, + SplitName: *c_char); + + #[fast_ffi] + pub fn LLVMDIBuilderCreateFile(Builder: DIBuilderRef, + Filename: *c_char, + Directory: *c_char) + -> DIFile; + + #[fast_ffi] + pub fn LLVMDIBuilderCreateSubroutineType(Builder: DIBuilderRef, + File: DIFile, + ParameterTypes: DIArray) + -> DICompositeType; - #[fast_ffi] - pub unsafe fn LLVMDIBuilderCreateFunction( - Builder: DIBuilderRef, - Scope: DIDescriptor, - Name: *c_char, - LinkageName: *c_char, - File: DIFile, - LineNo: c_uint, - Ty: DIType, - isLocalToUnit: bool, - isDefinition: bool, - ScopeLine: c_uint, - Flags: c_uint, - isOptimized: bool, - Fn: ValueRef, - TParam: ValueRef, - Decl: ValueRef) -> DISubprogram; + #[fast_ffi] + pub fn LLVMDIBuilderCreateFunction(Builder: DIBuilderRef, + Scope: DIDescriptor, + Name: *c_char, + LinkageName: *c_char, + File: DIFile, + LineNo: c_uint, + Ty: DIType, + isLocalToUnit: bool, + isDefinition: bool, + ScopeLine: c_uint, + Flags: c_uint, + isOptimized: bool, + Fn: ValueRef, + TParam: ValueRef, + Decl: ValueRef) + -> DISubprogram; + + #[fast_ffi] + pub fn LLVMDIBuilderCreateBasicType(Builder: DIBuilderRef, + Name: *c_char, + SizeInBits: c_ulonglong, + AlignInBits: c_ulonglong, + Encoding: c_uint) + -> DIBasicType; + + #[fast_ffi] + pub fn LLVMDIBuilderCreatePointerType(Builder: DIBuilderRef, + PointeeTy: DIType, + SizeInBits: c_ulonglong, + AlignInBits: c_ulonglong, + Name: *c_char) + -> DIDerivedType; + + #[fast_ffi] + pub fn LLVMDIBuilderCreateStructType(Builder: DIBuilderRef, + Scope: DIDescriptor, + Name: *c_char, + File: DIFile, + LineNumber: c_uint, + SizeInBits: c_ulonglong, + AlignInBits: c_ulonglong, + Flags: c_uint, + DerivedFrom: DIType, + Elements: DIArray, + RunTimeLang: c_uint, + VTableHolder: ValueRef) + -> DICompositeType; + + #[fast_ffi] + pub fn LLVMDIBuilderCreateMemberType(Builder: DIBuilderRef, + Scope: DIDescriptor, + Name: *c_char, + File: DIFile, + LineNo: c_uint, + SizeInBits: c_ulonglong, + AlignInBits: c_ulonglong, + OffsetInBits: c_ulonglong, + Flags: c_uint, + Ty: DIType) + -> DIDerivedType; + + #[fast_ffi] + pub fn LLVMDIBuilderCreateLexicalBlock(Builder: DIBuilderRef, + Scope: DIDescriptor, + File: DIFile, + Line: c_uint, + Col: c_uint) + -> DILexicalBlock; + + #[fast_ffi] + pub fn LLVMDIBuilderCreateLocalVariable(Builder: DIBuilderRef, + Tag: c_uint, + Scope: DIDescriptor, + Name: *c_char, + File: DIFile, + LineNo: c_uint, + Ty: DIType, + AlwaysPreserve: bool, + Flags: c_uint, + ArgNo: c_uint) + -> DIVariable; + + #[fast_ffi] + pub fn LLVMDIBuilderCreateArrayType(Builder: DIBuilderRef, + Size: c_ulonglong, + AlignInBits: c_ulonglong, + Ty: DIType, + Subscripts: DIArray) + -> DIType; + + #[fast_ffi] + pub fn LLVMDIBuilderCreateVectorType(Builder: DIBuilderRef, + Size: c_ulonglong, + AlignInBits: c_ulonglong, + Ty: DIType, + Subscripts: DIArray) + -> DIType; + + #[fast_ffi] + pub fn LLVMDIBuilderGetOrCreateSubrange(Builder: DIBuilderRef, + Lo: c_longlong, + Count: c_longlong) + -> DISubrange; + + #[fast_ffi] + pub fn LLVMDIBuilderGetOrCreateArray(Builder: DIBuilderRef, + Ptr: *DIDescriptor, + Count: c_uint) + -> DIArray; + + #[fast_ffi] + pub fn LLVMDIBuilderInsertDeclareAtEnd(Builder: DIBuilderRef, + Val: ValueRef, + VarInfo: DIVariable, + InsertAtEnd: BasicBlockRef) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMDIBuilderCreateBasicType( - Builder: DIBuilderRef, - Name: *c_char, - SizeInBits: c_ulonglong, - AlignInBits: c_ulonglong, - Encoding: c_uint) -> DIBasicType; + pub fn LLVMDIBuilderInsertDeclareBefore(Builder: DIBuilderRef, + Val: ValueRef, + VarInfo: DIVariable, + InsertBefore: ValueRef) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMDIBuilderCreatePointerType( - Builder: DIBuilderRef, - PointeeTy: DIType, - SizeInBits: c_ulonglong, - AlignInBits: c_ulonglong, - Name: *c_char) -> DIDerivedType; + pub fn LLVMDIBuilderCreateEnumerator(Builder: DIBuilderRef, + Name: *c_char, + Val: c_ulonglong) + -> ValueRef; #[fast_ffi] - pub unsafe fn LLVMDIBuilderCreateStructType( - Builder: DIBuilderRef, - Scope: DIDescriptor, - Name: *c_char, - File: DIFile, - LineNumber: c_uint, - SizeInBits: c_ulonglong, - AlignInBits: c_ulonglong, - Flags: c_uint, - DerivedFrom: DIType, - Elements: DIArray, - RunTimeLang: c_uint, - VTableHolder: ValueRef) -> DICompositeType; - - #[fast_ffi] - pub unsafe fn LLVMDIBuilderCreateMemberType( - Builder: DIBuilderRef, - Scope: DIDescriptor, - Name: *c_char, - File: DIFile, - LineNo: c_uint, - SizeInBits: c_ulonglong, - AlignInBits: c_ulonglong, - OffsetInBits: c_ulonglong, - Flags: c_uint, - Ty: DIType) -> DIDerivedType; - - #[fast_ffi] - pub unsafe fn LLVMDIBuilderCreateLexicalBlock( - Builder: DIBuilderRef, - Scope: DIDescriptor, - File: DIFile, - Line: c_uint, - Col: c_uint) -> DILexicalBlock; - - #[fast_ffi] - pub unsafe fn LLVMDIBuilderCreateLocalVariable( - Builder: DIBuilderRef, - Tag: c_uint, - Scope: DIDescriptor, - Name: *c_char, - File: DIFile, - LineNo: c_uint, - Ty: DIType, - AlwaysPreserve: bool, - Flags: c_uint, - ArgNo: c_uint) -> DIVariable; - - #[fast_ffi] - pub unsafe fn LLVMDIBuilderCreateArrayType( - Builder: DIBuilderRef, - Size: c_ulonglong, - AlignInBits: c_ulonglong, - Ty: DIType, - Subscripts: DIArray) -> DIType; - - #[fast_ffi] - pub unsafe fn LLVMDIBuilderCreateVectorType( - Builder: DIBuilderRef, - Size: c_ulonglong, - AlignInBits: c_ulonglong, - Ty: DIType, - Subscripts: DIArray) -> DIType; - - #[fast_ffi] - pub unsafe fn LLVMDIBuilderGetOrCreateSubrange( - Builder: DIBuilderRef, - Lo: c_longlong, - Count: c_longlong) -> DISubrange; - - #[fast_ffi] - pub unsafe fn LLVMDIBuilderGetOrCreateArray( - Builder: DIBuilderRef, - Ptr: *DIDescriptor, - Count: c_uint) -> DIArray; - - #[fast_ffi] - pub unsafe fn LLVMDIBuilderInsertDeclareAtEnd( - Builder: DIBuilderRef, - Val: ValueRef, - VarInfo: DIVariable, - InsertAtEnd: BasicBlockRef) -> ValueRef; - - #[fast_ffi] - pub unsafe fn LLVMDIBuilderInsertDeclareBefore( - Builder: DIBuilderRef, - Val: ValueRef, - VarInfo: DIVariable, - InsertBefore: ValueRef) -> ValueRef; - - #[fast_ffi] - pub unsafe fn LLVMDIBuilderCreateEnumerator( - Builder: DIBuilderRef, - Name: *c_char, - Val: c_ulonglong) -> ValueRef; - - #[fast_ffi] - pub unsafe fn LLVMDIBuilderCreateEnumerationType( - Builder: DIBuilderRef, - Scope: ValueRef, - Name: *c_char, - File: ValueRef, - LineNumber: c_uint, - SizeInBits: c_ulonglong, - AlignInBits: c_ulonglong, - Elements: ValueRef, - ClassType: ValueRef) -> ValueRef; - - #[fast_ffi] - pub unsafe fn LLVMDIBuilderCreateUnionType( - Builder: DIBuilderRef, - Scope: ValueRef, - Name: *c_char, - File: ValueRef, - LineNumber: c_uint, - SizeInBits: c_ulonglong, - AlignInBits: c_ulonglong, - Flags: c_uint , - Elements: ValueRef, - RunTimeLang: c_uint) -> ValueRef; + pub fn LLVMDIBuilderCreateEnumerationType(Builder: DIBuilderRef, + Scope: ValueRef, + Name: *c_char, + File: ValueRef, + LineNumber: c_uint, + SizeInBits: c_ulonglong, + AlignInBits: c_ulonglong, + Elements: ValueRef, + ClassType: ValueRef) + -> ValueRef; + + #[fast_ffi] + pub fn LLVMDIBuilderCreateUnionType(Builder: DIBuilderRef, + Scope: ValueRef, + Name: *c_char, + File: ValueRef, + LineNumber: c_uint, + SizeInBits: c_ulonglong, + AlignInBits: c_ulonglong, + Flags: c_uint, + Elements: ValueRef, + RunTimeLang: c_uint) + -> ValueRef; } } diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 3915ae9f421..8374fe1df0d 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -1151,9 +1151,9 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext, ebml_w.start_tag(tag_items_data_item); match nitem.node { - foreign_item_fn(_, purity, _) => { + foreign_item_fn(*) => { encode_def_id(ebml_w, local_def(nitem.id)); - encode_family(ebml_w, purity_fn_family(purity)); + encode_family(ebml_w, purity_fn_family(impure_fn)); encode_bounds_and_type(ebml_w, ecx, &lookup_item_type(ecx.tcx,local_def(nitem.id))); encode_name(ecx, ebml_w, nitem.ident); diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 4348823eb0f..2e9c19c85f8 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -789,7 +789,7 @@ fn check_item_ctypes(cx: &Context, it: &ast::item) { ast::item_foreign_mod(ref nmod) if !nmod.abis.is_intrinsic() => { foreach ni in nmod.items.iter() { match ni.node { - ast::foreign_item_fn(ref decl, _, _) => { + ast::foreign_item_fn(ref decl, _) => { check_foreign_fn(cx, decl); } ast::foreign_item_static(ref t, _) => { check_ty(cx, t); } diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index bdce2595e78..b564dfde3c4 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -1523,7 +1523,7 @@ impl Resolver { foreign_item.span); match foreign_item.node { - foreign_item_fn(_, _, ref generics) => { + foreign_item_fn(_, ref generics) => { let def = def_fn(local_def(foreign_item.id), unsafe_fn); name_bindings.define_value(Public, def, foreign_item.span); @@ -3606,7 +3606,7 @@ impl Resolver { do self.with_scope(Some(item.ident)) { foreach foreign_item in foreign_module.items.iter() { match foreign_item.node { - foreign_item_fn(_, _, ref generics) => { + foreign_item_fn(_, ref generics) => { self.with_type_parameter_rib( HasTypeParameters( generics, foreign_item.id, 0, diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 584a59c35ae..e03983636a0 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -1137,7 +1137,7 @@ pub fn ty_of_foreign_item(ccx: &CrateCtxt, abis: AbiSet) -> ty::ty_param_bounds_and_ty { match it.node { - ast::foreign_item_fn(ref fn_decl, _, ref generics) => { + ast::foreign_item_fn(ref fn_decl, ref generics) => { ty_of_foreign_fn_decl(ccx, fn_decl, local_def(it.id), diff --git a/src/librustdoc/tystr_pass.rs b/src/librustdoc/tystr_pass.rs index 044ab322605..abfc3517d60 100644 --- a/src/librustdoc/tystr_pass.rs +++ b/src/librustdoc/tystr_pass.rs @@ -69,13 +69,24 @@ fn get_fn_sig(srv: astsrv::Srv, fn_id: doc::AstId) -> Option<~str> { ast_map::node_item(@ast::item { ident: ident, node: ast::item_fn(ref decl, purity, _, ref tys, _), _ - }, _) | + }, _) => { + Some(pprust::fun_to_str(decl, + purity, + ident, + None, + tys, + token::get_ident_interner())) + } ast_map::node_foreign_item(@ast::foreign_item { ident: ident, - node: ast::foreign_item_fn(ref decl, purity, ref tys), _ + node: ast::foreign_item_fn(ref decl, ref tys), _ }, _, _, _) => { - Some(pprust::fun_to_str(decl, purity, ident, None, tys, - token::get_ident_interner())) + Some(pprust::fun_to_str(decl, + ast::impure_fn, + ident, + None, + tys, + token::get_ident_interner())) } _ => fail!("get_fn_sig: fn_id not bound to a fn item") } diff --git a/src/libstd/cleanup.rs b/src/libstd/cleanup.rs index 24ca6fc2309..b9535091ed8 100644 --- a/src/libstd/cleanup.rs +++ b/src/libstd/cleanup.rs @@ -156,6 +156,6 @@ pub mod rustrt { extern { #[rust_stack] // FIXME (#4386): Unable to make following method private. - pub unsafe fn rust_get_task() -> *c_void; + pub fn rust_get_task() -> *c_void; } } diff --git a/src/libstd/gc.rs b/src/libstd/gc.rs index 9a8db6990b6..2e27f82f6f6 100644 --- a/src/libstd/gc.rs +++ b/src/libstd/gc.rs @@ -66,10 +66,10 @@ pub mod rustrt { #[link_name = "rustrt"] extern { #[rust_stack] - pub unsafe fn rust_gc_metadata() -> *Word; + pub fn rust_gc_metadata() -> *Word; - pub unsafe fn rust_get_stack_segment() -> *StackSegment; - pub unsafe fn rust_get_c_stack() -> *StackSegment; + pub fn rust_get_stack_segment() -> *StackSegment; + pub fn rust_get_c_stack() -> *StackSegment; } } diff --git a/src/libstd/io.rs b/src/libstd/io.rs index 153286a311a..606c958b408 100644 --- a/src/libstd/io.rs +++ b/src/libstd/io.rs @@ -77,9 +77,9 @@ pub mod rustrt { #[abi = "cdecl"] #[link_name = "rustrt"] extern { - pub unsafe fn rust_get_stdin() -> *libc::FILE; - pub unsafe fn rust_get_stdout() -> *libc::FILE; - pub unsafe fn rust_get_stderr() -> *libc::FILE; + pub fn rust_get_stdin() -> *libc::FILE; + pub fn rust_get_stdout() -> *libc::FILE; + pub fn rust_get_stderr() -> *libc::FILE; } } diff --git a/src/libstd/libc.rs b/src/libstd/libc.rs index aecf97f5756..f96d3ce263e 100644 --- a/src/libstd/libc.rs +++ b/src/libstd/libc.rs @@ -2400,19 +2400,19 @@ pub mod funcs { use libc::types::os::arch::c95::{c_char, c_int}; extern { - pub unsafe fn isalnum(c: c_int) -> c_int; - pub unsafe fn isalpha(c: c_int) -> c_int; - pub unsafe fn iscntrl(c: c_int) -> c_int; - pub unsafe fn isdigit(c: c_int) -> c_int; - pub unsafe fn isgraph(c: c_int) -> c_int; - pub unsafe fn islower(c: c_int) -> c_int; - pub unsafe fn isprint(c: c_int) -> c_int; - pub unsafe fn ispunct(c: c_int) -> c_int; - pub unsafe fn isspace(c: c_int) -> c_int; - pub unsafe fn isupper(c: c_int) -> c_int; - pub unsafe fn isxdigit(c: c_int) -> c_int; - pub unsafe fn tolower(c: c_char) -> c_char; - pub unsafe fn toupper(c: c_char) -> c_char; + pub fn isalnum(c: c_int) -> c_int; + pub fn isalpha(c: c_int) -> c_int; + pub fn iscntrl(c: c_int) -> c_int; + pub fn isdigit(c: c_int) -> c_int; + pub fn isgraph(c: c_int) -> c_int; + pub fn islower(c: c_int) -> c_int; + pub fn isprint(c: c_int) -> c_int; + pub fn ispunct(c: c_int) -> c_int; + pub fn isspace(c: c_int) -> c_int; + pub fn isupper(c: c_int) -> c_int; + pub fn isxdigit(c: c_int) -> c_int; + pub fn tolower(c: c_char) -> c_char; + pub fn toupper(c: c_char) -> c_char; } } @@ -2423,66 +2423,58 @@ pub mod funcs { use libc::types::os::arch::c95::{c_char, c_int, c_long, size_t}; extern { - pub unsafe fn fopen(filename: *c_char, mode: *c_char) - -> *FILE; - pub unsafe fn freopen(filename: *c_char, - mode: *c_char, - file: *FILE) - -> *FILE; - pub unsafe fn fflush(file: *FILE) -> c_int; - pub unsafe fn fclose(file: *FILE) -> c_int; - pub unsafe fn remove(filename: *c_char) -> c_int; - pub unsafe fn rename(oldname: *c_char, newname: *c_char) - -> c_int; - pub unsafe fn tmpfile() -> *FILE; - pub unsafe fn setvbuf(stream: *FILE, - buffer: *c_char, - mode: c_int, - size: size_t) - -> c_int; - pub unsafe fn setbuf(stream: *FILE, buf: *c_char); + pub fn fopen(filename: *c_char, mode: *c_char) -> *FILE; + pub fn freopen(filename: *c_char, mode: *c_char, file: *FILE) + -> *FILE; + pub fn fflush(file: *FILE) -> c_int; + pub fn fclose(file: *FILE) -> c_int; + pub fn remove(filename: *c_char) -> c_int; + pub fn rename(oldname: *c_char, newname: *c_char) -> c_int; + pub fn tmpfile() -> *FILE; + pub fn setvbuf(stream: *FILE, + buffer: *c_char, + mode: c_int, + size: size_t) + -> c_int; + pub fn setbuf(stream: *FILE, buf: *c_char); // Omitted: printf and scanf variants. - pub unsafe fn fgetc(stream: *FILE) -> c_int; + pub fn fgetc(stream: *FILE) -> c_int; #[fast_ffi] - pub unsafe fn fgets(buf: *mut c_char, - n: c_int, - stream: *FILE) - -> *c_char; + pub fn fgets(buf: *mut c_char, n: c_int, stream: *FILE) + -> *c_char; #[fast_ffi] - pub unsafe fn fputc(c: c_int, stream: *FILE) -> c_int; + pub fn fputc(c: c_int, stream: *FILE) -> c_int; #[fast_ffi] - pub unsafe fn fputs(s: *c_char, stream: *FILE) -> *c_char; + pub fn fputs(s: *c_char, stream: *FILE) -> *c_char; // Omitted: getc, getchar (might be macros). // Omitted: gets, so ridiculously unsafe that it should not // survive. // Omitted: putc, putchar (might be macros). - pub unsafe fn puts(s: *c_char) -> c_int; - pub unsafe fn ungetc(c: c_int, stream: *FILE) -> c_int; + pub fn puts(s: *c_char) -> c_int; + pub fn ungetc(c: c_int, stream: *FILE) -> c_int; #[fast_ffi] - pub unsafe fn fread(ptr: *mut c_void, - size: size_t, - nobj: size_t, - stream: *FILE) - -> size_t; + pub fn fread(ptr: *mut c_void, + size: size_t, + nobj: size_t, + stream: *FILE) + -> size_t; #[fast_ffi] - pub unsafe fn fwrite(ptr: *c_void, - size: size_t, - nobj: size_t, - stream: *FILE) - -> size_t; - pub unsafe fn fseek(stream: *FILE, - offset: c_long, - whence: c_int) - -> c_int; - pub unsafe fn ftell(stream: *FILE) -> c_long; - pub unsafe fn rewind(stream: *FILE); - pub unsafe fn fgetpos(stream: *FILE, ptr: *fpos_t) -> c_int; - pub unsafe fn fsetpos(stream: *FILE, ptr: *fpos_t) -> c_int; - pub unsafe fn feof(stream: *FILE) -> c_int; - pub unsafe fn ferror(stream: *FILE) -> c_int; - pub unsafe fn perror(s: *c_char); + pub fn fwrite(ptr: *c_void, + size: size_t, + nobj: size_t, + stream: *FILE) + -> size_t; + pub fn fseek(stream: *FILE, offset: c_long, whence: c_int) + -> c_int; + pub fn ftell(stream: *FILE) -> c_long; + pub fn rewind(stream: *FILE); + pub fn fgetpos(stream: *FILE, ptr: *fpos_t) -> c_int; + pub fn fsetpos(stream: *FILE, ptr: *fpos_t) -> c_int; + pub fn feof(stream: *FILE) -> c_int; + pub fn ferror(stream: *FILE) -> c_int; + pub fn perror(s: *c_char); } } @@ -2495,33 +2487,32 @@ pub mod funcs { use libc::types::os::arch::c95::{size_t}; extern { - pub unsafe fn abs(i: c_int) -> c_int; - pub unsafe fn labs(i: c_long) -> c_long; + pub fn abs(i: c_int) -> c_int; + pub fn labs(i: c_long) -> c_long; // Omitted: div, ldiv (return pub type incomplete). - pub unsafe fn atof(s: *c_char) -> c_double; - pub unsafe fn atoi(s: *c_char) -> c_int; - pub unsafe fn strtod(s: *c_char, endp: **c_char) -> c_double; - pub unsafe fn strtol(s: *c_char, endp: **c_char, base: c_int) - -> c_long; - pub unsafe fn strtoul(s: *c_char, endp: **c_char, base: c_int) - -> c_ulong; + pub fn atof(s: *c_char) -> c_double; + pub fn atoi(s: *c_char) -> c_int; + pub fn strtod(s: *c_char, endp: **c_char) -> c_double; + pub fn strtol(s: *c_char, endp: **c_char, base: c_int) + -> c_long; + pub fn strtoul(s: *c_char, endp: **c_char, base: c_int) + -> c_ulong; #[fast_ffi] - pub unsafe fn calloc(nobj: size_t, size: size_t) -> *c_void; + pub fn calloc(nobj: size_t, size: size_t) -> *c_void; #[fast_ffi] - pub unsafe fn malloc(size: size_t) -> *c_void; + pub fn malloc(size: size_t) -> *c_void; #[fast_ffi] - pub unsafe fn realloc(p: *mut c_void, size: size_t) - -> *mut c_void; + pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; #[fast_ffi] - pub unsafe fn free(p: *c_void); - pub unsafe fn abort() -> !; - pub unsafe fn exit(status: c_int) -> !; + pub fn free(p: *c_void); + pub fn abort() -> !; + pub fn exit(status: c_int) -> !; // Omitted: atexit. - pub unsafe fn system(s: *c_char) -> c_int; - pub unsafe fn getenv(s: *c_char) -> *c_char; + pub fn system(s: *c_char) -> c_int; + pub fn getenv(s: *c_char) -> *c_char; // Omitted: bsearch, qsort - pub unsafe fn rand() -> c_int; - pub unsafe fn srand(seed: c_uint); + pub fn rand() -> c_int; + pub fn srand(seed: c_uint); } } @@ -2533,28 +2524,25 @@ pub mod funcs { use libc::types::os::arch::c95::{wchar_t}; extern { - pub unsafe fn strcpy(dst: *c_char, src: *c_char) -> *c_char; - pub unsafe fn strncpy(dst: *c_char, src: *c_char, n: size_t) - -> *c_char; - pub unsafe fn strcat(s: *c_char, ct: *c_char) -> *c_char; - pub unsafe fn strncat(s: *c_char, ct: *c_char, n: size_t) - -> *c_char; - pub unsafe fn strcmp(cs: *c_char, ct: *c_char) -> c_int; - pub unsafe fn strncmp(cs: *c_char, ct: *c_char, n: size_t) - -> c_int; - pub unsafe fn strcoll(cs: *c_char, ct: *c_char) -> c_int; - pub unsafe fn strchr(cs: *c_char, c: c_int) -> *c_char; - pub unsafe fn strrchr(cs: *c_char, c: c_int) -> *c_char; - pub unsafe fn strspn(cs: *c_char, ct: *c_char) -> size_t; - pub unsafe fn strcspn(cs: *c_char, ct: *c_char) -> size_t; - pub unsafe fn strpbrk(cs: *c_char, ct: *c_char) -> *c_char; - pub unsafe fn strstr(cs: *c_char, ct: *c_char) -> *c_char; - pub unsafe fn strlen(cs: *c_char) -> size_t; - pub unsafe fn strerror(n: c_int) -> *c_char; - pub unsafe fn strtok(s: *c_char, t: *c_char) -> *c_char; - pub unsafe fn strxfrm(s: *c_char, ct: *c_char, n: size_t) - -> size_t; - pub unsafe fn wcslen(buf: *wchar_t) -> size_t; + pub fn strcpy(dst: *c_char, src: *c_char) -> *c_char; + pub fn strncpy(dst: *c_char, src: *c_char, n: size_t) + -> *c_char; + pub fn strcat(s: *c_char, ct: *c_char) -> *c_char; + pub fn strncat(s: *c_char, ct: *c_char, n: size_t) -> *c_char; + pub fn strcmp(cs: *c_char, ct: *c_char) -> c_int; + pub fn strncmp(cs: *c_char, ct: *c_char, n: size_t) -> c_int; + pub fn strcoll(cs: *c_char, ct: *c_char) -> c_int; + pub fn strchr(cs: *c_char, c: c_int) -> *c_char; + pub fn strrchr(cs: *c_char, c: c_int) -> *c_char; + pub fn strspn(cs: *c_char, ct: *c_char) -> size_t; + pub fn strcspn(cs: *c_char, ct: *c_char) -> size_t; + pub fn strpbrk(cs: *c_char, ct: *c_char) -> *c_char; + pub fn strstr(cs: *c_char, ct: *c_char) -> *c_char; + pub fn strlen(cs: *c_char) -> size_t; + pub fn strerror(n: c_int) -> *c_char; + pub fn strtok(s: *c_char, t: *c_char) -> *c_char; + pub fn strxfrm(s: *c_char, ct: *c_char, n: size_t) -> size_t; + pub fn wcslen(buf: *wchar_t) -> size_t; // Omitted: memcpy, memmove, memset (provided by LLVM) @@ -2562,12 +2550,10 @@ pub mod funcs { // in fact, because LLVM generates calls to them! #[rust_stack] #[inline] - pub unsafe fn memcmp(cx: *c_void, ct: *c_void, n: size_t) - -> c_int; + pub fn memcmp(cx: *c_void, ct: *c_void, n: size_t) -> c_int; #[rust_stack] #[inline] - pub unsafe fn memchr(cx: *c_void, c: c_int, n: size_t) - -> *c_void; + pub fn memchr(cx: *c_void, c: c_int, n: size_t) -> *c_void; } } } @@ -2588,16 +2574,13 @@ pub mod funcs { extern { #[link_name = "_chmod"] - pub unsafe fn chmod(path: *c_char, mode: c_int) -> c_int; - + pub fn chmod(path: *c_char, mode: c_int) -> c_int; #[link_name = "_mkdir"] - pub unsafe fn mkdir(path: *c_char) -> c_int; - + pub fn mkdir(path: *c_char) -> c_int; #[link_name = "_fstat64"] - pub unsafe fn fstat(fildes: c_int, buf: *mut stat) -> c_int; - + pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int; #[link_name = "_stat64"] - pub unsafe fn stat(path: *c_char, buf: *mut stat) -> c_int; + pub fn stat(path: *c_char, buf: *mut stat) -> c_int; } } @@ -2609,17 +2592,14 @@ pub mod funcs { extern { #[link_name = "_popen"] - pub unsafe fn popen(command: *c_char, mode: *c_char) -> *FILE; - + pub fn popen(command: *c_char, mode: *c_char) -> *FILE; #[link_name = "_pclose"] - pub unsafe fn pclose(stream: *FILE) -> c_int; - + pub fn pclose(stream: *FILE) -> c_int; #[link_name = "_fdopen"] #[fast_ffi] - pub unsafe fn fdopen(fd: c_int, mode: *c_char) -> *FILE; - + pub fn fdopen(fd: c_int, mode: *c_char) -> *FILE; #[link_name = "_fileno"] - pub unsafe fn fileno(stream: *FILE) -> c_int; + pub fn fileno(stream: *FILE) -> c_int; } } @@ -2629,11 +2609,10 @@ pub mod funcs { use libc::types::os::arch::c95::{c_int, c_char}; extern { #[link_name = "_open"] - pub unsafe fn open(path: *c_char, oflag: c_int, mode: c_int) - -> c_int; - + pub fn open(path: *c_char, oflag: c_int, mode: c_int) + -> c_int; #[link_name = "_creat"] - pub unsafe fn creat(path: *c_char, mode: c_int) -> c_int; + pub fn creat(path: *c_char, mode: c_int) -> c_int; } } @@ -2653,73 +2632,48 @@ pub mod funcs { extern { #[link_name = "_access"] - pub unsafe fn access(path: *c_char, amode: c_int) -> c_int; - + pub fn access(path: *c_char, amode: c_int) -> c_int; #[link_name = "_chdir"] - pub unsafe fn chdir(dir: *c_char) -> c_int; - + pub fn chdir(dir: *c_char) -> c_int; #[link_name = "_close"] - pub unsafe fn close(fd: c_int) -> c_int; - + pub fn close(fd: c_int) -> c_int; #[link_name = "_dup"] - pub unsafe fn dup(fd: c_int) -> c_int; - + pub fn dup(fd: c_int) -> c_int; #[link_name = "_dup2"] - pub unsafe fn dup2(src: c_int, dst: c_int) -> c_int; - + pub fn dup2(src: c_int, dst: c_int) -> c_int; #[link_name = "_execv"] - pub unsafe fn execv(prog: *c_char, argv: **c_char) - -> intptr_t; - + pub fn execv(prog: *c_char, argv: **c_char) -> intptr_t; #[link_name = "_execve"] - pub unsafe fn execve(prog: *c_char, - argv: **c_char, - envp: **c_char) - -> c_int; - + pub fn execve(prog: *c_char, argv: **c_char, envp: **c_char) + -> c_int; #[link_name = "_execvp"] - pub unsafe fn execvp(c: *c_char, argv: **c_char) -> c_int; - + pub fn execvp(c: *c_char, argv: **c_char) -> c_int; #[link_name = "_execvpe"] - pub unsafe fn execvpe(c: *c_char, - argv: **c_char, - envp: **c_char) - -> c_int; - + pub fn execvpe(c: *c_char, argv: **c_char, envp: **c_char) + -> c_int; #[link_name = "_getcwd"] - pub unsafe fn getcwd(buf: *c_char, size: size_t) -> *c_char; - + pub fn getcwd(buf: *c_char, size: size_t) -> *c_char; #[link_name = "_getpid"] - pub unsafe fn getpid() -> c_int; - + pub fn getpid() -> c_int; #[link_name = "_isatty"] - pub unsafe fn isatty(fd: c_int) -> c_int; - + pub fn isatty(fd: c_int) -> c_int; #[link_name = "_lseek"] - pub unsafe fn lseek(fd: c_int, offset: c_long, origin: c_int) - -> c_long; - + pub fn lseek(fd: c_int, offset: c_long, origin: c_int) + -> c_long; #[link_name = "_pipe"] - pub unsafe fn pipe(fds: *mut c_int, - psize: c_uint, - textmode: c_int) - -> c_int; - + pub fn pipe(fds: *mut c_int, psize: c_uint, textmode: c_int) + -> c_int; #[link_name = "_read"] #[fast_ffi] - pub unsafe fn read(fd: c_int, buf: *mut c_void, count: c_uint) - -> c_int; - + pub fn read(fd: c_int, buf: *mut c_void, count: c_uint) + -> c_int; #[link_name = "_rmdir"] - pub unsafe fn rmdir(path: *c_char) -> c_int; - + pub fn rmdir(path: *c_char) -> c_int; #[link_name = "_unlink"] - pub unsafe fn unlink(c: *c_char) -> c_int; - + pub fn unlink(c: *c_char) -> c_int; #[link_name = "_write"] #[fast_ffi] - pub unsafe fn write(fd: c_int, buf: *c_void, count: c_uint) - -> c_int; + pub fn write(fd: c_int, buf: *c_void, count: c_uint) -> c_int; } } @@ -2741,29 +2695,29 @@ pub mod funcs { #[nolink] #[abi = "cdecl"] extern { - pub unsafe fn chmod(path: *c_char, mode: mode_t) -> c_int; - pub unsafe fn fchmod(fd: c_int, mode: mode_t) -> c_int; + pub fn chmod(path: *c_char, mode: mode_t) -> c_int; + pub fn fchmod(fd: c_int, mode: mode_t) -> c_int; #[cfg(target_os = "linux")] #[cfg(target_os = "freebsd")] #[cfg(target_os = "android")] - pub unsafe fn fstat(fildes: c_int, buf: *mut stat) -> c_int; + pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int; #[cfg(target_os = "macos")] #[link_name = "fstat64"] - pub unsafe fn fstat(fildes: c_int, buf: *mut stat) -> c_int; + pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int; - pub unsafe fn mkdir(path: *c_char, mode: mode_t) -> c_int; - pub unsafe fn mkfifo(path: *c_char, mode: mode_t) -> c_int; + pub fn mkdir(path: *c_char, mode: mode_t) -> c_int; + pub fn mkfifo(path: *c_char, mode: mode_t) -> c_int; #[cfg(target_os = "linux")] #[cfg(target_os = "freebsd")] #[cfg(target_os = "android")] - pub unsafe fn stat(path: *c_char, buf: *mut stat) -> c_int; + pub fn stat(path: *c_char, buf: *mut stat) -> c_int; #[cfg(target_os = "macos")] #[link_name = "stat64"] - pub unsafe fn stat(path: *c_char, buf: *mut stat) -> c_int; + pub fn stat(path: *c_char, buf: *mut stat) -> c_int; } } @@ -2774,10 +2728,10 @@ pub mod funcs { use libc::types::os::arch::c95::{c_char, c_int}; extern { - pub unsafe fn popen(command: *c_char, mode: *c_char) -> *FILE; - pub unsafe fn pclose(stream: *FILE) -> c_int; - pub unsafe fn fdopen(fd: c_int, mode: *c_char) -> *FILE; - pub unsafe fn fileno(stream: *FILE) -> c_int; + pub fn popen(command: *c_char, mode: *c_char) -> *FILE; + pub fn pclose(stream: *FILE) -> c_int; + pub fn fdopen(fd: c_int, mode: *c_char) -> *FILE; + pub fn fileno(stream: *FILE) -> c_int; } } @@ -2788,10 +2742,10 @@ pub mod funcs { use libc::types::os::arch::posix88::mode_t; extern { - pub unsafe fn open(path: *c_char, oflag: c_int, mode: c_int) - -> c_int; - pub unsafe fn creat(path: *c_char, mode: mode_t) -> c_int; - pub unsafe fn fcntl(fd: c_int, cmd: c_int) -> c_int; + pub fn open(path: *c_char, oflag: c_int, mode: c_int) + -> c_int; + pub fn creat(path: *c_char, mode: mode_t) -> c_int; + pub fn fcntl(fd: c_int, cmd: c_int) -> c_int; } } @@ -2815,15 +2769,15 @@ pub mod funcs { } extern { - unsafe fn rust_opendir(dirname: *c_char) -> *DIR; - unsafe fn rust_readdir(dirp: *DIR) -> *dirent_t; + fn rust_opendir(dirname: *c_char) -> *DIR; + fn rust_readdir(dirp: *DIR) -> *dirent_t; } extern { - pub unsafe fn closedir(dirp: *DIR) -> c_int; - pub unsafe fn rewinddir(dirp: *DIR); - pub unsafe fn seekdir(dirp: *DIR, loc: c_long); - pub unsafe fn telldir(dirp: *DIR) -> c_long; + pub fn closedir(dirp: *DIR) -> c_int; + pub fn rewinddir(dirp: *DIR); + pub fn seekdir(dirp: *DIR, loc: c_long); + pub fn telldir(dirp: *DIR) -> c_long; } } @@ -2837,62 +2791,55 @@ pub mod funcs { use libc::types::os::arch::posix88::{ssize_t, uid_t}; extern { - pub unsafe fn access(path: *c_char, amode: c_int) -> c_int; - pub unsafe fn alarm(seconds: c_uint) -> c_uint; - pub unsafe fn chdir(dir: *c_char) -> c_int; - pub unsafe fn chown(path: *c_char, uid: uid_t, gid: gid_t) - -> c_int; - pub unsafe fn close(fd: c_int) -> c_int; - pub unsafe fn dup(fd: c_int) -> c_int; - pub unsafe fn dup2(src: c_int, dst: c_int) -> c_int; - pub unsafe fn execv(prog: *c_char, argv: **c_char) -> c_int; - pub unsafe fn execve(prog: *c_char, - argv: **c_char, - envp: **c_char) - -> c_int; - pub unsafe fn execvp(c: *c_char, argv: **c_char) -> c_int; - pub unsafe fn fork() -> pid_t; - pub unsafe fn fpathconf(filedes: c_int, name: c_int) - -> c_long; - pub unsafe fn getcwd(buf: *c_char, size: size_t) -> *c_char; - pub unsafe fn getegid() -> gid_t; - pub unsafe fn geteuid() -> uid_t; - pub unsafe fn getgid() -> gid_t ; - pub unsafe fn getgroups(ngroups_max: c_int, - groups: *mut gid_t) - -> c_int; - pub unsafe fn getlogin() -> *c_char; - pub unsafe fn getopt(argc: c_int, - argv: **c_char, - optstr: *c_char) - -> c_int; - pub unsafe fn getpgrp() -> pid_t; - pub unsafe fn getpid() -> pid_t; - pub unsafe fn getppid() -> pid_t; - pub unsafe fn getuid() -> uid_t; - pub unsafe fn isatty(fd: c_int) -> c_int; - pub unsafe fn link(src: *c_char, dst: *c_char) -> c_int; - pub unsafe fn lseek(fd: c_int, offset: off_t, whence: c_int) - -> off_t; - pub unsafe fn pathconf(path: *c_char, name: c_int) -> c_long; - pub unsafe fn pause() -> c_int; - pub unsafe fn pipe(fds: *mut c_int) -> c_int; + pub fn access(path: *c_char, amode: c_int) -> c_int; + pub fn alarm(seconds: c_uint) -> c_uint; + pub fn chdir(dir: *c_char) -> c_int; + pub fn chown(path: *c_char, uid: uid_t, gid: gid_t) -> c_int; + pub fn close(fd: c_int) -> c_int; + pub fn dup(fd: c_int) -> c_int; + pub fn dup2(src: c_int, dst: c_int) -> c_int; + pub fn execv(prog: *c_char, argv: **c_char) -> c_int; + pub fn execve(prog: *c_char, argv: **c_char, envp: **c_char) + -> c_int; + pub fn execvp(c: *c_char, argv: **c_char) -> c_int; + pub fn fork() -> pid_t; + pub fn fpathconf(filedes: c_int, name: c_int) -> c_long; + pub fn getcwd(buf: *c_char, size: size_t) -> *c_char; + pub fn getegid() -> gid_t; + pub fn geteuid() -> uid_t; + pub fn getgid() -> gid_t ; + pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t) + -> c_int; + pub fn getlogin() -> *c_char; + pub fn getopt(argc: c_int, argv: **c_char, optstr: *c_char) + -> c_int; + pub fn getpgrp() -> pid_t; + pub fn getpid() -> pid_t; + pub fn getppid() -> pid_t; + pub fn getuid() -> uid_t; + pub fn isatty(fd: c_int) -> c_int; + pub fn link(src: *c_char, dst: *c_char) -> c_int; + pub fn lseek(fd: c_int, offset: off_t, whence: c_int) + -> off_t; + pub fn pathconf(path: *c_char, name: c_int) -> c_long; + pub fn pause() -> c_int; + pub fn pipe(fds: *mut c_int) -> c_int; #[fast_ffi] - pub unsafe fn read(fd: c_int, buf: *mut c_void, count: size_t) - -> ssize_t; - pub unsafe fn rmdir(path: *c_char) -> c_int; - pub unsafe fn setgid(gid: gid_t) -> c_int; - pub unsafe fn setpgid(pid: pid_t, pgid: pid_t) -> c_int; - pub unsafe fn setsid() -> pid_t; - pub unsafe fn setuid(uid: uid_t) -> c_int; - pub unsafe fn sleep(secs: c_uint) -> c_uint; - pub unsafe fn sysconf(name: c_int) -> c_long; - pub unsafe fn tcgetpgrp(fd: c_int) -> pid_t; - pub unsafe fn ttyname(fd: c_int) -> *c_char; - pub unsafe fn unlink(c: *c_char) -> c_int; + pub fn read(fd: c_int, buf: *mut c_void, count: size_t) + -> ssize_t; + pub fn rmdir(path: *c_char) -> c_int; + pub fn setgid(gid: gid_t) -> c_int; + pub fn setpgid(pid: pid_t, pgid: pid_t) -> c_int; + pub fn setsid() -> pid_t; + pub fn setuid(uid: uid_t) -> c_int; + pub fn sleep(secs: c_uint) -> c_uint; + pub fn sysconf(name: c_int) -> c_long; + pub fn tcgetpgrp(fd: c_int) -> pid_t; + pub fn ttyname(fd: c_int) -> *c_char; + pub fn unlink(c: *c_char) -> c_int; #[fast_ffi] - pub unsafe fn write(fd: c_int, buf: *c_void, count: size_t) - -> ssize_t; + pub fn write(fd: c_int, buf: *c_void, count: size_t) + -> ssize_t; } } @@ -2903,7 +2850,7 @@ pub mod funcs { use libc::types::os::arch::posix88::{pid_t}; extern { - pub unsafe fn kill(pid: pid_t, sig: c_int) -> c_int; + pub fn kill(pid: pid_t, sig: c_int) -> c_int; } } @@ -2915,32 +2862,28 @@ pub mod funcs { use libc::types::os::arch::posix88::{mode_t, off_t}; extern { - pub unsafe fn mlock(addr: *c_void, len: size_t) -> c_int; - pub unsafe fn munlock(addr: *c_void, len: size_t) -> c_int; - pub unsafe fn mlockall(flags: c_int) -> c_int; - pub unsafe fn munlockall() -> c_int; - - pub unsafe fn mmap(addr: *c_void, - len: size_t, - prot: c_int, - flags: c_int, - fd: c_int, - offset: off_t) - -> *mut c_void; - pub unsafe fn munmap(addr: *c_void, len: size_t) -> c_int; - - pub unsafe fn mprotect(addr: *c_void, - len: size_t, - prot: c_int) - -> c_int; - - pub unsafe fn msync(addr: *c_void, len: size_t, flags: c_int) - -> c_int; - pub unsafe fn shm_open(name: *c_char, - oflag: c_int, - mode: mode_t) - -> c_int; - pub unsafe fn shm_unlink(name: *c_char) -> c_int; + pub fn mlock(addr: *c_void, len: size_t) -> c_int; + pub fn munlock(addr: *c_void, len: size_t) -> c_int; + pub fn mlockall(flags: c_int) -> c_int; + pub fn munlockall() -> c_int; + + pub fn mmap(addr: *c_void, + len: size_t, + prot: c_int, + flags: c_int, + fd: c_int, + offset: off_t) + -> *mut c_void; + pub fn munmap(addr: *c_void, len: size_t) -> c_int; + + pub fn mprotect(addr: *c_void, len: size_t, prot: c_int) + -> c_int; + + pub fn msync(addr: *c_void, len: size_t, flags: c_int) + -> c_int; + pub fn shm_open(name: *c_char, oflag: c_int, mode: mode_t) + -> c_int; + pub fn shm_unlink(name: *c_char) -> c_int; } } } @@ -2960,11 +2903,11 @@ pub mod funcs { #[cfg(target_os = "linux")] #[cfg(target_os = "freebsd")] #[cfg(target_os = "android")] - pub unsafe fn lstat(path: *c_char, buf: *mut stat) -> c_int; + pub fn lstat(path: *c_char, buf: *mut stat) -> c_int; #[cfg(target_os = "macos")] #[link_name = "lstat64"] - pub unsafe fn lstat(path: *c_char, buf: *mut stat) -> c_int; + pub fn lstat(path: *c_char, buf: *mut stat) -> c_int; } } @@ -2975,26 +2918,23 @@ pub mod funcs { use libc::types::os::arch::posix88::{ssize_t}; extern { - pub unsafe fn readlink(path: *c_char, - buf: *mut c_char, - bufsz: size_t) - -> ssize_t; + pub fn readlink(path: *c_char, + buf: *mut c_char, + bufsz: size_t) + -> ssize_t; - pub unsafe fn fsync(fd: c_int) -> c_int; + pub fn fsync(fd: c_int) -> c_int; #[cfg(target_os = "linux")] #[cfg(target_os = "android")] - pub unsafe fn fdatasync(fd: c_int) -> c_int; + pub fn fdatasync(fd: c_int) -> c_int; - pub unsafe fn setenv(name: *c_char, - val: *c_char, - overwrite: c_int) - -> c_int; - pub unsafe fn unsetenv(name: *c_char) -> c_int; - pub unsafe fn putenv(string: *c_char) -> c_int; + pub fn setenv(name: *c_char, val: *c_char, overwrite: c_int) + -> c_int; + pub fn unsetenv(name: *c_char) -> c_int; + pub fn putenv(string: *c_char) -> c_int; - pub unsafe fn symlink(path1: *c_char, path2: *c_char) - -> c_int; + pub fn symlink(path1: *c_char, path2: *c_char) -> c_int; } } @@ -3005,10 +2945,8 @@ pub mod funcs { use libc::types::os::arch::posix88::{pid_t}; extern { - pub unsafe fn waitpid(pid: pid_t, - status: *mut c_int, - options: c_int) - -> pid_t; + pub fn waitpid(pid: pid_t, status: *mut c_int, options: c_int) + -> pid_t; } } @@ -3020,11 +2958,11 @@ pub mod funcs { use libc::types::os::common::posix01::{glob_t}; extern { - pub unsafe fn glob(pattern: *c_char, - flags: c_int, - errfunc: *c_void, // XXX callback - pglob: *mut glob_t); - pub unsafe fn globfree(pglob: *mut glob_t); + pub fn glob(pattern: *c_char, + flags: c_int, + errfunc: *c_void, // XXX callback + pglob: *mut glob_t); + pub fn globfree(pglob: *mut glob_t); } } @@ -3035,10 +2973,10 @@ pub mod funcs { use libc::types::os::arch::c95::{c_int, size_t}; extern { - pub unsafe fn posix_madvise(addr: *c_void, - len: size_t, - advice: c_int) - -> c_int; + pub fn posix_madvise(addr: *c_void, + len: size_t, + advice: c_int) + -> c_int; } } } @@ -3079,33 +3017,28 @@ pub mod funcs { #[abi = "cdecl"] extern { - pub unsafe fn sysctl(name: *c_int, - namelen: c_uint, - oldp: *mut c_void, - oldlenp: *mut size_t, - newp: *c_void, - newlen: size_t) - -> c_int; - - pub unsafe fn sysctlbyname(name: *c_char, - oldp: *mut c_void, - oldlenp: *mut size_t, - newp: *c_void, - newlen: size_t) - -> c_int; - - pub unsafe fn sysctlnametomib(name: *c_char, - mibp: *mut c_int, - sizep: *mut size_t) - -> c_int; - - pub unsafe fn getdtablesize() -> c_int; - - pub unsafe fn madvise(addr: *c_void, len: size_t, advice: c_int) - -> c_int; - - pub unsafe fn mincore(addr: *c_void, len: size_t, vec: *c_uchar) - -> c_int; + pub fn sysctl(name: *c_int, + namelen: c_uint, + oldp: *mut c_void, + oldlenp: *mut size_t, + newp: *c_void, + newlen: size_t) + -> c_int; + pub fn sysctlbyname(name: *c_char, + oldp: *mut c_void, + oldlenp: *mut size_t, + newp: *c_void, + newlen: size_t) + -> c_int; + pub fn sysctlnametomib(name: *c_char, + mibp: *mut c_int, + sizep: *mut size_t) + -> c_int; + pub fn getdtablesize() -> c_int; + pub fn madvise(addr: *c_void, len: size_t, advice: c_int) + -> c_int; + pub fn mincore(addr: *c_void, len: size_t, vec: *c_uchar) + -> c_int; } } @@ -3118,13 +3051,11 @@ pub mod funcs { #[abi = "cdecl"] extern { - pub unsafe fn getdtablesize() -> c_int; - - pub unsafe fn madvise(addr: *c_void, len: size_t, advice: c_int) - -> c_int; - - pub unsafe fn mincore(addr: *c_void, len: size_t, vec: *c_uchar) - -> c_int; + pub fn getdtablesize() -> c_int; + pub fn madvise(addr: *c_void, len: size_t, advice: c_int) + -> c_int; + pub fn mincore(addr: *c_void, len: size_t, vec: *c_uchar) + -> c_int; } } @@ -3140,9 +3071,8 @@ pub mod funcs { #[abi = "cdecl"] extern { - pub unsafe fn _NSGetExecutablePath(buf: *mut c_char, - bufsize: *mut u32) - -> c_int; + pub fn _NSGetExecutablePath(buf: *mut c_char, bufsize: *mut u32) + -> c_int; } } @@ -3173,118 +3103,107 @@ pub mod funcs { #[abi = "stdcall"] extern "stdcall" { - pub unsafe fn GetEnvironmentVariableW(n: LPCWSTR, - v: LPWSTR, - nsize: DWORD) - -> DWORD; - pub unsafe fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR) - -> BOOL; - pub unsafe fn GetEnvironmentStringsA() -> LPTCH; - pub unsafe fn FreeEnvironmentStringsA(env_ptr: LPTCH) -> BOOL; - - pub unsafe fn GetModuleFileNameW(hModule: HMODULE, - lpFilename: LPWSTR, - nSize: DWORD) - -> DWORD; - pub unsafe fn CreateDirectoryW(lpPathName: LPCWSTR, - lpSecurityAttributes: - LPSECURITY_ATTRIBUTES) - -> BOOL; - pub unsafe fn CopyFileW(lpExistingFileName: LPCWSTR, + pub fn GetEnvironmentVariableW(n: LPCWSTR, + v: LPWSTR, + nsize: DWORD) + -> DWORD; + pub fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR) + -> BOOL; + pub fn GetEnvironmentStringsA() -> LPTCH; + pub fn FreeEnvironmentStringsA(env_ptr: LPTCH) -> BOOL; + pub fn GetModuleFileNameW(hModule: HMODULE, + lpFilename: LPWSTR, + nSize: DWORD) + -> DWORD; + pub fn CreateDirectoryW(lpPathName: LPCWSTR, + lpSecurityAttributes: + LPSECURITY_ATTRIBUTES) + -> BOOL; + pub fn CopyFileW(lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, bFailIfExists: BOOL) -> BOOL; - pub unsafe fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL; - pub unsafe fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL; - pub unsafe fn SetCurrentDirectoryW(lpPathName: LPCWSTR) - -> BOOL; - - pub unsafe fn GetLastError() -> DWORD; - pub unsafe fn FindFirstFileW(fileName: *u16, - findFileData: HANDLE) - -> HANDLE; - pub unsafe fn FindNextFileW(findFile: HANDLE, - findFileData: HANDLE) - -> BOOL; - pub unsafe fn FindClose(findFile: HANDLE) -> BOOL; - pub unsafe fn DuplicateHandle(hSourceProcessHandle: HANDLE, - hSourceHandle: HANDLE, - hTargetProcessHandle: HANDLE, - lpTargetHandle: LPHANDLE, - dwDesiredAccess: DWORD, - bInheritHandle: BOOL, - dwOptions: DWORD) - -> BOOL; - pub unsafe fn CloseHandle(hObject: HANDLE) -> BOOL; - pub unsafe fn OpenProcess(dwDesiredAccess: DWORD, - bInheritHandle: BOOL, - dwProcessId: DWORD) - -> HANDLE; - pub unsafe fn GetCurrentProcess() -> HANDLE; - pub unsafe fn CreateProcessA(lpApplicationName: LPCTSTR, - lpCommandLine: LPTSTR, - lpProcessAttributes: - LPSECURITY_ATTRIBUTES, - lpThreadAttributes: - LPSECURITY_ATTRIBUTES, - bInheritHandles: BOOL, - dwCreationFlags: DWORD, - lpEnvironment: LPVOID, - lpCurrentDirectory: LPCTSTR, - lpStartupInfo: LPSTARTUPINFO, - lpProcessInformation: - LPPROCESS_INFORMATION) - -> BOOL; - pub unsafe fn WaitForSingleObject(hHandle: HANDLE, - dwMilliseconds: DWORD) - -> DWORD; - pub unsafe fn TerminateProcess(hProcess: HANDLE, - uExitCode: c_uint) - -> BOOL; - pub unsafe fn GetExitCodeProcess(hProcess: HANDLE, - lpExitCode: LPDWORD) - -> BOOL; - - pub unsafe fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO); - pub unsafe fn VirtualAlloc(lpAddress: LPVOID, - dwSize: SIZE_T, - flAllocationType: DWORD, - flProtect: DWORD) - -> LPVOID; - pub unsafe fn VirtualFree(lpAddress: LPVOID, - dwSize: SIZE_T, - dwFreeType: DWORD) - -> BOOL; - pub unsafe fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T) + pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL; + pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL; + pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL; + pub fn GetLastError() -> DWORD; + pub fn FindFirstFileW(fileName: *u16, findFileData: HANDLE) + -> HANDLE; + pub fn FindNextFileW(findFile: HANDLE, findFileData: HANDLE) + -> BOOL; + pub fn FindClose(findFile: HANDLE) -> BOOL; + pub fn DuplicateHandle(hSourceProcessHandle: HANDLE, + hSourceHandle: HANDLE, + hTargetProcessHandle: HANDLE, + lpTargetHandle: LPHANDLE, + dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + dwOptions: DWORD) + -> BOOL; + pub fn CloseHandle(hObject: HANDLE) -> BOOL; + pub fn OpenProcess(dwDesiredAccess: DWORD, + bInheritHandle: BOOL, + dwProcessId: DWORD) + -> HANDLE; + pub fn GetCurrentProcess() -> HANDLE; + pub fn CreateProcessA(lpApplicationName: LPCTSTR, + lpCommandLine: LPTSTR, + lpProcessAttributes: + LPSECURITY_ATTRIBUTES, + lpThreadAttributes: + LPSECURITY_ATTRIBUTES, + bInheritHandles: BOOL, + dwCreationFlags: DWORD, + lpEnvironment: LPVOID, + lpCurrentDirectory: LPCTSTR, + lpStartupInfo: LPSTARTUPINFO, + lpProcessInformation: + LPPROCESS_INFORMATION) + -> BOOL; + pub fn WaitForSingleObject(hHandle: HANDLE, + dwMilliseconds: DWORD) + -> DWORD; + pub fn TerminateProcess(hProcess: HANDLE, uExitCode: c_uint) + -> BOOL; + pub fn GetExitCodeProcess(hProcess: HANDLE, + lpExitCode: LPDWORD) -> BOOL; - pub unsafe fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T) - -> BOOL; - pub unsafe fn VirtualProtect(lpAddress: LPVOID, - dwSize: SIZE_T, - flNewProtect: DWORD, - lpflOldProtect: LPDWORD) - -> BOOL; - pub unsafe fn VirtualQuery(lpAddress: LPCVOID, - lpBuffer: - LPMEMORY_BASIC_INFORMATION, - dwLength: SIZE_T) - -> SIZE_T; - - pub unsafe fn CreateFileMappingW(hFile: HANDLE, - lpAttributes: - LPSECURITY_ATTRIBUTES, - flProtect: DWORD, - dwMaximumSizeHigh: DWORD, - dwMaximumSizeLow: DWORD, - lpName: LPCTSTR) - -> HANDLE; - pub unsafe fn MapViewOfFile(hFileMappingObject: HANDLE, - dwDesiredAccess: DWORD, - dwFileOffsetHigh: DWORD, - dwFileOffsetLow: DWORD, - dwNumberOfBytesToMap: SIZE_T) - -> LPVOID; - pub unsafe fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL; + pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO); + pub fn VirtualAlloc(lpAddress: LPVOID, + dwSize: SIZE_T, + flAllocationType: DWORD, + flProtect: DWORD) + -> LPVOID; + pub fn VirtualFree(lpAddress: LPVOID, + dwSize: SIZE_T, + dwFreeType: DWORD) + -> BOOL; + pub fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL; + pub fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T) + -> BOOL; + pub fn VirtualProtect(lpAddress: LPVOID, + dwSize: SIZE_T, + flNewProtect: DWORD, + lpflOldProtect: LPDWORD) + -> BOOL; + pub fn VirtualQuery(lpAddress: LPCVOID, + lpBuffer: LPMEMORY_BASIC_INFORMATION, + dwLength: SIZE_T) + -> SIZE_T; + pub fn CreateFileMappingW(hFile: HANDLE, + lpAttributes: LPSECURITY_ATTRIBUTES, + flProtect: DWORD, + dwMaximumSizeHigh: DWORD, + dwMaximumSizeLow: DWORD, + lpName: LPCTSTR) + -> HANDLE; + pub fn MapViewOfFile(hFileMappingObject: HANDLE, + dwDesiredAccess: DWORD, + dwFileOffsetHigh: DWORD, + dwFileOffsetLow: DWORD, + dwNumberOfBytesToMap: SIZE_T) + -> LPVOID; + pub fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL; } } @@ -3295,10 +3214,10 @@ pub mod funcs { #[nolink] extern { #[link_name = "_commit"] - pub unsafe fn commit(fd: c_int) -> c_int; + pub fn commit(fd: c_int) -> c_int; #[link_name = "_get_osfhandle"] - pub unsafe fn get_osfhandle(fd: c_int) -> c_long; + pub fn get_osfhandle(fd: c_int) -> c_long; } } } diff --git a/src/libstd/logging.rs b/src/libstd/logging.rs index e3dae5308fe..6e11d14aea9 100644 --- a/src/libstd/logging.rs +++ b/src/libstd/logging.rs @@ -105,10 +105,10 @@ pub mod rustrt { use libc; extern { - pub unsafe fn rust_log_console_on(); - pub unsafe fn rust_log_console_off(); - pub unsafe fn rust_log_str(level: u32, - string: *libc::c_char, - size: libc::size_t); + pub fn rust_log_console_on(); + pub fn rust_log_console_off(); + pub fn rust_log_str(level: u32, + string: *libc::c_char, + size: libc::size_t); } } diff --git a/src/libstd/num/cmath.rs b/src/libstd/num/cmath.rs index f7aa3267d6d..38923c5bda4 100644 --- a/src/libstd/num/cmath.rs +++ b/src/libstd/num/cmath.rs @@ -22,83 +22,84 @@ pub mod c_double_utils { extern { // Alpabetically sorted by link_name - pub unsafe fn acos(n: c_double) -> c_double; - pub unsafe fn asin(n: c_double) -> c_double; - pub unsafe fn atan(n: c_double) -> c_double; - pub unsafe fn atan2(a: c_double, b: c_double) -> c_double; - pub unsafe fn cbrt(n: c_double) -> c_double; - pub unsafe fn ceil(n: c_double) -> c_double; - pub unsafe fn copysign(x: c_double, y: c_double) -> c_double; - pub unsafe fn cos(n: c_double) -> c_double; - pub unsafe fn cosh(n: c_double) -> c_double; - pub unsafe fn erf(n: c_double) -> c_double; - pub unsafe fn erfc(n: c_double) -> c_double; - pub unsafe fn exp(n: c_double) -> c_double; + pub fn acos(n: c_double) -> c_double; + pub fn asin(n: c_double) -> c_double; + pub fn atan(n: c_double) -> c_double; + pub fn atan2(a: c_double, b: c_double) -> c_double; + pub fn cbrt(n: c_double) -> c_double; + pub fn ceil(n: c_double) -> c_double; + pub fn copysign(x: c_double, y: c_double) -> c_double; + pub fn cos(n: c_double) -> c_double; + pub fn cosh(n: c_double) -> c_double; + pub fn erf(n: c_double) -> c_double; + pub fn erfc(n: c_double) -> c_double; + pub fn exp(n: c_double) -> c_double; // rename: for consistency with underscore usage elsewhere - #[link_name="expm1"] unsafe fn exp_m1(n: c_double) -> c_double; - pub unsafe fn exp2(n: c_double) -> c_double; - #[link_name="fabs"] unsafe fn abs(n: c_double) -> c_double; + #[link_name="expm1"] + fn exp_m1(n: c_double) -> c_double; + pub fn exp2(n: c_double) -> c_double; + #[link_name="fabs"] + fn abs(n: c_double) -> c_double; // rename: for clarity and consistency with add/sub/mul/div #[link_name="fdim"] - pub unsafe fn abs_sub(a: c_double, b: c_double) -> c_double; - pub unsafe fn floor(n: c_double) -> c_double; + pub fn abs_sub(a: c_double, b: c_double) -> c_double; + pub fn floor(n: c_double) -> c_double; // rename: for clarity and consistency with add/sub/mul/div #[link_name="fma"] - pub unsafe fn mul_add(a: c_double, b: c_double, c: c_double) - -> c_double; + pub fn mul_add(a: c_double, b: c_double, c: c_double) -> c_double; #[link_name="fmax"] - pub unsafe fn fmax(a: c_double, b: c_double) -> c_double; + pub fn fmax(a: c_double, b: c_double) -> c_double; #[link_name="fmin"] - pub unsafe fn fmin(a: c_double, b: c_double) -> c_double; + pub fn fmin(a: c_double, b: c_double) -> c_double; #[link_name="nextafter"] - pub unsafe fn next_after(x: c_double, y: c_double) -> c_double; - pub unsafe fn frexp(n: c_double, value: &mut c_int) -> c_double; - pub unsafe fn hypot(x: c_double, y: c_double) -> c_double; - pub unsafe fn ldexp(x: c_double, n: c_int) -> c_double; + pub fn next_after(x: c_double, y: c_double) -> c_double; + pub fn frexp(n: c_double, value: &mut c_int) -> c_double; + pub fn hypot(x: c_double, y: c_double) -> c_double; + pub fn ldexp(x: c_double, n: c_int) -> c_double; #[cfg(unix)] #[link_name="lgamma_r"] - pub unsafe fn lgamma(n: c_double, sign: &mut c_int) -> c_double; + pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double; #[cfg(windows)] #[link_name="__lgamma_r"] - pub unsafe fn lgamma(n: c_double, sign: &mut c_int) -> c_double; + pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double; // renamed: ln seems more natural #[link_name="log"] - pub unsafe fn ln(n: c_double) -> c_double; + pub fn ln(n: c_double) -> c_double; // renamed: "logb" /often/ is confused for log2 by beginners #[link_name="logb"] - pub unsafe fn log_radix(n: c_double) -> c_double; + pub fn log_radix(n: c_double) -> c_double; // renamed: to be consitent with log as ln #[link_name="log1p"] - pub unsafe fn ln_1p(n: c_double) -> c_double; - pub unsafe fn log10(n: c_double) -> c_double; - pub unsafe fn log2(n: c_double) -> c_double; + pub fn ln_1p(n: c_double) -> c_double; + pub fn log10(n: c_double) -> c_double; + pub fn log2(n: c_double) -> c_double; #[link_name="ilogb"] - pub unsafe fn ilog_radix(n: c_double) -> c_int; - pub unsafe fn modf(n: c_double, iptr: &mut c_double) -> c_double; - pub unsafe fn pow(n: c_double, e: c_double) -> c_double; + pub fn ilog_radix(n: c_double) -> c_int; + pub fn modf(n: c_double, iptr: &mut c_double) -> c_double; + pub fn pow(n: c_double, e: c_double) -> c_double; // FIXME (#1379): enable when rounding modes become available - // unsafe fn rint(n: c_double) -> c_double; - pub unsafe fn round(n: c_double) -> c_double; + // fn rint(n: c_double) -> c_double; + pub fn round(n: c_double) -> c_double; // rename: for consistency with logradix #[link_name="scalbn"] - pub unsafe fn ldexp_radix(n: c_double, i: c_int) -> c_double; - pub unsafe fn sin(n: c_double) -> c_double; - pub unsafe fn sinh(n: c_double) -> c_double; - pub unsafe fn sqrt(n: c_double) -> c_double; - pub unsafe fn tan(n: c_double) -> c_double; - pub unsafe fn tanh(n: c_double) -> c_double; - pub unsafe fn tgamma(n: c_double) -> c_double; - pub unsafe fn trunc(n: c_double) -> c_double; + pub fn ldexp_radix(n: c_double, i: c_int) -> c_double; + pub fn sin(n: c_double) -> c_double; + pub fn sinh(n: c_double) -> c_double; + pub fn sqrt(n: c_double) -> c_double; + pub fn tan(n: c_double) -> c_double; + pub fn tanh(n: c_double) -> c_double; + pub fn tgamma(n: c_double) -> c_double; + pub fn trunc(n: c_double) -> c_double; // These are commonly only available for doubles - pub unsafe fn j0(n: c_double) -> c_double; - pub unsafe fn j1(n: c_double) -> c_double; - pub unsafe fn jn(i: c_int, n: c_double) -> c_double; + pub fn j0(n: c_double) -> c_double; + pub fn j1(n: c_double) -> c_double; + pub fn jn(i: c_int, n: c_double) -> c_double; - pub unsafe fn y0(n: c_double) -> c_double; - pub unsafe fn y1(n: c_double) -> c_double; - pub unsafe fn yn(i: c_int, n: c_double) -> c_double; + pub fn y0(n: c_double) -> c_double; + pub fn y1(n: c_double) -> c_double; + pub fn yn(i: c_int, n: c_double) -> c_double; } } @@ -111,98 +112,98 @@ pub mod c_float_utils { // Alpabetically sorted by link_name #[link_name="acosf"] - pub unsafe fn acos(n: c_float) -> c_float; + pub fn acos(n: c_float) -> c_float; #[link_name="asinf"] - pub unsafe fn asin(n: c_float) -> c_float; + pub fn asin(n: c_float) -> c_float; #[link_name="atanf"] - pub unsafe fn atan(n: c_float) -> c_float; + pub fn atan(n: c_float) -> c_float; #[link_name="atan2f"] - pub unsafe fn atan2(a: c_float, b: c_float) -> c_float; + pub fn atan2(a: c_float, b: c_float) -> c_float; #[link_name="cbrtf"] - pub unsafe fn cbrt(n: c_float) -> c_float; + pub fn cbrt(n: c_float) -> c_float; #[link_name="ceilf"] - pub unsafe fn ceil(n: c_float) -> c_float; + pub fn ceil(n: c_float) -> c_float; #[link_name="copysignf"] - pub unsafe fn copysign(x: c_float, y: c_float) -> c_float; + pub fn copysign(x: c_float, y: c_float) -> c_float; #[link_name="cosf"] - pub unsafe fn cos(n: c_float) -> c_float; + pub fn cos(n: c_float) -> c_float; #[link_name="coshf"] - pub unsafe fn cosh(n: c_float) -> c_float; + pub fn cosh(n: c_float) -> c_float; #[link_name="erff"] - pub unsafe fn erf(n: c_float) -> c_float; + pub fn erf(n: c_float) -> c_float; #[link_name="erfcf"] - pub unsafe fn erfc(n: c_float) -> c_float; + pub fn erfc(n: c_float) -> c_float; #[link_name="expf"] - pub unsafe fn exp(n: c_float) -> c_float; + pub fn exp(n: c_float) -> c_float; #[link_name="expm1f"] - pub unsafe fn exp_m1(n: c_float) -> c_float; + pub fn exp_m1(n: c_float) -> c_float; #[link_name="exp2f"] - pub unsafe fn exp2(n: c_float) -> c_float; + pub fn exp2(n: c_float) -> c_float; #[link_name="fabsf"] - pub unsafe fn abs(n: c_float) -> c_float; + pub fn abs(n: c_float) -> c_float; #[link_name="fdimf"] - pub unsafe fn abs_sub(a: c_float, b: c_float) -> c_float; + pub fn abs_sub(a: c_float, b: c_float) -> c_float; #[link_name="floorf"] - pub unsafe fn floor(n: c_float) -> c_float; + pub fn floor(n: c_float) -> c_float; #[link_name="frexpf"] - pub unsafe fn frexp(n: c_float, value: &mut c_int) -> c_float; + pub fn frexp(n: c_float, value: &mut c_int) -> c_float; #[link_name="fmaf"] - pub unsafe fn mul_add(a: c_float, b: c_float, c: c_float) -> c_float; + pub fn mul_add(a: c_float, b: c_float, c: c_float) -> c_float; #[link_name="fmaxf"] - pub unsafe fn fmax(a: c_float, b: c_float) -> c_float; + pub fn fmax(a: c_float, b: c_float) -> c_float; #[link_name="fminf"] - pub unsafe fn fmin(a: c_float, b: c_float) -> c_float; + pub fn fmin(a: c_float, b: c_float) -> c_float; #[link_name="nextafterf"] - pub unsafe fn next_after(x: c_float, y: c_float) -> c_float; + pub fn next_after(x: c_float, y: c_float) -> c_float; #[link_name="hypotf"] - pub unsafe fn hypot(x: c_float, y: c_float) -> c_float; + pub fn hypot(x: c_float, y: c_float) -> c_float; #[link_name="ldexpf"] - pub unsafe fn ldexp(x: c_float, n: c_int) -> c_float; + pub fn ldexp(x: c_float, n: c_int) -> c_float; #[cfg(unix)] #[link_name="lgammaf_r"] - pub unsafe fn lgamma(n: c_float, sign: &mut c_int) -> c_float; + pub fn lgamma(n: c_float, sign: &mut c_int) -> c_float; #[cfg(windows)] #[link_name="__lgammaf_r"] - pub unsafe fn lgamma(n: c_float, sign: &mut c_int) -> c_float; + pub fn lgamma(n: c_float, sign: &mut c_int) -> c_float; #[link_name="logf"] - pub unsafe fn ln(n: c_float) -> c_float; + pub fn ln(n: c_float) -> c_float; #[link_name="logbf"] - pub unsafe fn log_radix(n: c_float) -> c_float; + pub fn log_radix(n: c_float) -> c_float; #[link_name="log1pf"] - pub unsafe fn ln_1p(n: c_float) -> c_float; + pub fn ln_1p(n: c_float) -> c_float; #[link_name="log2f"] - pub unsafe fn log2(n: c_float) -> c_float; + pub fn log2(n: c_float) -> c_float; #[link_name="log10f"] - pub unsafe fn log10(n: c_float) -> c_float; + pub fn log10(n: c_float) -> c_float; #[link_name="ilogbf"] - pub unsafe fn ilog_radix(n: c_float) -> c_int; + pub fn ilog_radix(n: c_float) -> c_int; #[link_name="modff"] - pub unsafe fn modf(n: c_float, iptr: &mut c_float) -> c_float; + pub fn modf(n: c_float, iptr: &mut c_float) -> c_float; #[link_name="powf"] - pub unsafe fn pow(n: c_float, e: c_float) -> c_float; + pub fn pow(n: c_float, e: c_float) -> c_float; // FIXME (#1379): enable when rounding modes become available - // #[link_name="rintf"] unsafe fn rint(n: c_float) -> c_float; + // #[link_name="rintf"] fn rint(n: c_float) -> c_float; #[link_name="roundf"] - pub unsafe fn round(n: c_float) -> c_float; + pub fn round(n: c_float) -> c_float; #[link_name="scalbnf"] - pub unsafe fn ldexp_radix(n: c_float, i: c_int) -> c_float; + pub fn ldexp_radix(n: c_float, i: c_int) -> c_float; #[link_name="sinf"] - pub unsafe fn sin(n: c_float) -> c_float; + pub fn sin(n: c_float) -> c_float; #[link_name="sinhf"] - pub unsafe fn sinh(n: c_float) -> c_float; + pub fn sinh(n: c_float) -> c_float; #[link_name="sqrtf"] - pub unsafe fn sqrt(n: c_float) -> c_float; + pub fn sqrt(n: c_float) -> c_float; #[link_name="tanf"] - pub unsafe fn tan(n: c_float) -> c_float; + pub fn tan(n: c_float) -> c_float; #[link_name="tanhf"] - pub unsafe fn tanh(n: c_float) -> c_float; + pub fn tanh(n: c_float) -> c_float; #[link_name="tgammaf"] - pub unsafe fn tgamma(n: c_float) -> c_float; + pub fn tgamma(n: c_float) -> c_float; #[link_name="truncf"] - pub unsafe fn trunc(n: c_float) -> c_float; + pub fn trunc(n: c_float) -> c_float; } } diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 8a1964783ae..f78f5812863 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -61,11 +61,11 @@ pub mod rustrt { use libc; extern { - pub unsafe fn rust_get_argc() -> c_int; - pub unsafe fn rust_get_argv() -> **c_char; - pub unsafe fn rust_path_is_dir(path: *libc::c_char) -> c_int; - pub unsafe fn rust_path_exists(path: *libc::c_char) -> c_int; - pub unsafe fn rust_set_exit_status(code: libc::intptr_t); + pub fn rust_get_argc() -> c_int; + pub fn rust_get_argv() -> **c_char; + pub fn rust_path_is_dir(path: *libc::c_char) -> c_int; + pub fn rust_path_exists(path: *libc::c_char) -> c_int; + pub fn rust_set_exit_status(code: libc::intptr_t); } } @@ -201,7 +201,7 @@ pub fn env() -> ~[(~str,~str)] { #[cfg(unix)] unsafe fn get_env_pairs() -> ~[~str] { extern { - unsafe fn rust_env_pairs() -> **libc::c_char; + fn rust_env_pairs() -> **libc::c_char; } let environ = rust_env_pairs(); if (environ as uint == 0) { @@ -694,7 +694,7 @@ pub fn list_dir(p: &Path) -> ~[~str] { use libc::{dirent_t}; use libc::{opendir, readdir, closedir}; extern { - unsafe fn rust_list_dir_val(ptr: *dirent_t) -> *libc::c_char; + fn rust_list_dir_val(ptr: *dirent_t) -> *libc::c_char; } let input = p.to_str(); let mut strings = ~[]; @@ -735,9 +735,8 @@ pub fn list_dir(p: &Path) -> ~[~str] { #[nolink] extern { - unsafe fn rust_list_dir_wfd_size() -> libc::size_t; - unsafe fn rust_list_dir_wfd_fp_buf(wfd: *libc::c_void) - -> *u16; + fn rust_list_dir_wfd_size() -> libc::size_t; + fn rust_list_dir_wfd_fp_buf(wfd: *libc::c_void) -> *u16; } fn star(p: &Path) -> Path { p.push("*") } do as_utf16_p(star(p).to_str()) |path_ptr| { @@ -964,7 +963,7 @@ pub fn errno() -> int { fn errno_location() -> *c_int { #[nolink] extern { - unsafe fn __error() -> *c_int; + fn __error() -> *c_int; } unsafe { __error() @@ -976,7 +975,7 @@ pub fn errno() -> int { fn errno_location() -> *c_int { #[nolink] extern { - unsafe fn __errno_location() -> *c_int; + fn __errno_location() -> *c_int; } unsafe { __errno_location() @@ -996,7 +995,7 @@ pub fn errno() -> uint { #[link_name = "kernel32"] #[abi = "stdcall"] extern "stdcall" { - unsafe fn GetLastError() -> DWORD; + fn GetLastError() -> DWORD; } unsafe { @@ -1011,11 +1010,12 @@ pub fn last_os_error() -> ~str { #[cfg(target_os = "macos")] #[cfg(target_os = "android")] #[cfg(target_os = "freebsd")] - fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int { + fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) + -> c_int { #[nolink] extern { - unsafe fn strerror_r(errnum: c_int, buf: *mut c_char, - buflen: size_t) -> c_int; + fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) + -> c_int; } unsafe { strerror_r(errnum, buf, buflen) @@ -1029,8 +1029,10 @@ pub fn last_os_error() -> ~str { fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int { #[nolink] extern { - unsafe fn __xpg_strerror_r(errnum: c_int, buf: *mut c_char, - buflen: size_t) -> c_int; + fn __xpg_strerror_r(errnum: c_int, + buf: *mut c_char, + buflen: size_t) + -> c_int; } unsafe { __xpg_strerror_r(errnum, buf, buflen) @@ -1058,10 +1060,14 @@ pub fn last_os_error() -> ~str { #[link_name = "kernel32"] #[abi = "stdcall"] extern "stdcall" { - unsafe fn FormatMessageA(flags: DWORD, lpSrc: LPVOID, - msgId: DWORD, langId: DWORD, - buf: LPSTR, nsize: DWORD, - args: *c_void) -> DWORD; + fn FormatMessageA(flags: DWORD, + lpSrc: LPVOID, + msgId: DWORD, + langId: DWORD, + buf: LPSTR, + nsize: DWORD, + args: *c_void) + -> DWORD; } static FORMAT_MESSAGE_FROM_SYSTEM: DWORD = 0x00001000; diff --git a/src/libstd/pipes.rs b/src/libstd/pipes.rs index a2ad2eb5e76..2819744c560 100644 --- a/src/libstd/pipes.rs +++ b/src/libstd/pipes.rs @@ -258,19 +258,17 @@ pub mod rustrt { extern { #[rust_stack] - pub unsafe fn rust_get_task() -> *rust_task; + pub fn rust_get_task() -> *rust_task; #[rust_stack] - pub unsafe fn rust_task_ref(task: *rust_task); - pub unsafe fn rust_task_deref(task: *rust_task); + pub fn rust_task_ref(task: *rust_task); + pub fn rust_task_deref(task: *rust_task); #[rust_stack] - pub unsafe fn task_clear_event_reject(task: *rust_task); + pub fn task_clear_event_reject(task: *rust_task); - pub unsafe fn task_wait_event(this: *rust_task, - killed: &mut *libc::c_void) - -> bool; - pub unsafe fn task_signal_event(target: *rust_task, - event: *libc::c_void); + pub fn task_wait_event(this: *rust_task, killed: &mut *libc::c_void) + -> bool; + pub fn task_signal_event(target: *rust_task, event: *libc::c_void); } } diff --git a/src/libstd/rand.rs b/src/libstd/rand.rs index 075e208ab82..20686e7a251 100644 --- a/src/libstd/rand.rs +++ b/src/libstd/rand.rs @@ -252,8 +252,8 @@ pub mod rustrt { use libc::size_t; extern { - pub unsafe fn rand_seed_size() -> size_t; - pub unsafe fn rand_gen_seed(buf: *mut u8, sz: size_t); + pub fn rand_seed_size() -> size_t; + pub fn rand_gen_seed(buf: *mut u8, sz: size_t); } } @@ -1085,10 +1085,9 @@ mod test { pub enum rust_rng {} extern { - pub unsafe fn rand_new_seeded(buf: *u8, sz: size_t) - -> *rust_rng; - pub unsafe fn rand_next(rng: *rust_rng) -> u32; - pub unsafe fn rand_free(rng: *rust_rng); + pub fn rand_new_seeded(buf: *u8, sz: size_t) -> *rust_rng; + pub fn rand_next(rng: *rust_rng) -> u32; + pub fn rand_free(rng: *rust_rng); } } diff --git a/src/libstd/rt/local_heap.rs b/src/libstd/rt/local_heap.rs index cd8e8549211..e1e7ceacc38 100644 --- a/src/libstd/rt/local_heap.rs +++ b/src/libstd/rt/local_heap.rs @@ -92,7 +92,7 @@ pub unsafe fn local_free(ptr: *libc::c_char) { extern { #[fast_ffi] - unsafe fn rust_upcall_free_noswitch(ptr: *libc::c_char); + fn rust_upcall_free_noswitch(ptr: *libc::c_char); } } _ => { diff --git a/src/libstd/rt/thread.rs b/src/libstd/rt/thread.rs index ed0137d3b0f..9f6cf68245e 100644 --- a/src/libstd/rt/thread.rs +++ b/src/libstd/rt/thread.rs @@ -49,7 +49,7 @@ impl Drop for Thread { } extern { - pub unsafe fn rust_raw_thread_start(f: &(~fn())) -> *raw_thread; - pub unsafe fn rust_raw_thread_join(thread: *raw_thread); - pub unsafe fn rust_raw_thread_delete(thread: *raw_thread); + pub fn rust_raw_thread_start(f: &(~fn())) -> *raw_thread; + pub fn rust_raw_thread_join(thread: *raw_thread); + pub fn rust_raw_thread_delete(thread: *raw_thread); } diff --git a/src/libstd/run.rs b/src/libstd/run.rs index 8af5a6dfac7..65316d4092b 100644 --- a/src/libstd/run.rs +++ b/src/libstd/run.rs @@ -639,8 +639,8 @@ fn spawn_process_os(prog: &str, args: &[~str], #[abi = "cdecl"] extern { - pub unsafe fn rust_unset_sigprocmask(); - pub unsafe fn rust_set_environ(envp: *c_void); + pub fn rust_unset_sigprocmask(); + pub fn rust_set_environ(envp: *c_void); } } diff --git a/src/libstd/sys.rs b/src/libstd/sys.rs index 4ca5d82265f..51609709cdb 100644 --- a/src/libstd/sys.rs +++ b/src/libstd/sys.rs @@ -27,9 +27,7 @@ pub mod rustrt { extern { #[rust_stack] - pub unsafe fn rust_upcall_fail(expr: *c_char, - file: *c_char, - line: size_t); + pub fn rust_upcall_fail(expr: *c_char, file: *c_char, line: size_t); } } diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs index e08297a1425..f7a943f8d2f 100644 --- a/src/libstd/task/mod.rs +++ b/src/libstd/task/mod.rs @@ -1078,12 +1078,12 @@ mod testrt { #[nolink] extern { - pub unsafe fn rust_dbg_lock_create() -> *libc::c_void; - pub unsafe fn rust_dbg_lock_destroy(lock: *libc::c_void); - pub unsafe fn rust_dbg_lock_lock(lock: *libc::c_void); - pub unsafe fn rust_dbg_lock_unlock(lock: *libc::c_void); - pub unsafe fn rust_dbg_lock_wait(lock: *libc::c_void); - pub unsafe fn rust_dbg_lock_signal(lock: *libc::c_void); + pub fn rust_dbg_lock_create() -> *libc::c_void; + pub fn rust_dbg_lock_destroy(lock: *libc::c_void); + pub fn rust_dbg_lock_lock(lock: *libc::c_void); + pub fn rust_dbg_lock_unlock(lock: *libc::c_void); + pub fn rust_dbg_lock_wait(lock: *libc::c_void); + pub fn rust_dbg_lock_signal(lock: *libc::c_void); } } diff --git a/src/libstd/unstable/intrinsics.rs b/src/libstd/unstable/intrinsics.rs index 5d6cd594f48..50d9c7e4ded 100644 --- a/src/libstd/unstable/intrinsics.rs +++ b/src/libstd/unstable/intrinsics.rs @@ -296,16 +296,16 @@ extern "rust-intrinsic" { /// `init` is unsafe because it returns a zeroed-out datum, /// which is unsafe unless T is POD. We don't have a POD /// kind yet. (See #4074). - pub unsafe fn init<T>() -> T; + pub fn init<T>() -> T; /// Create an uninitialized value. - pub unsafe fn uninit<T>() -> T; + pub fn uninit<T>() -> T; /// Move a value out of scope without running drop glue. /// /// `forget` is unsafe because the caller is responsible for /// ensuring the argument is deallocated already. - pub unsafe fn forget<T>(_: T) -> (); + pub fn forget<T>(_: T) -> (); pub fn transmute<T,U>(e: T) -> U; /// Returns `true` if a type requires drop glue. diff --git a/src/libstd/unstable/lang.rs b/src/libstd/unstable/lang.rs index 9bbc578d194..e0c4950b38e 100644 --- a/src/libstd/unstable/lang.rs +++ b/src/libstd/unstable/lang.rs @@ -28,17 +28,12 @@ pub mod rustrt { extern { #[rust_stack] - pub unsafe fn rust_upcall_malloc(td: *c_char, size: uintptr_t) - -> *c_char; - + pub fn rust_upcall_malloc(td: *c_char, size: uintptr_t) -> *c_char; #[rust_stack] - pub unsafe fn rust_upcall_free(ptr: *c_char); - + pub fn rust_upcall_free(ptr: *c_char); #[fast_ffi] - pub unsafe fn rust_upcall_malloc_noswitch(td: *c_char, - size: uintptr_t) - -> *c_char; - + pub fn rust_upcall_malloc_noswitch(td: *c_char, size: uintptr_t) + -> *c_char; #[rust_stack] pub fn rust_try_get_task() -> *rust_task; } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index d6bee4fe19f..11f2c7005bc 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1077,7 +1077,7 @@ pub struct foreign_item { #[deriving(Eq, Encodable, Decodable,IterBytes)] pub enum foreign_item_ { - foreign_item_fn(fn_decl, purity, Generics), + foreign_item_fn(fn_decl, Generics), foreign_item_static(Ty, /* is_mutbl */ bool), } diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index f0b00f5681c..9bda1189a8e 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -223,7 +223,7 @@ fn noop_fold_foreign_item(ni: @foreign_item, fld: @ast_fold) attrs: ni.attrs.map(|x| fold_attribute(*x)), node: match ni.node { - foreign_item_fn(ref fdec, purity, ref generics) => { + foreign_item_fn(ref fdec, ref generics) => { foreign_item_fn( ast::fn_decl { inputs: fdec.inputs.map(|a| @@ -231,7 +231,6 @@ fn noop_fold_foreign_item(ni: @foreign_item, fld: @ast_fold) output: fld.fold_ty(&fdec.output), cf: fdec.cf, }, - purity, fold_generics(generics, fld)) } foreign_item_static(ref t, m) => { diff --git a/src/libsyntax/oldvisit.rs b/src/libsyntax/oldvisit.rs index c421ded6d75..a39dc38a856 100644 --- a/src/libsyntax/oldvisit.rs +++ b/src/libsyntax/oldvisit.rs @@ -339,7 +339,7 @@ pub fn visit_pat<E:Clone>(p: &pat, (e, v): (E, vt<E>)) { pub fn visit_foreign_item<E:Clone>(ni: &foreign_item, (e, v): (E, vt<E>)) { match ni.node { - foreign_item_fn(ref fd, _, ref generics) => { + foreign_item_fn(ref fd, ref generics) => { visit_fn_decl(fd, (e.clone(), v)); (v.visit_generics)(generics, (e, v)); } diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 3472b9f1d67..ec956f61863 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -63,6 +63,7 @@ pub enum ObsoleteSyntax { ObsoleteMultipleLocalDecl, ObsoleteMutWithMultipleBindings, ObsoleteExternVisibility, + ObsoleteUnsafeExternFn, } impl to_bytes::IterBytes for ObsoleteSyntax { @@ -246,7 +247,12 @@ impl ParserObsoleteMethods for Parser { "`pub extern` or `priv extern`", "place the `pub` or `priv` on the individual external items \ instead" - ) + ), + ObsoleteUnsafeExternFn => ( + "unsafe external function", + "external functions are always unsafe; remove the `unsafe` \ + keyword" + ), }; self.report(sp, kind, kind_str, desc); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 1d61c5be83d..386f027d6e1 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -84,7 +84,8 @@ use parse::obsolete::{ObsoletePurity, ObsoleteStaticMethod}; use parse::obsolete::{ObsoleteConstItem, ObsoleteFixedLengthVectorType}; use parse::obsolete::{ObsoleteNamedExternModule, ObsoleteMultipleLocalDecl}; use parse::obsolete::{ObsoleteMutWithMultipleBindings}; -use parse::obsolete::{ObsoleteExternVisibility, ParserObsoleteMethods}; +use parse::obsolete::{ObsoleteExternVisibility, ObsoleteUnsafeExternFn}; +use parse::obsolete::{ParserObsoleteMethods}; use parse::token::{can_begin_expr, get_ident_interner, ident_to_str, is_ident}; use parse::token::{is_ident_or_path}; use parse::token::{is_plain_ident, INTERPOLATED, keywords, special_idents}; @@ -4066,14 +4067,20 @@ impl Parser { fn parse_item_foreign_fn(&self, attrs: ~[Attribute]) -> @foreign_item { let lo = self.span.lo; let vis = self.parse_visibility(); + + // Parse obsolete purity. let purity = self.parse_fn_purity(); + if purity != impure_fn { + self.obsolete(*self.last_span, ObsoleteUnsafeExternFn); + } + let (ident, generics) = self.parse_fn_header(); let decl = self.parse_fn_decl(); let hi = self.span.hi; self.expect(&token::SEMI); @ast::foreign_item { ident: ident, attrs: attrs, - node: foreign_item_fn(decl, purity, generics), + node: foreign_item_fn(decl, generics), id: self.get_id(), span: mk_sp(lo, hi), vis: vis } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index d24dd86fda1..7d885837a60 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -454,8 +454,8 @@ pub fn print_foreign_item(s: @ps, item: &ast::foreign_item) { maybe_print_comment(s, item.span.lo); print_outer_attributes(s, item.attrs); match item.node { - ast::foreign_item_fn(ref decl, purity, ref generics) => { - print_fn(s, decl, Some(purity), AbiSet::Rust(), item.ident, generics, None, + ast::foreign_item_fn(ref decl, ref generics) => { + print_fn(s, decl, None, AbiSet::Rust(), item.ident, generics, None, item.vis); end(s); // end head-ibox word(s.s, ";"); diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 7278bdeb376..6f228a9a43b 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -317,7 +317,7 @@ pub fn visit_foreign_item<E:Clone>(visitor: @Visitor<E>, foreign_item: &foreign_item, env: E) { match foreign_item.node { - foreign_item_fn(ref function_declaration, _, ref generics) => { + foreign_item_fn(ref function_declaration, ref generics) => { visit_fn_decl(visitor, function_declaration, env.clone()); visitor.visit_generics(generics, env) } diff --git a/src/test/bench/noise.rs b/src/test/bench/noise.rs index 2907496dfa9..ef6bac16d74 100644 --- a/src/test/bench/noise.rs +++ b/src/test/bench/noise.rs @@ -119,7 +119,7 @@ fn main() { foreach y in range(0, 256) { foreach x in range(0, 256) { - print((symbols[pixels[y*256+x] / 0.2f32) as int]); + print(symbols[(pixels[y*256+x] / 0.2f32) as int]); } println(""); } diff --git a/src/test/compile-fail/foreign-unsafe-fn-called.rs b/src/test/compile-fail/foreign-unsafe-fn-called.rs index 875ea6b75cf..6c74c860a4b 100644 --- a/src/test/compile-fail/foreign-unsafe-fn-called.rs +++ b/src/test/compile-fail/foreign-unsafe-fn-called.rs @@ -13,7 +13,7 @@ mod test { #[abi = "cdecl"] extern { - pub unsafe fn free(); + pub fn free(); } } diff --git a/src/test/run-pass/extern-pub.rs b/src/test/run-pass/extern-pub.rs index 27c45893930..b146f32ec1e 100644 --- a/src/test/run-pass/extern-pub.rs +++ b/src/test/run-pass/extern-pub.rs @@ -1,5 +1,5 @@ extern { - pub unsafe fn free(p: *u8); + pub fn free(p: *u8); } pub fn main() { |
