diff options
| author | bors <bors@rust-lang.org> | 2013-08-23 18:41:30 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-08-23 18:41:30 -0700 |
| commit | f9979247d1d69c1a8fb7cd1d2829a629baf9d965 (patch) | |
| tree | f0113632549a4b009cb8a37cb2ef3de73d69c9cc /src/rt/rust_test_helpers.cpp | |
| parent | 7b5a91f4b346b99b4e9171eb8deb52d9bf2525ea (diff) | |
| parent | 9cdfe1e6039598961838ba2cc88a6ed6aa5449bf (diff) | |
| download | rust-f9979247d1d69c1a8fb7cd1d2829a629baf9d965.tar.gz rust-f9979247d1d69c1a8fb7cd1d2829a629baf9d965.zip | |
auto merge of #8705 : brson/rust/lesscxx, r=graydon
Diffstat (limited to 'src/rt/rust_test_helpers.cpp')
| -rw-r--r-- | src/rt/rust_test_helpers.cpp | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/src/rt/rust_test_helpers.cpp b/src/rt/rust_test_helpers.cpp index b0aab9672ea..f10a1f36938 100644 --- a/src/rt/rust_test_helpers.cpp +++ b/src/rt/rust_test_helpers.cpp @@ -11,10 +11,8 @@ // Helper functions used only in tests #include "rust_util.h" -#include "sync/timer.h" #include "sync/rust_thread.h" #include "sync/lock_and_signal.h" -#include "rust_abi.h" // These functions are used in the unit tests for C ABI calls. @@ -179,3 +177,49 @@ extern "C" CDECL intptr_t rust_get_test_int() { return 1; } + +/* Debug helpers strictly to verify ABI conformance. + * + * FIXME (#2665): move these into a testcase when the testsuite + * understands how to have explicit C files included. + */ + +struct quad { + uint64_t a; + uint64_t b; + uint64_t c; + uint64_t d; +}; + +struct floats { + double a; + uint8_t b; + double c; +}; + +extern "C" quad +rust_dbg_abi_1(quad q) { + quad qq = { q.c + 1, + q.d - 1, + q.a + 1, + q.b - 1 }; + return qq; +} + +extern "C" floats +rust_dbg_abi_2(floats f) { + floats ff = { f.c + 1.0, + 0xff, + f.a - 1.0 }; + return ff; +} + +extern "C" int +rust_dbg_static_mut; + +int rust_dbg_static_mut = 3; + +extern "C" void +rust_dbg_static_mut_check_four() { + assert(rust_dbg_static_mut == 4); +} |
