Skip to content

Commit

Permalink
Reorder defines so xlC16 finds the xlc before gnu
Browse files Browse the repository at this point in the history
xlC16 appears to be based on clang and now recognizes the
__GNUC__ defines.  Reorder this code so that the compiler
sees the __xlC__-specific case first.

issue: eclipse-omr#3775

Signed-off-by: Dan Heidinga <daniel_heidinga@ca.ibm.com>
  • Loading branch information
DanHeidinga authored and vsebe committed May 24, 2019
1 parent 051896b commit b9f1ac6
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions include_core/AtomicSupport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,10 @@ class VM_AtomicSupport
#if defined(OMRZTPF)
cs((cs_t *)&oldValue, (cs_t *)address, (cs_t)newValue);
return oldValue;
#elif defined(__GNUC__) /* defined(OMRZTPF) */
#elif defined(__xlC__) /* defined(OMRZTPF) */
__compare_and_swap((volatile int*)address, (int*)&oldValue, (int)newValue);
return oldValue;
#elif defined(__GNUC__) /* defined(__xlC__) */
/* Assume GCC >= 4.2 */
return __sync_val_compare_and_swap(address, oldValue, newValue);
#elif defined(_MSC_VER) /* defined(__GNUC__) */
Expand All @@ -410,7 +413,7 @@ class VM_AtomicSupport
#elif defined(__xlC__) /* defined(J9ZOS390) */
__compare_and_swap((volatile int*)address, (int*)&oldValue, (int)newValue);
return oldValue;
#else /* defined(__xlC__) */
#else /* defined(J9ZOS390) */
#error "lockCompareExchangeU32(): unsupported platform!"
#endif /* defined(__xlC__) */
#endif /* defined(ATOMIC_SUPPORT_STUB) */
Expand Down Expand Up @@ -453,7 +456,10 @@ class VM_AtomicSupport
#elif defined(OMRZTPF) /* defined(OMR_ARCH_POWER) && !defined(OMR_ENV_DATA64) */
csg((csg_t *)&oldValue, (csg_t *)address, (csg_t)newValue);
return oldValue;
#elif defined(__GNUC__) /* defined(OMRZTPF) */
#elif defined(__xlC__) /* defined(OMRZTPF) */
__compare_and_swaplp((volatile long*)address, (long*)&oldValue, (long)newValue);
return oldValue;
#elif defined(__GNUC__) /* defined(__xlC__) */
/* Assume GCC >= 4.2 */
return __sync_val_compare_and_swap(address, oldValue, newValue);
#elif defined(_MSC_VER) /* defined(__GNUC__) */
Expand All @@ -470,10 +476,7 @@ class VM_AtomicSupport
cds((cds_t*)&old, (cds_t*)address, *(cds_t*)&newValue);
return old;
#endif /* defined(OMR_ENV_DATA64) */
#elif defined(__xlC__) /* defined(J9ZOS390) */
__compare_and_swaplp((volatile long*)address, (long*)&oldValue, (long)newValue);
return oldValue;
#else /* defined(__xlC__) */
#else /* defined(J9ZOS390) */
#error "lockCompareExchangeU64(): unsupported platform!"
#endif /* defined(__xlC__) */
#endif /* defined(ATOMIC_SUPPORT_STUB) */
Expand Down

0 comments on commit b9f1ac6

Please sign in to comment.