Skip to content

Commit 8d5b06a

Browse files
committed
Merge remote-tracking branch 'upstream/master' into fix-454
2 parents b9e6fee + ac930a2 commit 8d5b06a

File tree

13 files changed

+1342
-1442
lines changed

13 files changed

+1342
-1442
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ task:
1515
task:
1616
name: stable x86_64-unknown-freebsd-11
1717
freebsd_instance:
18-
image: freebsd-11-3-stable-amd64-v20200213
18+
image: freebsd-11-4-release-amd64
1919
setup_script:
2020
- pkg install -y curl
2121
- curl https://sh.rustup.rs -sSf --output rustup.sh

ci/build.sh

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ RUST=${TOOLCHAIN}
1515
echo "Testing Rust ${RUST} on ${OS}"
1616

1717
if [ "${TOOLCHAIN}" = "nightly" ] ; then
18-
cargo +nightly install cargo-xbuild
1918
rustup component add rust-src
2019
fi
2120

@@ -41,29 +40,52 @@ test_target() {
4140
fi
4241

4342
# Test that libc builds without any default features (no libstd)
44-
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}"
45-
43+
if [ "${NO_STD}" != "1" ]; then
44+
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}"
45+
else
46+
# FIXME: With `build-std` feature, `compiler_builtins` emits a lof of lint warnings.
47+
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
48+
-Z build-std=core,alloc -vv --no-default-features --target "${TARGET}"
49+
fi
4650
# Test that libc builds with default features (e.g. libstd)
4751
# if the target supports libstd
4852
if [ "$NO_STD" != "1" ]; then
4953
cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}"
54+
else
55+
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
56+
-Z build-std=core,alloc -vv --target "${TARGET}"
5057
fi
5158

5259
# Test that libc builds with the `extra_traits` feature
53-
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \
60+
if [ "${NO_STD}" != "1" ]; then
61+
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \
5462
--features extra_traits
63+
else
64+
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
65+
-Z build-std=core,alloc -vv --no-default-features \
66+
--target "${TARGET}" --features extra_traits
67+
fi
5568

5669
# Test the 'const-extern-fn' feature on nightly
5770
if [ "${RUST}" = "nightly" ]; then
58-
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \
59-
--features const-extern-fn
71+
if [ "${NO_STD}" != "1" ]; then
72+
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \
73+
--features const-extern-fn
74+
else
75+
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
76+
-Z build-std=core,alloc -vv --no-default-features \
77+
--target "${TARGET}" --features const-extern-fn
78+
fi
6079
fi
6180

62-
6381
# Also test that it builds with `extra_traits` and default features:
6482
if [ "$NO_STD" != "1" ]; then
6583
cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}" \
6684
--features extra_traits
85+
else
86+
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
87+
-Z build-std=core,alloc -vv --target "${TARGET}" \
88+
--features extra_traits
6789
fi
6890
}
6991

@@ -166,7 +188,7 @@ case "${OS}" in
166188
esac
167189

168190
for TARGET in $TARGETS; do
169-
if echo "$TARGET"|grep -q "$FILTER";then
191+
if echo "$TARGET"|grep -q "$FILTER"; then
170192
test_target build "$TARGET"
171193
fi
172194
done
@@ -193,6 +215,7 @@ i686-unknown-haiku \
193215
i686-unknown-netbsd \
194216
i686-unknown-openbsd \
195217
mips-unknown-linux-uclibc \
218+
mipsel-sony-psp \
196219
mipsel-unknown-linux-uclibc \
197220
mips64-unknown-linux-muslabi64 \
198221
mips64el-unknown-linux-muslabi64 \
@@ -229,13 +252,10 @@ powerpc64-wrs-vxworks \
229252

230253
if [ "${RUST}" = "nightly" ] && [ "${OS}" = "linux" ]; then
231254
for TARGET in $RUST_LINUX_NO_CORE_TARGETS; do
232-
if echo "$TARGET"|grep -q "$FILTER";then
233-
test_target xbuild "$TARGET" 1
255+
if echo "$TARGET"|grep -q "$FILTER"; then
256+
test_target build "$TARGET" 1
234257
fi
235258
done
236-
237-
# Sony PSP
238-
cargo xbuild --target mipsel-sony-psp
239259
fi
240260

241261
RUST_OSX_NO_CORE_TARGETS="\
@@ -248,7 +268,7 @@ i686-apple-darwin \
248268
if [ "${RUST}" = "nightly" ] && [ "${OS}" = "osx" ]; then
249269
for TARGET in $RUST_OSX_NO_CORE_TARGETS; do
250270
if echo "$TARGET" | grep -q "$FILTER"; then
251-
test_target xbuild "$TARGET" 1
271+
test_target build "$TARGET" 1
252272
fi
253273
done
254274
fi

ci/dox.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ if ! rustc --version | grep -E "nightly" ; then
1919
fi
2020

2121
rustup component add rust-src
22-
cargo +nightly install cargo-xbuild
2322

2423
# List all targets that do currently build successfully:
2524
# shellcheck disable=SC1003
@@ -50,10 +49,11 @@ while read -r target; do
5049
# Enable extra configuration flags:
5150
export RUSTDOCFLAGS="--cfg freebsd11"
5251

53-
# If cargo doc fails, then try xargo:
52+
# If cargo doc fails, then try with unstable feature:
5453
if ! cargo doc --target "${target}" \
5554
--no-default-features --features extra_traits ; then
56-
cargo xdoc --target "${target}" \
55+
cargo doc --target "${target}" \
56+
-Z build-std=core,alloc \
5757
--no-default-features --features extra_traits
5858
fi
5959

ci/run-docker.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ build_switch() {
6262
kvm=""
6363
fi
6464

65-
cargo +nightly install cargo-xbuild
6665
cp "$(which rustup)" "$(rustc --print sysroot)/bin"
6766

6867
docker run \
@@ -82,7 +81,7 @@ build_switch() {
8281
libc \
8382
sh -c "HOME=/tmp RUSTUP_HOME=/tmp PATH=\$PATH:/rust/bin rustup default nightly \
8483
&& rustup component add rust-src --target ci/switch.json \
85-
&& cargo xbuild --target ci/switch.json"
84+
&& cargo build -Z build-std=core,alloc --target ci/switch.json"
8685
}
8786

8887
if [ -z "${1}" ]; then

libc-test/build.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,12 +1763,8 @@ fn test_freebsd(target: &str) {
17631763
cfg.skip_const(move |name| {
17641764
match name {
17651765
// These constants are to be introduced in yet-unreleased FreeBSD 12.2.
1766-
"F_ADD_SEALS"
1767-
| "F_GET_SEALS"
1768-
| "F_SEAL_SEAL"
1769-
| "F_SEAL_SHRINK"
1770-
| "F_SEAL_GROW"
1771-
| "F_SEAL_WRITE"
1766+
"F_ADD_SEALS" | "F_GET_SEALS" | "F_SEAL_SEAL"
1767+
| "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE"
17721768
if Some(12) <= freebsd_ver =>
17731769
{
17741770
true

src/fuchsia/mod.rs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3250,6 +3250,61 @@ f! {
32503250
dev |= (minor & 0xffffff00) << 12;
32513251
dev
32523252
}
3253+
3254+
pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar {
3255+
cmsg.offset(1) as *mut c_uchar
3256+
}
3257+
3258+
pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr)
3259+
-> *mut cmsghdr
3260+
{
3261+
if ((*cmsg).cmsg_len as ::size_t) < ::mem::size_of::<cmsghdr>() {
3262+
0 as *mut cmsghdr
3263+
} else if __CMSG_NEXT(cmsg).add(::mem::size_of::<cmsghdr>())
3264+
>= __MHDR_END(mhdr) {
3265+
0 as *mut cmsghdr
3266+
} else {
3267+
__CMSG_NEXT(cmsg).cast()
3268+
}
3269+
}
3270+
3271+
pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
3272+
if (*mhdr).msg_controllen as ::size_t >= ::mem::size_of::<cmsghdr>() {
3273+
(*mhdr).msg_control.cast()
3274+
} else {
3275+
0 as *mut cmsghdr
3276+
}
3277+
}
3278+
3279+
pub fn CMSG_ALIGN(len: ::size_t) -> ::size_t {
3280+
(len + ::mem::size_of::<::size_t>() - 1)
3281+
& !(::mem::size_of::<::size_t>() - 1)
3282+
}
3283+
3284+
pub fn CMSG_SPACE(len: ::c_uint) -> ::c_uint {
3285+
(CMSG_ALIGN(len as ::size_t) + CMSG_ALIGN(::mem::size_of::<cmsghdr>()))
3286+
as ::c_uint
3287+
}
3288+
3289+
pub fn CMSG_LEN(len: ::c_uint) -> ::c_uint {
3290+
(CMSG_ALIGN(::mem::size_of::<cmsghdr>()) + len as ::size_t) as ::c_uint
3291+
}
3292+
}
3293+
3294+
fn __CMSG_LEN(cmsg: *const cmsghdr) -> ::ssize_t {
3295+
((unsafe { (*cmsg).cmsg_len as ::size_t } + ::mem::size_of::<::c_long>()
3296+
- 1)
3297+
& !(::mem::size_of::<::c_long>() - 1)) as ::ssize_t
3298+
}
3299+
3300+
fn __CMSG_NEXT(cmsg: *const cmsghdr) -> *mut c_uchar {
3301+
(unsafe { cmsg.offset(__CMSG_LEN(cmsg)) }) as *mut c_uchar
3302+
}
3303+
3304+
fn __MHDR_END(mhdr: *const msghdr) -> *mut c_uchar {
3305+
unsafe {
3306+
(*mhdr).msg_control.offset((*mhdr).msg_controllen as isize)
3307+
}.cast()
32533308
}
32543309

32553310
// EXTERN_FN

src/macros.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,36 @@ macro_rules! s_no_extra_traits {
121121
);
122122
}
123123

124+
#[allow(unused_macros)]
125+
macro_rules! e {
126+
($($(#[$attr:meta])* pub enum $i:ident { $($field:tt)* })*) => ($(
127+
__item! {
128+
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
129+
$(#[$attr])*
130+
pub enum $i { $($field)* }
131+
}
132+
impl ::Copy for $i {}
133+
impl ::Clone for $i {
134+
fn clone(&self) -> $i { *self }
135+
}
136+
)*);
137+
}
138+
139+
#[allow(unused_macros)]
140+
macro_rules! s_paren {
141+
($($(#[$attr:meta])* pub struct $i:ident ( $($field:tt)* ); )* ) => ($(
142+
__item! {
143+
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
144+
$(#[$attr])*
145+
pub struct $i ( $($field)* );
146+
}
147+
impl ::Copy for $i {}
148+
impl ::Clone for $i {
149+
fn clone(&self) -> $i { *self }
150+
}
151+
)*);
152+
}
153+
124154
// This is a pretty horrible hack to allow us to conditionally mark
125155
// some functions as 'const', without requiring users of this macro
126156
// to care about the "const-extern-fn" feature.

0 commit comments

Comments
 (0)