diff options
author | 2016-08-23 17:35:19 -0700 | |
---|---|---|
committer | 2016-08-23 18:20:12 -0700 | |
commit | 9231f4e55d6e79e37880071e222c28141bf65f49 (patch) | |
tree | 929c75752d7dd5d667b5f2cdaa044ad83d0522eb | |
parent | e99331f7a430b0b72142dd0b8b0689421489dcf6 (diff) |
ART: Remove vestiges of GCC
We no longer support GCC.
Change-Id: I869ac6e5dcb166747e45236a0d313c7672bbf2de
Test: m test-art-host
-rw-r--r-- | runtime/base/histogram-inl.h | 4 | ||||
-rw-r--r-- | runtime/base/macros.h | 100 | ||||
-rw-r--r-- | runtime/base/mutex.cc | 5 | ||||
-rw-r--r-- | runtime/entrypoints/quick/quick_math_entrypoints.cc | 4 | ||||
-rw-r--r-- | runtime/interpreter/interpreter_switch_impl.cc | 4 | ||||
-rw-r--r-- | runtime/stack.h | 4 | ||||
-rw-r--r-- | runtime/utils.h | 14 |
7 files changed, 30 insertions, 105 deletions
diff --git a/runtime/base/histogram-inl.h b/runtime/base/histogram-inl.h index 4af47d170a..ca9a694144 100644 --- a/runtime/base/histogram-inl.h +++ b/runtime/base/histogram-inl.h @@ -228,10 +228,8 @@ inline void Histogram<Value>::CreateHistogram(CumulativeData* out_data) const { DCHECK_LE(std::abs(out_data->perc_.back() - 1.0), 0.001); } -#if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wfloat-equal" -#endif template <class Value> inline double Histogram<Value>::Percentile(double per, const CumulativeData& data) const { @@ -273,9 +271,7 @@ inline double Histogram<Value>::Percentile(double per, const CumulativeData& dat return value; } -#if defined(__clang__) #pragma clang diagnostic pop -#endif } // namespace art #endif // ART_RUNTIME_BASE_HISTOGRAM_INL_H_ diff --git a/runtime/base/macros.h b/runtime/base/macros.h index 5a50247f5a..0ec6e6de97 100644 --- a/runtime/base/macros.h +++ b/runtime/base/macros.h @@ -30,16 +30,8 @@ _rc; }) #endif -#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) - -// C++11 final and override keywords that were introduced in GCC version 4.7. -#if defined(__clang__) || GCC_VERSION >= 40700 #define OVERRIDE override #define FINAL final -#else -#define OVERRIDE -#define FINAL -#endif // Declare a friend relationship in a class with a test. Used rather that FRIEND_TEST to avoid // globally importing gtest/gtest.h into the main ART header files. @@ -158,12 +150,9 @@ char (&ArraySizeHelper(T (&array)[N]))[N]; #define ALWAYS_INLINE __attribute__ ((always_inline)) #endif -#ifdef __clang__ -/* clang doesn't like attributes on lambda functions */ +// clang doesn't like attributes on lambda functions. It would be nice to say: +// #define ALWAYS_INLINE_LAMBDA ALWAYS_INLINE #define ALWAYS_INLINE_LAMBDA -#else -#define ALWAYS_INLINE_LAMBDA ALWAYS_INLINE -#endif #define NO_INLINE __attribute__ ((noinline)) @@ -228,75 +217,46 @@ template<typename... T> void UNUSED(const T&...) {} // // In either case this macro has no effect on runtime behavior and performance // of code. -#if defined(__clang__) && __cplusplus >= 201103L && defined(__has_warning) #if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough") #define FALLTHROUGH_INTENDED [[clang::fallthrough]] // NOLINT #endif -#endif #ifndef FALLTHROUGH_INTENDED #define FALLTHROUGH_INTENDED do { } while (0) #endif // Annotalysis thread-safety analysis support. -#if defined(__SUPPORT_TS_ANNOTATION__) || defined(__clang__) -#define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x)) -#else -#define THREAD_ANNOTATION_ATTRIBUTE__(x) // no-op -#endif -#define ACQUIRED_AFTER(...) THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(__VA_ARGS__)) -#define ACQUIRED_BEFORE(...) THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(__VA_ARGS__)) -#define GUARDED_BY(x) THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x)) -#define GUARDED_VAR THREAD_ANNOTATION_ATTRIBUTE__(guarded) -#define LOCK_RETURNED(x) THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x)) -#define NO_THREAD_SAFETY_ANALYSIS THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis) +#define ACQUIRED_AFTER(...) __attribute__((acquired_after(__VA_ARGS__))) +#define ACQUIRED_BEFORE(...) __attribute__((acquired_before(__VA_ARGS__))) +#define GUARDED_BY(x) __attribute__((guarded_by(x))) +#define GUARDED_VAR __attribute__((guarded)) +#define LOCK_RETURNED(x) __attribute__((lock_returned(x))) +#define NO_THREAD_SAFETY_ANALYSIS __attribute__((no_thread_safety_analysis)) #define PT_GUARDED_BY(x) // THREAD_ANNOTATION_ATTRIBUTE__(point_to_guarded_by(x)) -#define PT_GUARDED_VAR THREAD_ANNOTATION_ATTRIBUTE__(point_to_guarded) -#define SCOPED_LOCKABLE THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable) - -#if defined(__clang__) -#define EXCLUSIVE_LOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(exclusive_lock_function(__VA_ARGS__)) -#define EXCLUSIVE_TRYLOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(exclusive_trylock_function(__VA_ARGS__)) -#define SHARED_LOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(shared_lock_function(__VA_ARGS__)) -#define SHARED_TRYLOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(shared_trylock_function(__VA_ARGS__)) -#define UNLOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(unlock_function(__VA_ARGS__)) -#define REQUIRES(...) THREAD_ANNOTATION_ATTRIBUTE__(requires_capability(__VA_ARGS__)) -#define SHARED_REQUIRES(...) THREAD_ANNOTATION_ATTRIBUTE__(requires_shared_capability(__VA_ARGS__)) -#define CAPABILITY(...) THREAD_ANNOTATION_ATTRIBUTE__(capability(__VA_ARGS__)) -#define SHARED_CAPABILITY(...) THREAD_ANNOTATION_ATTRIBUTE__(shared_capability(__VA_ARGS__)) -#define ASSERT_CAPABILITY(...) THREAD_ANNOTATION_ATTRIBUTE__(assert_capability(__VA_ARGS__)) -#define ASSERT_SHARED_CAPABILITY(...) THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_capability(__VA_ARGS__)) -#define RETURN_CAPABILITY(...) THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(__VA_ARGS__)) -#define TRY_ACQUIRE(...) THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_capability(__VA_ARGS__)) -#define TRY_ACQUIRE_SHARED(...) THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_shared_capability(__VA_ARGS__)) -#define ACQUIRE(...) THREAD_ANNOTATION_ATTRIBUTE__(acquire_capability(__VA_ARGS__)) -#define ACQUIRE_SHARED(...) THREAD_ANNOTATION_ATTRIBUTE__(acquire_shared_capability(__VA_ARGS__)) -#define RELEASE(...) THREAD_ANNOTATION_ATTRIBUTE__(release_capability(__VA_ARGS__)) -#define RELEASE_SHARED(...) THREAD_ANNOTATION_ATTRIBUTE__(release_shared_capability(__VA_ARGS__)) -#define SCOPED_CAPABILITY THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable) -#else -#define EXCLUSIVE_LOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(exclusive_lock(__VA_ARGS__)) -#define EXCLUSIVE_TRYLOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(exclusive_trylock(__VA_ARGS__)) -#define SHARED_LOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(shared_lock(__VA_ARGS__)) -#define SHARED_TRYLOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(shared_trylock(__VA_ARGS__)) -#define UNLOCK_FUNCTION(...) THREAD_ANNOTATION_ATTRIBUTE__(unlock(__VA_ARGS__)) -#define REQUIRES(...) -#define SHARED_REQUIRES(...) -#define CAPABILITY(...) -#define SHARED_CAPABILITY(...) -#define ASSERT_CAPABILITY(...) -#define ASSERT_SHARED_CAPABILITY(...) -#define RETURN_CAPABILITY(...) -#define TRY_ACQUIRE(...) -#define TRY_ACQUIRE_SHARED(...) -#define ACQUIRE(...) -#define ACQUIRE_SHARED(...) -#define RELEASE(...) -#define RELEASE_SHARED(...) -#define SCOPED_CAPABILITY -#endif +#define PT_GUARDED_VAR __attribute__((point_to_guarded)) +#define SCOPED_LOCKABLE __attribute__((scoped_lockable)) + +#define EXCLUSIVE_LOCK_FUNCTION(...) __attribute__((exclusive_lock_function(__VA_ARGS__))) +#define EXCLUSIVE_TRYLOCK_FUNCTION(...) __attribute__((exclusive_trylock_function(__VA_ARGS__))) +#define SHARED_LOCK_FUNCTION(...) __attribute__((shared_lock_function(__VA_ARGS__))) +#define SHARED_TRYLOCK_FUNCTION(...) __attribute__((shared_trylock_function(__VA_ARGS__))) +#define UNLOCK_FUNCTION(...) __attribute__((unlock_function(__VA_ARGS__))) +#define REQUIRES(...) __attribute__((requires_capability(__VA_ARGS__))) +#define SHARED_REQUIRES(...) __attribute__((requires_shared_capability(__VA_ARGS__))) +#define CAPABILITY(...) __attribute__((capability(__VA_ARGS__))) +#define SHARED_CAPABILITY(...) __attribute__((shared_capability(__VA_ARGS__))) +#define ASSERT_CAPABILITY(...) __attribute__((assert_capability(__VA_ARGS__))) +#define ASSERT_SHARED_CAPABILITY(...) __attribute__((assert_shared_capability(__VA_ARGS__))) +#define RETURN_CAPABILITY(...) __attribute__((lock_returned(__VA_ARGS__))) +#define TRY_ACQUIRE(...) __attribute__((try_acquire_capability(__VA_ARGS__))) +#define TRY_ACQUIRE_SHARED(...) __attribute__((try_acquire_shared_capability(__VA_ARGS__))) +#define ACQUIRE(...) __attribute__((acquire_capability(__VA_ARGS__))) +#define ACQUIRE_SHARED(...) __attribute__((acquire_shared_capability(__VA_ARGS__))) +#define RELEASE(...) __attribute__((release_capability(__VA_ARGS__))) +#define RELEASE_SHARED(...) __attribute__((release_shared_capability(__VA_ARGS__))) +#define SCOPED_CAPABILITY __attribute__((scoped_lockable)) #define LOCKABLE CAPABILITY("mutex") #define SHARED_LOCKABLE SHARED_CAPABILITY("mutex") diff --git a/runtime/base/mutex.cc b/runtime/base/mutex.cc index 264a530a36..fec918b681 100644 --- a/runtime/base/mutex.cc +++ b/runtime/base/mutex.cc @@ -98,12 +98,7 @@ class ScopedAllMutexesLock FINAL { } ~ScopedAllMutexesLock() { -#if !defined(__clang__) - // TODO: remove this workaround target GCC/libc++/bionic bug "invalid failure memory model". - while (!gAllMutexData->all_mutexes_guard.CompareExchangeWeakSequentiallyConsistent(mutex_, 0)) { -#else while (!gAllMutexData->all_mutexes_guard.CompareExchangeWeakRelease(mutex_, 0)) { -#endif NanoSleep(100); } } diff --git a/runtime/entrypoints/quick/quick_math_entrypoints.cc b/runtime/entrypoints/quick/quick_math_entrypoints.cc index 1c658b7057..51d2784fd8 100644 --- a/runtime/entrypoints/quick/quick_math_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_math_entrypoints.cc @@ -18,10 +18,8 @@ namespace art { -#if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wfloat-equal" -#endif int CmplFloat(float a, float b) { if (a == b) { @@ -67,9 +65,7 @@ int CmplDouble(double a, double b) { return -1; } -#if defined(__clang__) #pragma clang diagnostic pop -#endif extern "C" int64_t artLmul(int64_t a, int64_t b) { return a * b; diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc index dd10052ebd..136814f69e 100644 --- a/runtime/interpreter/interpreter_switch_impl.cc +++ b/runtime/interpreter/interpreter_switch_impl.cc @@ -624,10 +624,8 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, break; } -#if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wfloat-equal" -#endif case Instruction::CMPL_FLOAT: { PREAMBLE(); @@ -695,9 +693,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, break; } -#if defined(__clang__) #pragma clang diagnostic pop -#endif case Instruction::CMP_LONG: { PREAMBLE(); diff --git a/runtime/stack.h b/runtime/stack.h index cf33ae1a6a..850d2a4fa8 100644 --- a/runtime/stack.h +++ b/runtime/stack.h @@ -224,7 +224,6 @@ class ShadowFrame { int64_t GetVRegLong(size_t i) const { DCHECK_LT(i, NumberOfVRegs()); const uint32_t* vreg = &vregs_[i]; - // Alignment attribute required for GCC 4.8 typedef const int64_t unaligned_int64 __attribute__ ((aligned (4))); return *reinterpret_cast<unaligned_int64*>(vreg); } @@ -232,7 +231,6 @@ class ShadowFrame { double GetVRegDouble(size_t i) const { DCHECK_LT(i, NumberOfVRegs()); const uint32_t* vreg = &vregs_[i]; - // Alignment attribute required for GCC 4.8 typedef const double unaligned_double __attribute__ ((aligned (4))); return *reinterpret_cast<unaligned_double*>(vreg); } @@ -289,7 +287,6 @@ class ShadowFrame { void SetVRegLong(size_t i, int64_t val) { DCHECK_LT(i, NumberOfVRegs()); uint32_t* vreg = &vregs_[i]; - // Alignment attribute required for GCC 4.8 typedef int64_t unaligned_int64 __attribute__ ((aligned (4))); *reinterpret_cast<unaligned_int64*>(vreg) = val; // This is needed for moving collectors since these can update the vreg references if they @@ -303,7 +300,6 @@ class ShadowFrame { void SetVRegDouble(size_t i, double val) { DCHECK_LT(i, NumberOfVRegs()); uint32_t* vreg = &vregs_[i]; - // Alignment attribute required for GCC 4.8 typedef double unaligned_double __attribute__ ((aligned (4))); *reinterpret_cast<unaligned_double*>(vreg) = val; // This is needed for moving collectors since these can update the vreg references if they diff --git a/runtime/utils.h b/runtime/utils.h index 84079e2fb2..693e0b87ee 100644 --- a/runtime/utils.h +++ b/runtime/utils.h @@ -380,21 +380,7 @@ int64_t GetFileSizeBytes(const std::string& filename); NO_RETURN void SleepForever(); inline void FlushInstructionCache(char* begin, char* end) { - // Only use __builtin___clear_cache with Clang or with GCC >= 4.3.0 - // (__builtin___clear_cache was introduced in GCC 4.3.0). -#if defined(__clang__) || GCC_VERSION >= 40300 __builtin___clear_cache(begin, end); -#else - // Only warn on non-Intel platforms, as x86 and x86-64 do not need - // cache flush instructions, as long as the "code uses the same - // linear address for modifying and fetching the instruction". See - // "Intel(R) 64 and IA-32 Architectures Software Developer's Manual - // Volume 3A: System Programming Guide, Part 1", section 11.6 - // "Self-Modifying Code". -#if !defined(__i386__) && !defined(__x86_64__) - UNIMPLEMENTED(WARNING) << "cache flush"; -#endif -#endif } } // namespace art |