diff --git a/util/concurrent_arena.h b/util/concurrent_arena.h index 912c67da3..fb29c87a1 100644 --- a/util/concurrent_arena.h +++ b/util/concurrent_arena.h @@ -17,6 +17,14 @@ #include "util/mutexlock.h" #include "util/thread_local.h" +// Only generate field unused warning for padding array, or build under +// GCC 4.8.1 will fail. +#ifdef __clang__ +#define ROCKSDB_FIELD_UNUSED __attribute__((__unused__)) +#else +#define ROCKSDB_FIELD_UNUSED +#endif // __clang__ + namespace rocksdb { class Logger; @@ -78,7 +86,7 @@ class ConcurrentArena : public Allocator { private: struct Shard { - char padding[40] __attribute__((__unused__)); + char padding[40] ROCKSDB_FIELD_UNUSED; mutable SpinMutex mutex; char* free_begin_; std::atomic allocated_and_unused_; @@ -92,7 +100,7 @@ class ConcurrentArena : public Allocator { enum ZeroFirstEnum : uint32_t { tls_cpuid = 0 }; #endif - char padding0[56] __attribute__((__unused__)); + char padding0[56] ROCKSDB_FIELD_UNUSED; size_t shard_block_size_; @@ -106,7 +114,7 @@ class ConcurrentArena : public Allocator { std::atomic memory_allocated_bytes_; std::atomic irregular_block_num_; - char padding1[56] __attribute__((__unused__)); + char padding1[56] ROCKSDB_FIELD_UNUSED; Shard* Repick();