Skip to content

Commit 0df9864

Browse files
committed
remove #[no_mangle] from extern "C" blocks in tests
this is no longer needed and just produces unnecessary warnings
1 parent 64e95bc commit 0df9864

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+0
-164
lines changed

c2rust-refactor/tests/ownership_upgrade_ptrs/new.rs

-20
Original file line numberDiff line numberDiff line change
@@ -13,53 +13,33 @@
1313
extern crate libc;
1414

1515
extern "C" {
16-
#[no_mangle]
1716
fn malloc(_: libc::c_ulong) -> *mut libc::c_void;
18-
#[no_mangle]
1917
#[ownership_constraints(le(WRITE, _0), le(_0, WRITE))]
2018
fn memset(_: *mut libc::c_void, _: libc::c_int, _: libc::c_ulong);
21-
#[no_mangle]
2219
fn free(_: *mut libc::c_void);
23-
#[no_mangle]
2420
fn fabs(_: libc::c_double) -> libc::c_double;
25-
#[no_mangle]
2621
fn cosh(_: libc::c_double) -> libc::c_double;
27-
#[no_mangle]
2822
fn sinh(_: libc::c_double) -> libc::c_double;
29-
#[no_mangle]
3023
fn exp(_: libc::c_double) -> libc::c_double;
31-
#[no_mangle]
3224
#[ownership_constraints(le(WRITE, _0), le(_0, WRITE))]
3325
fn takes_ptrs(_: *mut u32, _: *const u32);
34-
#[no_mangle]
3526
fn takeswint(_: wint_t) -> wint_t;
36-
#[no_mangle]
3727
fn strlen(_: *const libc::c_char) -> size_t;
38-
#[no_mangle]
3928
fn memcpy(_: *mut libc::c_void, _: *const libc::c_void, _: size_t) -> *mut libc::c_void;
40-
#[no_mangle]
4129
fn strdup(_: *const libc::c_char) -> *mut libc::c_char;
42-
#[no_mangle]
4330
fn strsep(_: *mut *mut libc::c_char, _: *const libc::c_char) -> *mut libc::c_char;
44-
#[no_mangle]
4531
fn __chk_fail() -> !;
46-
#[no_mangle]
4732
fn vsprintf(_: *mut libc::c_char, _: *const libc::c_char, _: ::std::ffi::VaList)
4833
-> libc::c_int;
49-
#[no_mangle]
5034
fn vsnprintf(
5135
_: *mut libc::c_char,
5236
_: size_t,
5337
_: *const libc::c_char,
5438
_: ::std::ffi::VaList,
5539
) -> libc::c_int;
56-
#[no_mangle]
5740
fn get_ptr() -> *mut u32;
58-
#[no_mangle]
5941
fn get_struct_ptr() -> *mut Ctx;
60-
#[no_mangle]
6142
type _reent;
62-
#[no_mangle]
6343
static mut _impure_ptr: *mut _reent;
6444
}
6545

c2rust-refactor/tests/ownership_upgrade_ptrs/old.rs

-20
Original file line numberDiff line numberDiff line change
@@ -13,51 +13,31 @@
1313
extern crate libc;
1414

1515
extern "C" {
16-
#[no_mangle]
1716
fn malloc(_: libc::c_ulong) -> *mut libc::c_void;
18-
#[no_mangle]
1917
#[ownership_constraints(le(WRITE, _0), le(_0, WRITE))]
2018
fn memset(_: *mut libc::c_void, _: libc::c_int, _: libc::c_ulong);
21-
#[no_mangle]
2219
fn free(_: *mut libc::c_void);
23-
#[no_mangle]
2420
fn fabs(_: libc::c_double) -> libc::c_double;
25-
#[no_mangle]
2621
fn cosh(_: libc::c_double) -> libc::c_double;
27-
#[no_mangle]
2822
fn sinh(_: libc::c_double) -> libc::c_double;
29-
#[no_mangle]
3023
fn exp(_: libc::c_double) -> libc::c_double;
31-
#[no_mangle]
3224
#[ownership_constraints(le(WRITE, _0), le(_0, WRITE))]
3325
fn takes_ptrs(_: *mut u32, _: *const u32);
34-
#[no_mangle]
3526
fn takeswint(_: wint_t) -> wint_t;
36-
#[no_mangle]
3727
fn strlen(_: *const libc::c_char) -> size_t;
38-
#[no_mangle]
3928
fn memcpy(_: *mut libc::c_void, _: *const libc::c_void, _: size_t)
4029
-> *mut libc::c_void;
41-
#[no_mangle]
4230
fn strdup(_: *const libc::c_char) -> *mut libc::c_char;
43-
#[no_mangle]
4431
fn strsep(_: *mut *mut libc::c_char, _: *const libc::c_char)
4532
-> *mut libc::c_char;
46-
#[no_mangle]
4733
fn __chk_fail() -> !;
48-
#[no_mangle]
4934
fn vsprintf(_: *mut libc::c_char, _: *const libc::c_char,
5035
_: ::std::ffi::VaList) -> libc::c_int;
51-
#[no_mangle]
5236
fn vsnprintf(_: *mut libc::c_char, _: size_t, _: *const libc::c_char,
5337
_: ::std::ffi::VaList) -> libc::c_int;
54-
#[no_mangle]
5538
fn get_ptr() -> *mut u32;
56-
#[no_mangle]
5739
fn get_struct_ptr() -> *mut Ctx;
58-
#[no_mangle]
5940
type _reent;
60-
#[no_mangle]
6141
static mut _impure_ptr: *mut _reent;
6242
}
6343

c2rust-refactor/tests/retype_str/new.rs

-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ extern crate libc;
55
use std::slice;
66

77
extern "C" {
8-
#[no_mangle]
98
fn strlen(_: *const u8) -> libc::c_ulong;
10-
#[no_mangle]
119
fn printf(_: *const u8, ...) -> libc::c_int;
12-
#[no_mangle]
1310
fn test_mut(_: *mut u8) -> libc::c_ulong;
1411
}
1512

c2rust-refactor/tests/retype_str/old.rs

-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ extern crate libc;
55
use std::slice;
66

77
extern "C" {
8-
#[no_mangle]
98
fn strlen(_: *const libc::c_char) -> libc::c_ulong;
10-
#[no_mangle]
119
fn printf(_: *const libc::c_char, ...) -> libc::c_int;
12-
#[no_mangle]
1310
fn test_mut(_: *mut libc::c_char) -> libc::c_ulong;
1411
}
1512

c2rust-refactor/tests/upgrade_ptr_to_ref/new.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
extern crate libc;
33

44
extern "C" {
5-
#[no_mangle]
65
fn malloc(_: libc::c_ulong) -> *mut libc::c_void;
76
}
87

@@ -155,7 +154,6 @@ struct HashHDR {
155154
}
156155

157156
extern "C" {
158-
#[no_mangle]
159157
fn memset(_: *mut libc::c_void, _: libc::c_int, _: libc::c_ulong);
160158
}
161159

c2rust-refactor/tests/upgrade_ptr_to_ref/old.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
extern crate libc;
33

44
extern "C" {
5-
#[no_mangle]
65
fn malloc(_: libc::c_ulong) -> *mut libc::c_void;
76
}
87

@@ -146,7 +145,6 @@ struct HashHDR {
146145
}
147146

148147
extern "C" {
149-
#[no_mangle]
150148
fn memset(_: *mut libc::c_void, _: libc::c_int, _: libc::c_ulong);
151149
}
152150

tests/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use self::libc::c_int;
1919
2020
#[link(name = "test")]
2121
extern "C" {
22-
#[no_mangle]
2322
fn example(_: c_uint, _: *mut c_int);
2423
}
2524

tests/arrays/src/test_arrays.rs

-6
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,16 @@ use self::libc::{c_int, c_uint};
77

88
#[link(name = "test")]
99
extern "C" {
10-
#[no_mangle]
1110
fn entry(_: c_uint, _: *mut c_int);
1211

13-
#[no_mangle]
1412
fn entry2(_: c_uint, _: *mut c_int);
1513

16-
#[no_mangle]
1714
fn test_sized_array() -> c_uint;
1815

19-
#[no_mangle]
2016
fn variable_arrays(_: *mut c_int);
2117

22-
#[no_mangle]
2318
fn alloca_arrays(_: *mut c_int);
2419

25-
#[no_mangle]
2620
fn check_some_ints() -> bool;
2721
}
2822

tests/builtins/src/test_builtins.rs

-9
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,14 @@ use self::libc::{c_int, c_uint, c_char, c_long, c_longlong, c_double};
88

99
#[link(name = "test")]
1010
extern "C" {
11-
#[no_mangle]
1211
fn atomics_entry(_: c_uint, _: *mut c_int);
13-
#[no_mangle]
1412
fn new_atomics(_: c_uint, _: *mut c_int);
15-
#[no_mangle]
1613
fn mem_x(_: *const c_char, _: *mut c_char);
17-
#[no_mangle]
1814
fn ffs(_: c_int) -> c_int;
19-
#[no_mangle]
2015
fn ffsl(_: c_long) -> c_int;
21-
#[no_mangle]
2216
fn ffsll(_: c_longlong) -> c_int;
23-
#[no_mangle]
2417
fn isfinite(_: c_double) -> c_int;
25-
#[no_mangle]
2618
fn isnan(_: c_double) -> c_int;
27-
#[no_mangle]
2819
fn isinf_sign(_: c_double) -> c_int;
2920
}
3021

tests/casts/src/test_casts.rs

-4
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,12 @@ use std::mem::transmute;
99

1010
#[link(name = "test")]
1111
extern "C" {
12-
#[no_mangle]
1312
fn cast_stuff();
1413

15-
#[no_mangle]
1614
fn identity(_: c_int) -> c_int;
1715

18-
#[no_mangle]
1916
fn get_identity() -> *mut c_void;
2017

21-
#[no_mangle]
2218
fn entry(_: c_uint, _: *mut c_int);
2319
}
2420

tests/conditionals/src/test_conditionals.rs

-6
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,14 @@ use self::libc::{c_int, c_uint};
88

99
#[link(name = "test")]
1010
extern "C" {
11-
#[no_mangle]
1211
fn entry(_: c_uint, _: *mut c_int);
1312

14-
#[no_mangle]
1513
fn entry2(_: c_uint, _: *mut c_int);
1614

17-
#[no_mangle]
1815
fn entry3(_: c_uint, _: *mut c_int);
1916

20-
#[no_mangle]
2117
fn unused_conditional1() -> c_int;
22-
#[no_mangle]
2318
fn unused_conditional2() -> c_int;
24-
#[no_mangle]
2519
fn unused_conditional3() -> c_int;
2620
}
2721

tests/enums/src/test_enums.rs

-5
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,14 @@ use self::libc::{c_int, c_uint};
1212

1313
#[link(name = "test")]
1414
extern "C" {
15-
#[no_mangle]
1615
fn entry(_: c_uint, _: *mut c_int);
1716

18-
#[no_mangle]
1917
fn entry2(_: c_uint, _: *mut c_int);
2018

21-
#[no_mangle]
2219
fn entry3(_: c_uint, _: *mut c_int);
2320

24-
#[no_mangle]
2521
fn entry4(_: c_uint, _: *mut c_int);
2622

27-
#[no_mangle]
2823
fn entry5(_: c_uint, _: *mut c_int);
2924
}
3025

tests/example/src/test_add.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use self::libc::c_uint;
55

66
#[link(name = "test")]
77
extern "C" {
8-
#[no_mangle]
98
fn add(left: c_uint, right: c_uint) -> c_uint;
109
}
1110

tests/example/src/test_sub.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use self::libc::c_uint;
55

66
#[link(name = "test")]
77
extern "C" {
8-
#[no_mangle]
98
fn sub(left: c_uint, right: c_uint) -> c_uint;
109
}
1110

tests/floats/src/test_no_wrapping_neg.rs

-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ use self::libc::{c_double, c_float};
55

66
#[link(name = "test")]
77
extern "C" {
8-
#[no_mangle]
98
fn no_wrapping_neg() -> c_double;
10-
#[no_mangle]
119
fn float_inc_dec() -> c_float;
12-
#[no_mangle]
1310
fn double_inc_dec() -> c_double;
1411
}
1512

tests/gotos/src/test_irreducible.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use irreducible::rust_irreducible;
55

66
#[link(name = "test")]
77
extern "C" {
8-
#[no_mangle]
98
fn irreducible(_: c_int) -> c_int;
109
}
1110

tests/ints/src/test_arithmetic.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use self::libc::{c_uint, c_int};
55

66
#[link(name = "test")]
77
extern "C" {
8-
#[no_mangle]
98
fn entry2(_: c_uint, _: *mut c_int);
109
}
1110

tests/ints/src/test_compound_assigment.rs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use self::libc::{c_int, c_uint};
66

77
#[link(name = "test")]
88
extern "C" {
9-
#[no_mangle]
109
fn compound_assignment(_: c_uint, _: *mut c_int);
1110
}
1211

tests/ints/src/test_const.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use self::libc::{c_int, c_uint};
55

66
#[link(name = "test")]
77
extern "C" {
8-
#[no_mangle]
98
fn entry4(_: c_uint, _: *mut c_int);
109
}
1110

tests/ints/src/test_implicit_ints.rs

-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ use implicit_int::{identity as rust_identity, implicit_int as rust_implicit_int}
55
use self::libc::{c_int, c_uint};
66

77
extern "C" {
8-
#[no_mangle]
98
fn identity(_: c_int) -> c_int;
109

11-
#[no_mangle]
1210
fn implicit_int();
1311
}
1412

tests/ints/src/test_ints.rs

-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ use self::libc::{c_int, c_uint};
66

77
#[link(name = "test")]
88
extern "C" {
9-
#[no_mangle]
109
fn entry(_: c_uint, _: *mut c_int);
1110

12-
#[no_mangle]
1311
fn multibyte_chars(_: c_uint, _: *mut c_int) -> c_int;
1412
}
1513

tests/ints/src/test_sieve_of_eratosthenes.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use self::libc::c_int;
55

66
#[link(name = "test")]
77
extern "C" {
8-
#[no_mangle]
98
fn sieve_of_eratosthenes(_: *mut c_int);
109
}
1110

tests/ints/src/test_volatile.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use self::libc::{c_int, c_uint};
55

66
#[link(name = "test")]
77
extern "C" {
8-
#[no_mangle]
98
fn entry3(_: c_uint, _: *mut c_int);
109
}
1110

tests/items/src/test_functions.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use functions::rust_coreutils_static_assert;
22

33
#[link(name = "test")]
44
extern "C" {
5-
#[no_mangle]
65
fn coreutils_static_assert();
76
}
87

tests/items/src/test_linking.rs

-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ use self::libc::c_int;
55

66
#[link(name = "test")]
77
extern "C" {
8-
#[no_mangle]
98
fn l() -> c_int;
109

11-
#[no_mangle]
1210
fn w() -> c_int;
1311
}
1412

0 commit comments

Comments
 (0)