Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
c17447f8
R
Rust
项目概览
int
/
Rust
接近 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c17447f8
编写于
8月 22, 2013
作者:
B
Brian Anderson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rt: Move some test functions to rust_test_helpers
上级
4541c6cf
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
70 addition
and
71 deletion
+70
-71
src/rt/rust_builtin.cpp
src/rt/rust_builtin.cpp
+0
-47
src/rt/rust_test_helpers.cpp
src/rt/rust_test_helpers.cpp
+46
-0
src/rt/rustrt.def.in
src/rt/rustrt.def.in
+4
-4
src/test/compile-fail/attrs-after-extern-mod.rs
src/test/compile-fail/attrs-after-extern-mod.rs
+2
-2
src/test/run-pass/static-mut-foreign.rs
src/test/run-pass/static-mut-foreign.rs
+14
-14
src/test/run-pass/struct-return.rs
src/test/run-pass/struct-return.rs
+4
-4
未找到文件。
src/rt/rust_builtin.cpp
浏览文件 @
c17447f8
...
...
@@ -99,53 +99,6 @@ rand_free(rust_rng *rng) {
free
(
rng
);
}
/* 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
debug_abi_1
(
quad
q
)
{
quad
qq
=
{
q
.
c
+
1
,
q
.
d
-
1
,
q
.
a
+
1
,
q
.
b
-
1
};
return
qq
;
}
extern
"C"
floats
debug_abi_2
(
floats
f
)
{
floats
ff
=
{
f
.
c
+
1.0
,
0xff
,
f
.
a
-
1.0
};
return
ff
;
}
extern
"C"
int
debug_static_mut
;
int
debug_static_mut
=
3
;
extern
"C"
void
debug_static_mut_check_four
()
{
assert
(
debug_static_mut
==
4
);
}
extern
"C"
CDECL
char
*
#if defined(__WIN32__)
rust_list_dir_val
(
WIN32_FIND_DATA
*
entry_ptr
)
{
...
...
src/rt/rust_test_helpers.cpp
浏览文件 @
c17447f8
...
...
@@ -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
);
}
src/rt/rustrt.def.in
浏览文件 @
c17447f8
debu
g_abi_1
debu
g_abi_2
debu
g_static_mut
debu
g_static_mut_check_four
rust_db
g_abi_1
rust_db
g_abi_2
rust_db
g_static_mut
rust_db
g_static_mut_check_four
get_time
rust_tzset
rust_gmtime
...
...
src/test/compile-fail/attrs-after-extern-mod.rs
浏览文件 @
c17447f8
...
...
@@ -16,8 +16,8 @@
#[nolink]
extern
{
static
mut
debu
g_static_mut
:
libc
::
c_int
;
pub
fn
debu
g_static_mut_check_four
();
static
mut
rust_db
g_static_mut
:
libc
::
c_int
;
pub
fn
rust_db
g_static_mut_check_four
();
#[cfg(stage37)]
//~ ERROR expected item after attributes
}
...
...
src/test/run-pass/static-mut-foreign.rs
浏览文件 @
c17447f8
...
...
@@ -16,8 +16,8 @@
#[nolink]
extern
{
static
mut
debu
g_static_mut
:
libc
::
c_int
;
pub
fn
debu
g_static_mut_check_four
();
static
mut
rust_db
g_static_mut
:
libc
::
c_int
;
pub
fn
rust_db
g_static_mut_check_four
();
}
unsafe
fn
static_bound
(
_
:
&
'static
libc
::
c_int
)
{}
...
...
@@ -28,18 +28,18 @@ fn static_bound_set(a: &'static mut libc::c_int) {
#[fixed_stack_segment]
#[inline(never)]
unsafe
fn
run
()
{
assert
!
(
debu
g_static_mut
==
3
);
debu
g_static_mut
=
4
;
assert
!
(
debu
g_static_mut
==
4
);
debu
g_static_mut_check_four
();
debu
g_static_mut
+=
1
;
assert
!
(
debu
g_static_mut
==
5
);
debu
g_static_mut
*=
3
;
assert
!
(
debu
g_static_mut
==
15
);
debu
g_static_mut
=
-
3
;
assert
!
(
debu
g_static_mut
==
-
3
);
static_bound
(
&
debu
g_static_mut
);
static_bound_set
(
&
mut
debu
g_static_mut
);
assert
!
(
rust_db
g_static_mut
==
3
);
rust_db
g_static_mut
=
4
;
assert
!
(
rust_db
g_static_mut
==
4
);
rust_db
g_static_mut_check_four
();
rust_db
g_static_mut
+=
1
;
assert
!
(
rust_db
g_static_mut
==
5
);
rust_db
g_static_mut
*=
3
;
assert
!
(
rust_db
g_static_mut
==
15
);
rust_db
g_static_mut
=
-
3
;
assert
!
(
rust_db
g_static_mut
==
-
3
);
static_bound
(
&
rust_db
g_static_mut
);
static_bound_set
(
&
mut
rust_db
g_static_mut
);
}
pub
fn
main
()
{
...
...
src/test/run-pass/struct-return.rs
浏览文件 @
c17447f8
...
...
@@ -16,8 +16,8 @@ mod rustrt {
#[nolink]
extern
{
pub
fn
debu
g_abi_1
(
q
:
Quad
)
->
Quad
;
pub
fn
debu
g_abi_2
(
f
:
Floats
)
->
Floats
;
pub
fn
rust_db
g_abi_1
(
q
:
Quad
)
->
Quad
;
pub
fn
rust_db
g_abi_2
(
f
:
Floats
)
->
Floats
;
}
}
...
...
@@ -28,7 +28,7 @@ fn test1() {
b
:
0xbbbb_bbbb_bbbb_bbbb_u64
,
c
:
0xcccc_cccc_cccc_cccc_u64
,
d
:
0xdddd_dddd_dddd_dddd_u64
};
let
qq
=
rustrt
::
debu
g_abi_1
(
q
);
let
qq
=
rustrt
::
rust_db
g_abi_1
(
q
);
error!
(
"a: %x"
,
qq
.a
as
uint
);
error!
(
"b: %x"
,
qq
.b
as
uint
);
error!
(
"c: %x"
,
qq
.c
as
uint
);
...
...
@@ -48,7 +48,7 @@ fn test2() {
let
f
=
Floats
{
a
:
1.234567890e-15_f64
,
b
:
0b_1010_1010_u8
,
c
:
1.0987654321e-15_f64
};
let
ff
=
rustrt
::
debu
g_abi_2
(
f
);
let
ff
=
rustrt
::
rust_db
g_abi_2
(
f
);
error!
(
"a: %f"
,
ff
.a
as
float
);
error!
(
"b: %u"
,
ff
.b
as
uint
);
error!
(
"c: %f"
,
ff
.c
as
float
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录