From 5092a9bb2539f00483fc1671300a16b755d386de Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sun, 8 Dec 2024 17:15:10 +0900 Subject: [PATCH] ci: Clean up no_atomic.sh --- ci/no_atomic.sh | 47 +++++++++++++---------------------------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/ci/no_atomic.sh b/ci/no_atomic.sh index 288150b3b..13ab417f3 100755 --- a/ci/no_atomic.sh +++ b/ci/no_atomic.sh @@ -8,45 +8,24 @@ cd "$(dirname "$0")"/.. # Usage: # ./ci/no_atomic.sh -file="no_atomic.rs" +file=no_atomic.rs -no_atomic=() -for target_spec in $(RUSTC_BOOTSTRAP=1 rustc +stable -Z unstable-options --print all-target-specs-json | jq -c '. | to_entries | .[]'); do - target=$(jq <<<"${target_spec}" -r '.key') - target_spec=$(jq <<<"${target_spec}" -c '.value') - res=$(jq <<<"${target_spec}" -r 'select(."atomic-cas" == false)') - [[ -z "${res}" ]] || no_atomic_cas+=("${target}") - max_atomic_width=$(jq <<<"${target_spec}" -r '."max-atomic-width"') - min_atomic_width=$(jq <<<"${target_spec}" -r '."min-atomic-width"') - case "${max_atomic_width}" in - # `"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. - 0) no_atomic+=("${target}") ;; - # 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. - null | 8 | 16 | 32 | 64 | 128) ;; - *) exit 1 ;; - esac - case "${min_atomic_width}" in - 8 | null) ;; - *) no_atomic+=("${target}") ;; - esac -done +# `"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}" <>"${file}" -done -cat >>"${file}" <