Not generating "__attribute__((__unused__))" for padding fields if it is not CLANG
Summary: Adding "__attribute__((__unused__))" after padding fields will pass CLANG build but will fail gcc 4.8.1. Fix it by not generating it under GCC 4.8.1. Test Plan: Build under four combinations of USE_CLANG=0,1 and ROCKSDB_FBCODE_BUILD_WITH_481=0.1. Reviewers: yhchiang, rven, ngbronson, anthony, IslamAbdelRahman Reviewed By: anthony Subscribers: leveldb, dhruba Differential Revision: https://reviews.facebook.net/D52371
This commit is contained in:
parent
9eb4f95967
commit
edf1cd497f
@ -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<size_t> 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<size_t> memory_allocated_bytes_;
|
||||
std::atomic<size_t> irregular_block_num_;
|
||||
|
||||
char padding1[56] __attribute__((__unused__));
|
||||
char padding1[56] ROCKSDB_FIELD_UNUSED;
|
||||
|
||||
Shard* Repick();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user