1 // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Helper functions used only in tests
13 #include "rust_globals.h"
15 // These functions are used in the unit tests for C ABI calls.
18 rust_dbg_extern_identity_u32(uint32_t u) {
23 rust_dbg_extern_identity_u64(uint64_t u) {
28 rust_dbg_extern_identity_double(double u) {
33 rust_dbg_extern_identity_u8(char u) {
37 typedef void *(*dbg_callback)(void*);
40 rust_dbg_call(dbg_callback cb, void *data) {
44 void rust_dbg_do_nothing() { }
52 rust_dbg_extern_return_TwoU8s() {
60 rust_dbg_extern_identity_TwoU8s(struct TwoU8s u) {
70 rust_dbg_extern_return_TwoU16s() {
78 rust_dbg_extern_identity_TwoU16s(struct TwoU16s u) {
88 rust_dbg_extern_return_TwoU32s() {
96 rust_dbg_extern_identity_TwoU32s(struct TwoU32s u) {
106 rust_dbg_extern_return_TwoU64s() {
114 rust_dbg_extern_identity_TwoU64s(struct TwoU64s u) {
124 rust_dbg_extern_identity_TwoDoubles(struct TwoDoubles u) {
129 rust_get_test_int() {
133 /* Debug helpers strictly to verify ABI conformance.
135 * FIXME (#2665): move these into a testcase when the testsuite
136 * understands how to have explicit C files included.
153 rust_dbg_abi_1(struct quad q) {
154 struct quad qq = { q.c + 1,
162 rust_dbg_abi_2(struct floats f) {
163 struct floats ff = { f.c + 1.0,
172 int rust_dbg_static_mut = 3;
175 rust_dbg_static_mut_check_four() {
176 assert(rust_dbg_static_mut == 4);