diff options
| author | Brian Anderson <banderson@mozilla.com> | 2013-08-22 22:57:40 -0700 | 
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2013-08-23 18:38:59 -0700 | 
| commit | c17447f8b30a11ce6624c7088f647a6261c70135 (patch) | |
| tree | fca84c32f8b1a3f0898a4be5117d82440ef0e8bd /src/rt/rust_test_helpers.cpp | |
| parent | 4541c6cfe3ee875020329f888c39ea75183b23d1 (diff) | |
| download | rust-c17447f8b30a11ce6624c7088f647a6261c70135.tar.gz rust-c17447f8b30a11ce6624c7088f647a6261c70135.zip | |
rt: Move some test functions to rust_test_helpers
Diffstat (limited to 'src/rt/rust_test_helpers.cpp')
| -rw-r--r-- | src/rt/rust_test_helpers.cpp | 46 | 
1 files changed, 46 insertions, 0 deletions
| diff --git a/src/rt/rust_test_helpers.cpp b/src/rt/rust_test_helpers.cpp index b9be4f1e251..33fea72cca7 100644 --- a/src/rt/rust_test_helpers.cpp +++ b/src/rt/rust_test_helpers.cpp @@ -178,3 +178,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); +} | 
