diff options
author | Nobuyoshi Nakada <[email protected]> | 2020-04-20 21:13:08 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2020-04-20 21:14:04 +0900 |
commit | e571bb8436502b1bce54a1e41c40ef682e05c555 (patch) | |
tree | a670cd9710568fe25cc44e0770298e8b52bc1c0f | |
parent | b4c9b570f1a16ac33a67eabc1ca70db36d33178c (diff) |
Removed phony atomic operations for void* and VALUE
-rw-r--r-- | ruby_atomic.h | 36 | ||||
-rw-r--r-- | tool/sync_default_gems.rb | 10 |
2 files changed, 11 insertions, 35 deletions
diff --git a/ruby_atomic.h b/ruby_atomic.h index d2338677ea..0742791d64 100644 --- a/ruby_atomic.h +++ b/ruby_atomic.h @@ -162,14 +162,7 @@ typedef unsigned int rb_atomic_t; # if SIZEOF_VOIDP == SIZEOF_SIZE_T # define ATOMIC_PTR_EXCHANGE(var, val) (void *)ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val)) # else -# define ATOMIC_PTR_EXCHANGE(var, val) ruby_atomic_ptr_exchange((const void **)&(var), (val)) -static inline void * -ruby_atomic_ptr_exchange(const void **ptr, const void *val) -{ - const void *const old = *ptr; - *ptr = val; - return (void *)old; -} +# error No atomic exchange for void* # endif #endif @@ -177,14 +170,7 @@ ruby_atomic_ptr_exchange(const void **ptr, const void *val) # if SIZEOF_VOIDP == SIZEOF_SIZE_T # define ATOMIC_PTR_CAS(var, oldval, val) (void *)ATOMIC_SIZE_CAS(*(size_t *)&(var), (size_t)(oldval), (size_t)(val)) # else -# define ATOMIC_PTR_CAS(var, oldval, val) ruby_atomic_ptr_cas(&(var), (oldval), (val)) -static inline void * -ruby_atomic_ptr_cas(const void **ptr, const void *oldval, const void *val) -{ - const void *const old = *ptr; - if (old == oldval) *ptr = val; - return (void *)old; -} +# error No atomic compare-and-set for void* # endif #endif @@ -192,14 +178,7 @@ ruby_atomic_ptr_cas(const void **ptr, const void *oldval, const void *val) # if SIZEOF_VALUE == SIZEOF_SIZE_T # define ATOMIC_VALUE_EXCHANGE(var, val) ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val)) # else -# define ATOMIC_VALUE_EXCHANGE(var, val) ruby_atomic_value_exchange(&(var), (val)) -static inline VALUE -ruby_atomic_value_exchange(VALUE *ptr, VALUE val) -{ - const VALUE old = *ptr; - *ptr = val; - return old; -} +# error No atomic exchange for VALUE # endif #endif @@ -207,14 +186,7 @@ ruby_atomic_value_exchange(VALUE *ptr, VALUE val) # if SIZEOF_VALUE == SIZEOF_SIZE_T # define ATOMIC_VALUE_CAS(var, oldval, val) ATOMIC_SIZE_CAS(*(size_t *)&(var), (size_t)(oldval), (size_t)(val)) # else -# define ATOMIC_VALUE_CAS(var, oldval, val) ruby_atomic_value_cas(&(var), (oldval), (val)) -static inline VALUE -ruby_atomic_value_cas(VALUE *ptr, VALUE oldval, VALUE val) -{ - const VALUE old = *ptr; - if (old == oldval) *ptr = val; - return old; -} +# error No atomic compare-and-set for VALUE # endif #endif diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index d034e723a4..ddbce8da7b 100644 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -374,11 +374,15 @@ def sync_default_gems_with_commits(gem, range) if result.empty? skipped = true - elsif result.start_with?("CONFLICT") + elsif /^CONFLICT/ =~ result result = IO.popen(%W"git status --porcelain", &:readlines).each(&:chomp!) - ignore = result.map {|line| /^DU / =~ line and IGNORE_FILE_PATTERN =~ (name = $') and name} + ignore = result.map {|line| /^.U / =~ line and IGNORE_FILE_PATTERN =~ (name = $') and name} ignore.compact! - system(*%W"git reset", *ignore) unless ignore.empty? + warn "Resetting #{ignore}" + unless ignore.empty? + system(*%W"git reset HEAD --", *ignore) + system(*%W"git checkout HEAD --", *ignore) + end skipped = !system({"GIT_EDITOR"=>"true"}, *%W"git cherry-pick --no-edit --continue") end |