From 31babce11bb4f466b4754956e05cf62f48060fa4 Mon Sep 17 00:00:00 2001 From: Hidehiko Abe Date: Thu, 22 Feb 2018 14:40:41 +0900 Subject: Remove misc unneeded modifications in libchrome. Bug: 73270448 Test: Built locally. Treehugger. Change-Id: I2c3f193e1677e4a673ab0b3b60c0c3b40a57987b --- base/macros.h | 7 ++++--- base/message_loop/message_loop.cc | 2 -- base/message_loop/message_loop.h | 3 ++- base/process/process_posix.cc | 5 ----- base/strings/string_util.h | 6 ------ base/synchronization/lock_impl_posix.cc | 2 +- base/sys_info_posix.cc | 5 ++++- base/threading/non_thread_safe_unittest.cc | 8 -------- base/trace_event/common/trace_event_common.h | 9 --------- 9 files changed, 11 insertions(+), 36 deletions(-) diff --git a/base/macros.h b/base/macros.h index 4c62300e32..b5b03bb226 100644 --- a/base/macros.h +++ b/base/macros.h @@ -17,6 +17,8 @@ #include #endif // defined(ANDROID) +// We define following macros conditionally as they may be defined by another libraries. + // Put this in the declarations for a class to be uncopyable. #if !defined(DISALLOW_COPY) #define DISALLOW_COPY(TypeName) \ @@ -29,9 +31,8 @@ void operator=(const TypeName&) = delete #endif -// A macro to disallow the copy constructor and operator= functions -// This should be used in the private: declarations for a class -// We define this macro conditionally as it may be defined by another libraries. +// A macro to disallow the copy constructor and operator= functions. +// This should be used in the private: declarations for a class. #if !defined(DISALLOW_COPY_AND_ASSIGN) #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&) = delete; \ diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc index eba68a72ba..3d55920afd 100644 --- a/base/message_loop/message_loop.cc +++ b/base/message_loop/message_loop.cc @@ -641,8 +641,6 @@ bool MessageLoopForUI::WatchFileDescriptor( //------------------------------------------------------------------------------ // MessageLoopForIO -MessageLoopForIO::MessageLoopForIO() : MessageLoop(TYPE_IO) {} - #if !defined(OS_NACL_SFI) #if defined(OS_WIN) diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h index 6b4765bd1b..fa054f421a 100644 --- a/base/message_loop/message_loop.h +++ b/base/message_loop/message_loop.h @@ -559,7 +559,8 @@ static_assert(sizeof(MessageLoop) == sizeof(MessageLoopForUI), // class BASE_EXPORT MessageLoopForIO : public MessageLoop { public: - MessageLoopForIO(); + MessageLoopForIO() : MessageLoop(TYPE_IO) { + } // Returns the MessageLoopForIO of the current thread. static MessageLoopForIO* current() { diff --git a/base/process/process_posix.cc b/base/process/process_posix.cc index 3da6793afb..9b94891dd9 100644 --- a/base/process/process_posix.cc +++ b/base/process/process_posix.cc @@ -126,12 +126,7 @@ static bool WaitForSingleNonChildProcess(base::ProcessHandle handle, } result = -1; -#if defined(ANDROID) - struct kevent event; - memset(&event, 0, sizeof(event)); -#else struct kevent event = {0}; -#endif while (wait_forever || remaining_delta > base::TimeDelta()) { struct timespec remaining_timespec; diff --git a/base/strings/string_util.h b/base/strings/string_util.h index 29076ed913..35b2603786 100644 --- a/base/strings/string_util.h +++ b/base/strings/string_util.h @@ -22,12 +22,6 @@ #include "base/strings/string_piece.h" // For implicit conversions. #include "build/build_config.h" -#if defined(ANDROID) -// On Android, bionic's stdio.h defines an snprintf macro when being built with -// clang. Undefine it here so it won't collide with base::snprintf(). -#undef snprintf -#endif // defined(ANDROID) - namespace base { // C standard-library functions that aren't cross-platform are provided as diff --git a/base/synchronization/lock_impl_posix.cc b/base/synchronization/lock_impl_posix.cc index ff997ea65f..e54595b87f 100644 --- a/base/synchronization/lock_impl_posix.cc +++ b/base/synchronization/lock_impl_posix.cc @@ -21,7 +21,7 @@ namespace internal { // Lock::PriorityInheritanceAvailable still must be checked as the code may // compile but the underlying platform still may not correctly support priority // inheritance locks. -#if defined(OS_NACL) || defined(OS_ANDROID) || defined(__ANDROID__) +#if defined(OS_NACL) || defined(OS_ANDROID) #define PRIORITY_INHERITANCE_LOCKS_POSSIBLE() 0 #else #define PRIORITY_INHERITANCE_LOCKS_POSSIBLE() 1 diff --git a/base/sys_info_posix.cc b/base/sys_info_posix.cc index 7d3714663b..36119abf00 100644 --- a/base/sys_info_posix.cc +++ b/base/sys_info_posix.cc @@ -85,7 +85,10 @@ bool IsStatsZeroIfUnlimited(const base::FilePath& path) { if (HANDLE_EINTR(statfs(path.value().c_str(), &stats)) != 0) return false; - switch (static_cast(stats.f_type)) { + // In some platforms, |statfs_buf.f_type| is declared as signed, but some of + // the values will overflow it, causing narrowing warnings. Cast to the + // largest possible unsigned integer type to avoid it. + switch (static_cast(stats.f_type)) { case TMPFS_MAGIC: case HUGETLBFS_MAGIC: case RAMFS_MAGIC: diff --git a/base/threading/non_thread_safe_unittest.cc b/base/threading/non_thread_safe_unittest.cc index 5752d5f2b3..7776228f2f 100644 --- a/base/threading/non_thread_safe_unittest.cc +++ b/base/threading/non_thread_safe_unittest.cc @@ -12,14 +12,6 @@ #include "base/threading/simple_thread.h" #include "testing/gtest/include/gtest/gtest.h" -// Duplicated from base/threading/non_thread_safe.h so that we can be -// good citizens there and undef the macro. -#if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) -#define ENABLE_NON_THREAD_SAFE 1 -#else -#define ENABLE_NON_THREAD_SAFE 0 -#endif - namespace base { namespace { diff --git a/base/trace_event/common/trace_event_common.h b/base/trace_event/common/trace_event_common.h index bb6fa1b82b..e87665b8cd 100644 --- a/base/trace_event/common/trace_event_common.h +++ b/base/trace_event/common/trace_event_common.h @@ -789,15 +789,6 @@ TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, category_group, name, id, \ TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, TRACE_EVENT_FLAG_COPY) -// Records a single NESTABLE_ASYNC_INSTANT event called "name" immediately, -// with 2 associated arguments. If the category is not enabled, then this -// does nothing. -#define TRACE_EVENT_NESTABLE_ASYNC_INSTANT2( \ - category_group, name, id, arg1_name, arg1_val, arg2_name, arg2_val) \ - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \ - TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT, category_group, name, id, \ - TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val) - // Records a single FLOW_BEGIN event called "name" immediately, with 0, 1 or 2 // associated arguments. If the category is not enabled, then this // does nothing. -- cgit v1.2.3