diff options
| author | bors <bors@rust-lang.org> | 2013-03-13 14:57:55 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-03-13 14:57:55 -0700 |
| commit | ab5472a7244896df20ceb7a12d9d30afc838f004 (patch) | |
| tree | 1ca658c64f9200eb015762c4d4557f5172cf4837 /src/rt/rust_builtin.cpp | |
| parent | 67b0f3d5b2d88ea9b5c0a667fc3dbdf794e5c054 (diff) | |
| parent | 852619d5d7ef7e9b9c5e57102e244c575f0c6a8f (diff) | |
| download | rust-ab5472a7244896df20ceb7a12d9d30afc838f004.tar.gz rust-ab5472a7244896df20ceb7a12d9d30afc838f004.zip | |
auto merge of #5307 : nikomatsakis/rust/remove-by-val, r=nikomatsakis
This is done in two steps: First, we make foreign functions not consider modes at all. This is because previously ++ mode was the only way to pass structs to foreign functions and so forth. We also add a lint mode warning if you use `&&` mode in a foreign function, since the semantics of that change (it used to pass a pointer to the C function, now it doesn't). Then, we remove by value and make it equivalent to `+` mode. At the same time, we stop parsing `-` mode and convert all uses of it to `+` mode (it was already being parsed to `+` mode anyhow). This obsoletes pull request #5298. r? @brson
Diffstat (limited to 'src/rt/rust_builtin.cpp')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 8d83e2036b9..5a9de9735ba 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -434,18 +434,18 @@ rust_tzset() { } extern "C" CDECL void -rust_gmtime(int64_t *sec, int32_t *nsec, rust_tm *timeptr) { +rust_gmtime(int64_t sec, int32_t nsec, rust_tm *timeptr) { tm tm; - time_t s = *sec; + time_t s = sec; GMTIME(&s, &tm); - tm_to_rust_tm(&tm, timeptr, 0, "UTC", *nsec); + tm_to_rust_tm(&tm, timeptr, 0, "UTC", nsec); } extern "C" CDECL void -rust_localtime(int64_t *sec, int32_t *nsec, rust_tm *timeptr) { +rust_localtime(int64_t sec, int32_t nsec, rust_tm *timeptr) { tm tm; - time_t s = *sec; + time_t s = sec; LOCALTIME(&s, &tm); #if defined(__WIN32__) @@ -457,7 +457,7 @@ rust_localtime(int64_t *sec, int32_t *nsec, rust_tm *timeptr) { const char *zone = tm.tm_zone; #endif - tm_to_rust_tm(&tm, timeptr, gmtoff, zone, *nsec); + tm_to_rust_tm(&tm, timeptr, gmtoff, zone, nsec); } extern "C" CDECL void @@ -844,6 +844,38 @@ rust_readdir() { #endif +// These functions are used in the unit tests for C ABI calls. + +extern "C" CDECL uint32_t +rust_dbg_extern_identity_u32(uint32_t u) { + return u; +} + +extern "C" CDECL uint64_t +rust_dbg_extern_identity_u64(uint64_t u) { + return u; +} + +struct TwoU64s { + uint64_t one; + uint64_t two; +}; + +extern "C" CDECL TwoU64s +rust_dbg_extern_identity_TwoU64s(TwoU64s u) { + return u; +} + +extern "C" CDECL double +rust_dbg_extern_identity_double(double u) { + return u; +} + +extern "C" CDECL char +rust_dbg_extern_identity_u8(char u) { + return u; +} + // // Local Variables: |
