diff --git a/ci/no_atomic_cas.sh b/ci/no_atomic_cas.sh index 40b2f1b90b..ba0200d698 100755 --- a/ci/no_atomic_cas.sh +++ b/ci/no_atomic_cas.sh @@ -1,28 +1,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_cas.sh -set -euo pipefail -IFS=$'\n\t' - -cd "$(cd "$(dirname "$0")" && pwd)"/.. - file="no_atomic_cas.rs" -{ - echo "// This file is @generated by $(basename "$0")." - echo "// It is not intended for manual editing." - echo "" - echo "const NO_ATOMIC_CAS_TARGETS: &[&str] = &[" -} >"$file" - +no_atomic_cas=() for target in $(rustc --print target-list); do - res=$(rustc --print target-spec-json -Z unstable-options --target "$target" \ - | jq -r "select(.\"atomic-cas\" == false)") - [[ -z "$res" ]] || echo " \"$target\"," >>"$file" + target_spec=$(rustc --print target-spec-json -Z unstable-options --target "${target}") + res=$(jq <<<"${target_spec}" -r 'select(."atomic-cas" == false)') + [[ -z "${res}" ]] || no_atomic_cas+=("${target}") done -echo "];" >>"$file" +cat >"${file}" <>"${file}" +done +cat >>"${file}" <