Commit 9ad67cdb authored by James Ge's avatar James Ge

Support clang 4.0 (except UT)

Change-Id: I603bdaca231398e1c45141f36538823354d490cf
parent 42c2712b
...@@ -171,17 +171,21 @@ Atomic64 Release_Load(volatile const Atomic64* ptr); ...@@ -171,17 +171,21 @@ Atomic64 Release_Load(volatile const Atomic64* ptr);
// gcc supports atomic thread fence since 4.8 checkout // gcc supports atomic thread fence since 4.8 checkout
// https://gcc.gnu.org/gcc-4.7/cxx0x_status.html and // https://gcc.gnu.org/gcc-4.7/cxx0x_status.html and
// https://gcc.gnu.org/gcc-4.8/cxx0x_status.html for more details // https://gcc.gnu.org/gcc-4.8/cxx0x_status.html for more details
#if !defined(__GNUC__) || (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 >= 40800) #if defined(__clang__) || \
#include <atomic> !defined(__GNUC__) || \
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 >= 40800)
# include <atomic>
#else #else
#if __GNUC__ * 10000 + __GNUC_MINOR__ * 100 >= 40500 # if __GNUC__ * 10000 + __GNUC_MINOR__ * 100 >= 40500
// gcc 4.5 renames cstdatomic to atomic // gcc 4.5 renames cstdatomic to atomic
// (https://gcc.gnu.org/gcc-4.5/changes.html) // (https://gcc.gnu.org/gcc-4.5/changes.html)
#include <atomic> # include <atomic>
#else # else
#include <cstdatomic> # include <cstdatomic>
#endif # endif
namespace std { namespace std {
......
...@@ -94,7 +94,7 @@ namespace base { ...@@ -94,7 +94,7 @@ namespace base {
template <typename _Map, typename _Element> class FlatMapIterator; template <typename _Map, typename _Element> class FlatMapIterator;
template <typename _Map, typename _Element> class SparseFlatMapIterator; template <typename _Map, typename _Element> class SparseFlatMapIterator;
template <typename K, typename T> struct FlatMapElement; template <typename K, typename T> class FlatMapElement;
struct FlatMapVoid {}; // Replace void which is not constructible. struct FlatMapVoid {}; // Replace void which is not constructible.
template <typename K> struct DefaultHasher; template <typename K> struct DefaultHasher;
template <typename K> struct DefaultEqualTo; template <typename K> struct DefaultEqualTo;
...@@ -246,6 +246,7 @@ public: ...@@ -246,6 +246,7 @@ public:
}; };
private: private:
friend class FlatMapTest;
template <typename _Map, typename _Element> friend class FlatMapIterator; template <typename _Map, typename _Element> friend class FlatMapIterator;
template <typename _Map, typename _Element> friend class FlatMapSparseIterator; template <typename _Map, typename _Element> friend class FlatMapSparseIterator;
// True if buckets need to be resized before holding `size' elements. // True if buckets need to be resized before holding `size' elements.
......
...@@ -38,7 +38,7 @@ struct StringMapThreadLocalTemp { ...@@ -38,7 +38,7 @@ struct StringMapThreadLocalTemp {
if (temp->initialized) { if (temp->initialized) {
temp->initialized = false; temp->initialized = false;
std::string* temp_string = (std::string*)temp->buf; std::string* temp_string = (std::string*)temp->buf;
temp_string->std::string::~string(); temp_string->~basic_string();
} }
} }
......
...@@ -64,7 +64,7 @@ void byteReverse(unsigned char *buf, unsigned longs) { ...@@ -64,7 +64,7 @@ void byteReverse(unsigned char *buf, unsigned longs) {
* the data and converts bytes into longwords for this routine. * the data and converts bytes into longwords for this routine.
*/ */
void MD5Transform(uint32_t buf[4], const uint32_t in[16]) { void MD5Transform(uint32_t buf[4], const uint32_t in[16]) {
register uint32_t a, b, c, d; uint32_t a, b, c, d;
a = buf[0]; a = buf[0];
b = buf[1]; b = buf[1];
......
...@@ -68,8 +68,11 @@ class BASE_EXPORT RefCountedBase { ...@@ -68,8 +68,11 @@ class BASE_EXPORT RefCountedBase {
private: private:
mutable int ref_count_; mutable int ref_count_;
#if defined(__clang__)
mutable bool ALLOW_UNUSED in_dtor_;
#else
mutable bool in_dtor_; mutable bool in_dtor_;
#endif
DFAKE_MUTEX(add_release_); DFAKE_MUTEX(add_release_);
DISALLOW_COPY_AND_ASSIGN(RefCountedBase); DISALLOW_COPY_AND_ASSIGN(RefCountedBase);
...@@ -90,7 +93,11 @@ class BASE_EXPORT RefCountedThreadSafeBase { ...@@ -90,7 +93,11 @@ class BASE_EXPORT RefCountedThreadSafeBase {
private: private:
mutable AtomicRefCount ref_count_; mutable AtomicRefCount ref_count_;
#if defined(__clang__)
mutable bool ALLOW_UNUSED in_dtor_;
#else
mutable bool in_dtor_; mutable bool in_dtor_;
#endif
DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafeBase); DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafeBase);
}; };
......
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
namespace base { namespace base {
template <typename T> struct GetLeakySingleton { template <typename T> class GetLeakySingleton {
public:
static base::subtle::AtomicWord g_leaky_singleton_untyped; static base::subtle::AtomicWord g_leaky_singleton_untyped;
static pthread_once_t g_create_leaky_singleton_once; static pthread_once_t g_create_leaky_singleton_once;
static void create_leaky_singleton(); static void create_leaky_singleton();
......
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
namespace dmg_fp { namespace dmg_fp {
char * char *
g_fmt(register char *b, double x) g_fmt(char *b, double x)
{ {
register int i, k; int i, k;
register char *s; char *s;
int decpt, j, sign; int decpt, j, sign;
char *b0, *s0, *se; char *b0, *s0, *se;
......
...@@ -438,8 +438,12 @@ RAPIDJSON_NAMESPACE_END ...@@ -438,8 +438,12 @@ RAPIDJSON_NAMESPACE_END
#ifndef RAPIDJSON_HAS_CXX11_RVALUE_REFS #ifndef RAPIDJSON_HAS_CXX11_RVALUE_REFS
#if defined(__clang__) #if defined(__clang__)
#define RAPIDJSON_HAS_CXX11_RVALUE_REFS __has_feature(cxx_rvalue_references) && \ # if __has_feature(cxx_rvalue_references) && \
(defined(_LIBCPP_VERSION) || defined(__GLIBCXX__) && __GLIBCXX__ >= 20080306) (defined(_LIBCPP_VERSION) || defined(__GLIBCXX__) && __GLIBCXX__ >= 20080306)
# define RAPIDJSON_HAS_CXX11_RVALUE_REFS 1
# else
# define RAPIDJSON_HAS_CXX11_RVALUE_REFS 0
# endif
#elif (defined(RAPIDJSON_GNUC) && (RAPIDJSON_GNUC >= RAPIDJSON_VERSION_CODE(4,3,0)) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || \ #elif (defined(RAPIDJSON_GNUC) && (RAPIDJSON_GNUC >= RAPIDJSON_VERSION_CODE(4,3,0)) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || \
(defined(_MSC_VER) && _MSC_VER >= 1600) (defined(_MSC_VER) && _MSC_VER >= 1600)
......
...@@ -12,18 +12,12 @@ ...@@ -12,18 +12,12 @@
namespace brpc { namespace brpc {
class Server;
class DirService : public dir { class DirService : public dir {
public: public:
explicit DirService(Server* server) : _server(server) {}
void default_method(::google::protobuf::RpcController* cntl_base, void default_method(::google::protobuf::RpcController* cntl_base,
const ::brpc::DirRequest* request, const ::brpc::DirRequest* request,
::brpc::DirResponse* response, ::brpc::DirResponse* response,
::google::protobuf::Closure* done); ::google::protobuf::Closure* done);
private:
Server* _server;
}; };
} // namespace brpc } // namespace brpc
......
...@@ -254,7 +254,7 @@ static int MakeProfName(ProfilingType type, char* buf, size_t buf_len) { ...@@ -254,7 +254,7 @@ static int MakeProfName(ProfilingType type, char* buf, size_t buf_len) {
static void ConsumeWaiters(ProfilingType type, const Controller* cur_cntl, static void ConsumeWaiters(ProfilingType type, const Controller* cur_cntl,
std::vector<ProfilingWaiter>* waiters) { std::vector<ProfilingWaiter>* waiters) {
waiters->clear(); waiters->clear();
if (type >= (int)arraysize(g_env)) { if ((int)type >= (int)arraysize(g_env)) {
LOG(ERROR) << "Invalid type=" << type; LOG(ERROR) << "Invalid type=" << type;
return; return;
} }
......
...@@ -191,7 +191,7 @@ const char* sorttable_js() { ...@@ -191,7 +191,7 @@ const char* sorttable_js() {
" for (var i=0; i<table.tBodies[0].rows.length; i++) {\n" " for (var i=0; i<table.tBodies[0].rows.length; i++) {\n"
" text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);\n" " text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);\n"
" if (text != '') {\n" " if (text != '') {\n"
" if (text.match(/^-?[$]?[\\d,.]+%?$/)) {\n" " if (text.match(/^-?[$]?[\\d,.]+%?$/)) {\n"
" return sorttable.sort_numeric;\n" " return sorttable.sort_numeric;\n"
" }\n" " }\n"
" // check for a date: dd/mm/yyyy or dd/mm/yy\n" " // check for a date: dd/mm/yyyy or dd/mm/yy\n"
......
...@@ -64,9 +64,7 @@ typedef unsigned __int64 uint64_t; ...@@ -64,9 +64,7 @@ typedef unsigned __int64 uint64_t;
namespace brpc { namespace brpc {
typedef struct http_parser http_parser; struct http_parser;
typedef struct http_parser_settings http_parser_settings;
/* Callbacks should return non-zero to indicate an error. The parser will /* Callbacks should return non-zero to indicate an error. The parser will
* then halt execution. * then halt execution.
...@@ -201,8 +199,7 @@ enum http_errno { ...@@ -201,8 +199,7 @@ enum http_errno {
#define HTTP_PARSER_ERRNO(p) ((enum http_errno) (p)->http_errno) #define HTTP_PARSER_ERRNO(p) ((enum http_errno) (p)->http_errno)
class http_parser { struct http_parser {
public:
/** PRIVATE **/ /** PRIVATE **/
unsigned int type : 2; /* enum http_parser_type */ unsigned int type : 2; /* enum http_parser_type */
unsigned int flags : 6; /* F_* values from 'flags' enum; semi-public */ unsigned int flags : 6; /* F_* values from 'flags' enum; semi-public */
......
...@@ -60,11 +60,11 @@ struct LessThanByName { ...@@ -60,11 +60,11 @@ struct LessThanByName {
static void BuildHttpMethodMaps() { static void BuildHttpMethodMaps() {
for (size_t i = 0; i < ARRAY_SIZE(g_method_pairs); ++i) { for (size_t i = 0; i < ARRAY_SIZE(g_method_pairs); ++i) {
if (g_method_pairs[i].method < 0 || int method = (int)g_method_pairs[i].method;
g_method_pairs[i].method > (int)ARRAY_SIZE(g_method2str_map)) { if (method < 0 || method > (int)ARRAY_SIZE(g_method2str_map)) {
abort(); abort();
} }
g_method2str_map[g_method_pairs[i].method] = g_method_pairs[i].str; g_method2str_map[method] = g_method_pairs[i].str;
} }
std::sort(g_method_pairs, g_method_pairs + ARRAY_SIZE(g_method_pairs), std::sort(g_method_pairs, g_method_pairs + ARRAY_SIZE(g_method_pairs),
LessThanByName()); LessThanByName());
...@@ -82,13 +82,13 @@ static void BuildHttpMethodMaps() { ...@@ -82,13 +82,13 @@ static void BuildHttpMethodMaps() {
} }
} }
const char *HttpMethod2Str(HttpMethod http_method) { const char *HttpMethod2Str(HttpMethod method) {
pthread_once(&g_init_maps_once, BuildHttpMethodMaps); pthread_once(&g_init_maps_once, BuildHttpMethodMaps);
if (http_method < 0 || if ((int)method < 0 ||
http_method >= (int)ARRAY_SIZE(g_method2str_map)) { (int)method >= (int)ARRAY_SIZE(g_method2str_map)) {
return "UNKNOWN"; return "UNKNOWN";
} }
const char* s = g_method2str_map[http_method]; const char* s = g_method2str_map[method];
return s ? s : "UNKNOWN"; return s ? s : "UNKNOWN";
} }
......
...@@ -395,7 +395,11 @@ private: ...@@ -395,7 +395,11 @@ private:
int _fail_limit; int _fail_limit;
int _ndone; int _ndone;
int _nchan; int _nchan;
#if defined(__clang__)
int ALLOW_UNUSED _memsize;
#else
int _memsize; int _memsize;
#endif
base::atomic<int> _current_fail; base::atomic<int> _current_fail;
base::atomic<uint32_t> _current_done; base::atomic<uint32_t> _current_done;
Controller* _cntl; Controller* _cntl;
......
...@@ -31,7 +31,7 @@ inline const char* ParseErrorToString(ParseError e) { ...@@ -31,7 +31,7 @@ inline const char* ParseErrorToString(ParseError e) {
return "unknown ParseError"; return "unknown ParseError";
} }
struct InputMessageBase; class InputMessageBase;
// A specialized Maybe<> type to represent a parsing result. // A specialized Maybe<> type to represent a parsing result.
class ParseResult { class ParseResult {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// Date: 2015/06/11 17:46:26 // Date: 2015/06/11 17:46:26
#ifndef BRPC_HASHER_H #ifndef BRPC_HASHER_H
#define BAIDU_PPC_HASHER_H #define BRPC_HASHER_H
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
......
...@@ -45,7 +45,8 @@ void NsheadClosure::DoNotRespond() { ...@@ -45,7 +45,8 @@ void NsheadClosure::DoNotRespond() {
_do_respond = false; _do_respond = false;
} }
struct DeleteNsheadClosure { class DeleteNsheadClosure {
public:
void operator()(NsheadClosure* done) const { void operator()(NsheadClosure* done) const {
done->~NsheadClosure(); done->~NsheadClosure();
free(done); free(done);
......
...@@ -85,7 +85,6 @@ const char* messagetype2str(uint8_t t) { ...@@ -85,7 +85,6 @@ const char* messagetype2str(uint8_t t) {
// Unchangable constants required by RTMP // Unchangable constants required by RTMP
static const uint32_t RTMP_INITIAL_CHUNK_SIZE = 128; static const uint32_t RTMP_INITIAL_CHUNK_SIZE = 128;
static const uint8_t RTMP_DEFAULT_VERSION = 3; static const uint8_t RTMP_DEFAULT_VERSION = 3;
static const uint8_t RTMP_MAX_VERSION = 31;
static const size_t RTMP_HANDSHAKE_SIZE0 = 1; static const size_t RTMP_HANDSHAKE_SIZE0 = 1;
static const size_t RTMP_HANDSHAKE_SIZE1 = 1536; static const size_t RTMP_HANDSHAKE_SIZE1 = 1536;
static const size_t RTMP_HANDSHAKE_SIZE2 = RTMP_HANDSHAKE_SIZE1; static const size_t RTMP_HANDSHAKE_SIZE2 = RTMP_HANDSHAKE_SIZE1;
......
...@@ -229,7 +229,7 @@ class RtmpChunkStream; ...@@ -229,7 +229,7 @@ class RtmpChunkStream;
// Associated with a RTMP connection. // Associated with a RTMP connection.
class RtmpContext : public Destroyable { class RtmpContext : public Destroyable {
friend class RtmpChunkStream; friend class RtmpChunkStream;
friend struct RtmpUnsentMessage; friend class RtmpUnsentMessage;
public: public:
// States during handshake. // States during handshake.
enum State { enum State {
......
...@@ -147,8 +147,6 @@ Server::MethodProperty::MethodProperty() ...@@ -147,8 +147,6 @@ Server::MethodProperty::MethodProperty()
, status(NULL) { , status(NULL) {
} }
static const char* const UNKNOWN_STR = "unknown";
static timeval GetUptime(void* arg/*start_time*/) { static timeval GetUptime(void* arg/*start_time*/) {
return base::microseconds_to_timeval(base::cpuwide_time_us() - (intptr_t)arg); return base::microseconds_to_timeval(base::cpuwide_time_us() - (intptr_t)arg);
} }
...@@ -494,7 +492,7 @@ int Server::AddBuiltinServices() { ...@@ -494,7 +492,7 @@ int Server::AddBuiltinServices() {
return -1; return -1;
} }
if (FLAGS_enable_dir_service && if (FLAGS_enable_dir_service &&
AddBuiltinService(new (std::nothrow) DirService(this))) { AddBuiltinService(new (std::nothrow) DirService)) {
LOG(ERROR) << "Fail to add DirService"; LOG(ERROR) << "Fail to add DirService";
return -1; return -1;
} }
......
...@@ -509,7 +509,7 @@ friend void DereferenceSocket(Socket*); ...@@ -509,7 +509,7 @@ friend void DereferenceSocket(Socket*);
// Generic callback for Socket to handle epollout event // Generic callback for Socket to handle epollout event
static int HandleEpollOut(SocketId socket_id); static int HandleEpollOut(SocketId socket_id);
struct EpollOutRequest; class EpollOutRequest;
// Callback to handle epollout event whose request data // Callback to handle epollout event whose request data
// is `EpollOutRequest' // is `EpollOutRequest'
int HandleEpollOutRequest(int error_code, EpollOutRequest* req); int HandleEpollOutRequest(int error_code, EpollOutRequest* req);
......
...@@ -90,19 +90,19 @@ static const int TS_PMT_NUMBER = 1; ...@@ -90,19 +90,19 @@ static const int TS_PMT_NUMBER = 1;
// Program Association Table(see Table 2-25) // Program Association Table(see Table 2-25)
static const TsPid TS_PID_PAT = (TsPid)0x00; static const TsPid TS_PID_PAT = (TsPid)0x00;
// Conditional Access Table (see Table 2-27) // Conditional Access Table (see Table 2-27)
static const TsPid TS_PID_CAT = (TsPid)0x01; //static const TsPid TS_PID_CAT = (TsPid)0x01;
// Transport Stream Description Table // Transport Stream Description Table
static const TsPid TS_PID_TSDT = (TsPid)0x02; //static const TsPid TS_PID_TSDT = (TsPid)0x02;
static const TsPid TS_PID_RESERVED_START = (TsPid)0x03; //static const TsPid TS_PID_RESERVED_START = (TsPid)0x03;
static const TsPid TS_PID_RESERVED_END = (TsPid)0x0f; // static const TsPid TS_PID_RESERVED_END = (TsPid)0x0f;
// May be assigned as network_PID; Program_map_PID; elementary_PID; or for // May be assigned as network_PID; Program_map_PID; elementary_PID; or for
// other purposes // other purposes
static const TsPid TS_PID_APP_START = (TsPid)0x10; //static const TsPid TS_PID_APP_START = (TsPid)0x10;
static const TsPid TS_PID_VIDEO_AVC = (TsPid)0x100; static const TsPid TS_PID_VIDEO_AVC = (TsPid)0x100;
static const TsPid TS_PID_AUDIO_AAC = (TsPid)0x101; static const TsPid TS_PID_AUDIO_AAC = (TsPid)0x101;
static const TsPid TS_PID_AUDIO_MP3 = (TsPid)0x102; static const TsPid TS_PID_AUDIO_MP3 = (TsPid)0x102;
static const TsPid TS_PID_PMT = (TsPid)0x1001; static const TsPid TS_PID_PMT = (TsPid)0x1001;
static const TsPid TS_PID_APP_END = (TsPid)0x1ffe; //static const TsPid TS_PID_APP_END = (TsPid)0x1ffe;
static const TsPid TS_PID_NULL = (TsPid)0x01FFF;// null packets (see Table 2-3) static const TsPid TS_PID_NULL = (TsPid)0x01FFF;// null packets (see Table 2-3)
// The sync_byte is a fixed 8-bit field whose value is '0100 0111' (0x47). // The sync_byte is a fixed 8-bit field whose value is '0100 0111' (0x47).
...@@ -1185,7 +1185,7 @@ static const uint8_t cont_nalu_header[] = { 0x00, 0x00, 0x01 }; ...@@ -1185,7 +1185,7 @@ static const uint8_t cont_nalu_header[] = { 0x00, 0x00, 0x01 };
// 8, SP (SP slice) // 8, SP (SP slice)
// 9, SI (SI slice) // 9, SI (SI slice)
// H.264-AVC-ISO_IEC_14496-10-2012.pdf, page 105. // H.264-AVC-ISO_IEC_14496-10-2012.pdf, page 105.
static const uint8_t aud_nalu_7[] = { 0x09, 0xf0}; //static const uint8_t aud_nalu_7[] = { 0x09, 0xf0};
static const uint8_t fresh_nalu_header_and_aud_nalu_7[] = static const uint8_t fresh_nalu_header_and_aud_nalu_7[] =
{ 0x00, 0x00, 0x00, 0x01, 0x09, 0xf0}; { 0x00, 0x00, 0x00, 0x01, 0x09, 0xf0};
......
...@@ -19,7 +19,7 @@ namespace bthread { ...@@ -19,7 +19,7 @@ namespace bthread {
template <typename T> struct ExecutionQueueId; template <typename T> struct ExecutionQueueId;
template <typename T> class ExecutionQueue; template <typename T> class ExecutionQueue;
struct TaskNode; struct TaskNode;
struct ExecutionQueueBase; class ExecutionQueueBase;
class TaskIteratorBase { class TaskIteratorBase {
DISALLOW_COPY_AND_ASSIGN(TaskIteratorBase); DISALLOW_COPY_AND_ASSIGN(TaskIteratorBase);
......
...@@ -20,7 +20,7 @@ struct TaskStatistics { ...@@ -20,7 +20,7 @@ struct TaskStatistics {
int64_t nswitch; int64_t nswitch;
}; };
struct KeyTable; class KeyTable;
struct ButexWaiter; struct ButexWaiter;
struct LocalStorage { struct LocalStorage {
......
...@@ -527,10 +527,6 @@ public: ...@@ -527,10 +527,6 @@ public:
RUsageReader::get_field<BVAR_MEMBER_TYPE(&rusage::field), \ RUsageReader::get_field<BVAR_MEMBER_TYPE(&rusage::field), \
offsetof(rusage, field)>, NULL); \ offsetof(rusage, field)>, NULL); \
inline std::ostream& operator<<(std::ostream& os, const timeval& tm) {
return os << tm.tv_sec << '.' << std::setw(6) << std::setfill('0') << tm.tv_usec;
}
// ====================================== // ======================================
BVAR_DEFINE_PROC_STAT_FIELD2(pid, "pid"); BVAR_DEFINE_PROC_STAT_FIELD2(pid, "pid");
...@@ -746,3 +742,9 @@ PassiveStatus<std::string> g_work_dir("process_work_dir", get_work_dir, NULL); ...@@ -746,3 +742,9 @@ PassiveStatus<std::string> g_work_dir("process_work_dir", get_work_dir, NULL);
#undef BVAR_DEFINE_RUSAGE_FIELD2 #undef BVAR_DEFINE_RUSAGE_FIELD2
} // namespace bvar } // namespace bvar
// In the same scope where timeval is defined. Required by clang.
inline std::ostream& operator<<(std::ostream& os, const timeval& tm) {
return os << tm.tv_sec << '.' << std::setw(6) << std::setfill('0') << tm.tv_usec;
}
...@@ -23,7 +23,7 @@ inline uint32_t ones32(uint32_t x) { ...@@ -23,7 +23,7 @@ inline uint32_t ones32(uint32_t x) {
} }
inline uint32_t log2(uint32_t x) { inline uint32_t log2(uint32_t x) {
register int y = (x & (x - 1)); int y = (x & (x - 1));
y |= -y; y |= -y;
y >>= 31; y >>= 31;
x |= (x >> 1); x |= (x >> 1);
......
...@@ -51,8 +51,6 @@ DEFINE_bool(bvar_log_dumpped, false, ...@@ -51,8 +51,6 @@ DEFINE_bool(bvar_log_dumpped, false,
const size_t SUB_MAP_COUNT = 32; // must be power of 2 const size_t SUB_MAP_COUNT = 32; // must be power of 2
BAIDU_CASSERT(!(SUB_MAP_COUNT & (SUB_MAP_COUNT - 1)), must_be_power_of_2); BAIDU_CASSERT(!(SUB_MAP_COUNT & (SUB_MAP_COUNT - 1)), must_be_power_of_2);
const size_t MAX_CONFLICT_NAME = 128;
class VarEntry { class VarEntry {
public: public:
VarEntry() : var(NULL), display_filter(DISPLAY_ON_ALL) {} VarEntry() : var(NULL), display_filter(DISPLAY_ON_ALL) {}
......
...@@ -674,7 +674,7 @@ TEST_F(BuiltinServiceTest, pprof) { ...@@ -674,7 +674,7 @@ TEST_F(BuiltinServiceTest, pprof) {
} }
TEST_F(BuiltinServiceTest, dir) { TEST_F(BuiltinServiceTest, dir) {
brpc::DirService service(&_server); brpc::DirService service;
brpc::DirRequest req; brpc::DirRequest req;
brpc::DirResponse res; brpc::DirResponse res;
{ {
......
...@@ -16,16 +16,6 @@ namespace base { ...@@ -16,16 +16,6 @@ namespace base {
namespace { namespace {
//------------------------------------------------------------------------------
// Define our test class.
//------------------------------------------------------------------------------
void CancelHelper(CancellationFlag* flag) {
#if GTEST_HAS_DEATH_TEST
ASSERT_DEBUG_DEATH(flag->Set(), "");
#endif
}
TEST(CancellationFlagTest, SimpleSingleThreadedTest) { TEST(CancellationFlagTest, SimpleSingleThreadedTest) {
CancellationFlag flag; CancellationFlag flag;
ASSERT_FALSE(flag.IsSet()); ASSERT_FALSE(flag.IsSet());
......
...@@ -191,7 +191,7 @@ TEST_F(ConditionVariableTest, TimeoutTest) { ...@@ -191,7 +191,7 @@ TEST_F(ConditionVariableTest, TimeoutTest) {
#if defined(OS_POSIX) #if defined(OS_POSIX)
const int kDiscontinuitySeconds = 2; const int kDiscontinuitySeconds = 2;
void BackInTime(Lock* lock) { void ALLOW_UNUSED BackInTime(Lock* lock) {
AutoLock auto_lock(*lock); AutoLock auto_lock(*lock);
timeval tv; timeval tv;
......
...@@ -25,7 +25,7 @@ namespace { ...@@ -25,7 +25,7 @@ namespace {
// Returns true if PathService::Get returns true and sets the path parameter // Returns true if PathService::Get returns true and sets the path parameter
// to non-empty for the given PathService::DirType enumeration value. // to non-empty for the given PathService::DirType enumeration value.
bool ReturnsValidPath(int dir_type) { bool ALLOW_UNUSED ReturnsValidPath(int dir_type) {
base::FilePath path; base::FilePath path;
bool result = PathService::Get(dir_type, &path); bool result = PathService::Get(dir_type, &path);
......
...@@ -119,7 +119,7 @@ struct test_t { ...@@ -119,7 +119,7 @@ struct test_t {
TEST_F(TempFileTest, save_binary_twice) TEST_F(TempFileTest, save_binary_twice)
{ {
test_t data = {12, -34, 'B', 'E', 'E', 'F'}; test_t data = {12, -34, {'B', 'E', 'E', 'F'}};
base::TempFile tmp; base::TempFile tmp;
ASSERT_EQ(0, tmp.save_bin(&data, sizeof(data))); ASSERT_EQ(0, tmp.save_bin(&data, sizeof(data)));
...@@ -133,7 +133,7 @@ TEST_F(TempFileTest, save_binary_twice) ...@@ -133,7 +133,7 @@ TEST_F(TempFileTest, save_binary_twice)
ASSERT_EQ(0, memcmp(&data, &act_data, sizeof(data))); ASSERT_EQ(0, memcmp(&data, &act_data, sizeof(data)));
// save twice // save twice
test_t data2 = { 89, 1000, 'E', 'C', 'A', 'Z'}; test_t data2 = { 89, 1000, {'E', 'C', 'A', 'Z'}};
ASSERT_EQ(0, tmp.save_bin(&data2, sizeof(data2))); ASSERT_EQ(0, tmp.save_bin(&data2, sizeof(data2)));
fp = fopen(tmp.fname(), "r"); fp = fopen(tmp.fname(), "r");
......
...@@ -18,7 +18,7 @@ struct BStruct { ...@@ -18,7 +18,7 @@ struct BStruct {
int x; int x;
}; };
class BClass { class BClass {
int _x; int ALLOW_UNUSED _x;
}; };
class Parent {}; class Parent {};
......
#include <stdio.h> #include <stdio.h>
int main() { int main() {
#if defined(__GNUC__) #if defined(__clang__)
const int major_v = __GNUC__;
int minor_v = __GNUC_MINOR__;
if (major_v == 4 && minor_v <= 8) {
// Make version of clang >= 4.8 so that it's not rejected by config_brpc.sh
minor_v = 8;
}
printf("%d\n", (major_v * 10000 + minor_v * 100));
#elif defined(__GNUC__)
printf("%d\n", (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)); printf("%d\n", (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__));
#else #else
printf("0\n"); printf("0\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment