-
Notifications
You must be signed in to change notification settings - Fork 480
/
Copy pathno_atomic.sh
executable file
·31 lines (26 loc) · 1.17 KB
/
no_atomic.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
cd "$(dirname "$0")"/..
# Update the list of targets that do not support atomic/CAS operations.
#
# Usage:
# ./ci/no_atomic.sh
file=no_atomic.rs
# `"max-atomic-width" == 0` means that atomic is not supported at all.
# We do not have a cfg for targets with {8,16}-bit atomic only, so
# for now we treat them the same as targets that do not support atomic.
# It is not clear exactly what `"max-atomic-width" == null` means, but they
# actually seem to have the same max-atomic-width as the target-pointer-width.
# The targets currently included in this group are "mipsel-sony-psp",
# "thumbv4t-none-eabi", "thumbv6m-none-eabi", all of which are
# `"target-pointer-width" == "32"`, so assuming them `"max-atomic-width" == 32`
# for now.
no_atomic=$(RUSTC_BOOTSTRAP=1 rustc +stable -Z unstable-options --print all-target-specs-json | jq -r '. | to_entries[] | select((.value."max-atomic-width" == 0) or (.value."min-atomic-width" and .value."min-atomic-width" != 8)) | " \"" + .key + "\","')
cat >"${file}" <<EOF
// This file is @generated by ${0##*/}.
// It is not intended for manual editing.
const NO_ATOMIC: &[&str] = &[
${no_atomic}
];
EOF