File tree Expand file tree Collapse file tree 6 files changed +24
-21
lines changed Expand file tree Collapse file tree 6 files changed +24
-21
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
2+ set -euo pipefail
3+ IFS=$' \n\t '
4+ cd " $( dirname " $0 " ) " /..
25
36# Update the list of targets that do not support atomic CAS operations.
47#
58# Usage:
69# ./ci/no_atomic_cas.sh
710
8- set -euo pipefail
9- IFS=$' \n\t '
10-
11- cd " $( cd " $( dirname " $0 " ) " && pwd) " /..
12-
1311file=" no_atomic_cas.rs"
1412
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=()
2214for 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} " )
2618done
2719
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() {
3434 // `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
3535 // run. This is needed for compatibility with non-cargo build systems that
3636 // don't run the build script.
37- if NO_ATOMIC_CAS_TARGETS . contains ( & & * target) {
37+ if NO_ATOMIC_CAS . contains ( & & * target) {
3838 println ! ( "cargo:rustc-cfg=futures_no_atomic_cas" ) ;
3939 }
4040
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ fn main() {
3434 // `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
3535 // run. This is needed for compatibility with non-cargo build systems that
3636 // don't run the build script.
37- if NO_ATOMIC_CAS_TARGETS . contains ( & & * target) {
37+ if NO_ATOMIC_CAS . contains ( & & * target) {
3838 println ! ( "cargo:rustc-cfg=futures_no_atomic_cas" ) ;
3939 }
4040
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ fn main() {
3434 // `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
3535 // run. This is needed for compatibility with non-cargo build systems that
3636 // don't run the build script.
37- if NO_ATOMIC_CAS_TARGETS . contains ( & & * target) {
37+ if NO_ATOMIC_CAS . contains ( & & * target) {
3838 println ! ( "cargo:rustc-cfg=futures_no_atomic_cas" ) ;
3939 }
4040
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ fn main() {
3434 // `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
3535 // run. This is needed for compatibility with non-cargo build systems that
3636 // don't run the build script.
37- if NO_ATOMIC_CAS_TARGETS . contains ( & & * target) {
37+ if NO_ATOMIC_CAS . contains ( & & * target) {
3838 println ! ( "cargo:rustc-cfg=futures_no_atomic_cas" ) ;
3939 }
4040
Original file line number Diff line number Diff line change 11// This file is @generated by no_atomic_cas.sh.
22// It is not intended for manual editing.
33
4- const NO_ATOMIC_CAS_TARGETS : & [ & str ] = & [
4+ const NO_ATOMIC_CAS : & [ & str ] = & [
55 "avr-unknown-gnu-atmega328" ,
66 "bpfeb-unknown-none" ,
77 "bpfel-unknown-none" ,
You can’t perform that action at this time.
0 commit comments