File tree 6 files changed +24
-21
lines changed
6 files changed +24
-21
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
+ set -euo pipefail
3
+ IFS=$' \n\t '
4
+ cd " $( dirname " $0 " ) " /..
2
5
3
6
# Update the list of targets that do not support atomic CAS operations.
4
7
#
5
8
# Usage:
6
9
# ./ci/no_atomic_cas.sh
7
10
8
- set -euo pipefail
9
- IFS=$' \n\t '
10
-
11
- cd " $( cd " $( dirname " $0 " ) " && pwd) " /..
12
-
13
11
file=" no_atomic_cas.rs"
14
12
15
- {
16
- echo " // This file is @generated by $( basename " $0 " ) ."
17
- echo " // It is not intended for manual editing."
18
- echo " "
19
- echo " const NO_ATOMIC_CAS_TARGETS: &[&str] = &["
20
- } > " $file "
21
-
13
+ no_atomic_cas=()
22
14
for target in $( rustc --print target-list) ; do
23
- res =$( rustc --print target-spec-json -Z unstable-options --target " $target " \
24
- | jq -r " select(.\ " atomic-cas\ " == false)" )
25
- [[ -z " $res " ]] || echo " \" $ target\" , " >> " $file "
15
+ target_spec =$( rustc --print target-spec-json -Z unstable-options --target " ${ target} " )
16
+ res= $( jq <<< " ${target_spec} " -r ' select(."atomic-cas" == false)' )
17
+ [[ -z " ${ res} " ]] || no_atomic_cas+=( " ${ target} " )
26
18
done
27
19
28
- echo " ];" >> " $file "
20
+ cat > " ${file} " << EOF
21
+ // This file is @generated by $( basename " $0 " ) .
22
+ // It is not intended for manual editing.
23
+
24
+ const NO_ATOMIC_CAS: &[&str] = &[
25
+ EOF
26
+ for target in " ${no_atomic_cas[@]} " ; do
27
+ echo " \" ${target} \" ," >> " ${file} "
28
+ done
29
+ cat >> " ${file} " << EOF
30
+ ];
31
+ EOF
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ fn main() {
34
34
// `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
35
35
// run. This is needed for compatibility with non-cargo build systems that
36
36
// don't run the build script.
37
- if NO_ATOMIC_CAS_TARGETS . contains ( & & * target) {
37
+ if NO_ATOMIC_CAS . contains ( & & * target) {
38
38
println ! ( "cargo:rustc-cfg=futures_no_atomic_cas" ) ;
39
39
}
40
40
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ fn main() {
34
34
// `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
35
35
// run. This is needed for compatibility with non-cargo build systems that
36
36
// don't run the build script.
37
- if NO_ATOMIC_CAS_TARGETS . contains ( & & * target) {
37
+ if NO_ATOMIC_CAS . contains ( & & * target) {
38
38
println ! ( "cargo:rustc-cfg=futures_no_atomic_cas" ) ;
39
39
}
40
40
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ fn main() {
34
34
// `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
35
35
// run. This is needed for compatibility with non-cargo build systems that
36
36
// don't run the build script.
37
- if NO_ATOMIC_CAS_TARGETS . contains ( & & * target) {
37
+ if NO_ATOMIC_CAS . contains ( & & * target) {
38
38
println ! ( "cargo:rustc-cfg=futures_no_atomic_cas" ) ;
39
39
}
40
40
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ fn main() {
34
34
// `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
35
35
// run. This is needed for compatibility with non-cargo build systems that
36
36
// don't run the build script.
37
- if NO_ATOMIC_CAS_TARGETS . contains ( & & * target) {
37
+ if NO_ATOMIC_CAS . contains ( & & * target) {
38
38
println ! ( "cargo:rustc-cfg=futures_no_atomic_cas" ) ;
39
39
}
40
40
Original file line number Diff line number Diff line change 1
1
// This file is @generated by no_atomic_cas.sh.
2
2
// It is not intended for manual editing.
3
3
4
- const NO_ATOMIC_CAS_TARGETS : & [ & str ] = & [
4
+ const NO_ATOMIC_CAS : & [ & str ] = & [
5
5
"avr-unknown-gnu-atmega328" ,
6
6
"bpfeb-unknown-none" ,
7
7
"bpfel-unknown-none" ,
You can’t perform that action at this time.
0 commit comments