From ce342184e625493b826f6318cf104001c5c4d859 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 1 Oct 2018 18:00:10 +0000 Subject: Update some third_party/base headers. - Sync bits.h and compiler_specific.h. - Delete macros.h. Change-Id: Idf586cd2ea61bc87ed86829d94ae0d4c5a04eae4 Reviewed-on: https://pdfium-review.googlesource.com/43170 Commit-Queue: Lei Zhang Reviewed-by: Ryan Harrison --- third_party/BUILD.gn | 1 - third_party/base/bits.h | 2 ++ third_party/base/compiler_specific.h | 22 ++++++++------------- third_party/base/macros.h | 37 ------------------------------------ 4 files changed, 10 insertions(+), 52 deletions(-) delete mode 100644 third_party/base/macros.h diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn index 6cb82634ac..51eb5279b9 100644 --- a/third_party/BUILD.gn +++ b/third_party/BUILD.gn @@ -559,7 +559,6 @@ jumbo_source_set("pdfium_base") { "base/debug/alias.cc", "base/debug/alias.h", "base/logging.h", - "base/macros.h", "base/numerics/safe_conversions.h", "base/numerics/safe_conversions_impl.h", "base/numerics/safe_math.h", diff --git a/third_party/base/bits.h b/third_party/base/bits.h index cd250edbfe..3a92b4c8ed 100644 --- a/third_party/base/bits.h +++ b/third_party/base/bits.h @@ -10,6 +10,8 @@ #include #include +#include + #include "third_party/base/compiler_specific.h" #include "third_party/base/logging.h" diff --git a/third_party/base/compiler_specific.h b/third_party/base/compiler_specific.h index 41c475d090..59aa47970d 100644 --- a/third_party/base/compiler_specific.h +++ b/third_party/base/compiler_specific.h @@ -25,17 +25,12 @@ // MSVC_SUPPRESS_WARNING disables warning |n| for the remainder of the line and // for the next line of the source file. -#define MSVC_SUPPRESS_WARNING(n) __pragma(warning(suppress : n)) +#define MSVC_SUPPRESS_WARNING(n) __pragma(warning(suppress:n)) // MSVC_PUSH_DISABLE_WARNING pushes |n| onto a stack of warnings to be disabled. // The warning remains disabled until popped by MSVC_POP_WARNING. -#define MSVC_PUSH_DISABLE_WARNING(n) \ - __pragma(warning(push)) __pragma(warning(disable : n)) - -// MSVC_PUSH_WARNING_LEVEL pushes |n| as the global warning level. The level -// remains in effect until popped by MSVC_POP_WARNING(). Use 0 to disable all -// warnings. -#define MSVC_PUSH_WARNING_LEVEL(n) __pragma(warning(push, n)) +#define MSVC_PUSH_DISABLE_WARNING(n) __pragma(warning(push)) \ + __pragma(warning(disable:n)) // Pop effects of innermost MSVC_PUSH_* macro. #define MSVC_POP_WARNING() __pragma(warning(pop)) @@ -48,7 +43,6 @@ #define _Printf_format_string_ #define MSVC_SUPPRESS_WARNING(n) #define MSVC_PUSH_DISABLE_WARNING(n) -#define MSVC_PUSH_WARNING_LEVEL(n) #define MSVC_POP_WARNING() #define MSVC_DISABLE_OPTIMIZE() #define MSVC_ENABLE_OPTIMIZE() @@ -83,9 +77,9 @@ #define NOINLINE #endif -#if COMPILER_GCC && defined(NDEBUG) +#if defined(COMPILER_GCC) && defined(NDEBUG) #define ALWAYS_INLINE inline __attribute__((__always_inline__)) -#elif COMPILER_MSVC && defined(NDEBUG) +#elif defined(COMPILER_MSVC) && defined(NDEBUG) #define ALWAYS_INLINE __forceinline #else #define ALWAYS_INLINE inline @@ -136,7 +130,7 @@ // (This is undocumented but matches what the system C headers do.) #if defined(COMPILER_GCC) || defined(__clang__) #define PRINTF_FORMAT(format_param, dots_param) \ - __attribute__((format(printf, format_param, dots_param))) + __attribute__((format(printf, format_param, dots_param))) #else #define PRINTF_FORMAT(format_param, dots_param) #endif @@ -165,14 +159,14 @@ // Mark a memory region fully initialized. // Use this to annotate code that deliberately reads uninitialized data, for // example a GC scavenging root set pointers from the stack. -#define MSAN_UNPOISON(p, size) __msan_unpoison(p, size) +#define MSAN_UNPOISON(p, size) __msan_unpoison(p, size) // Check a memory region for initializedness, as if it was being used here. // If any bits are uninitialized, crash with an MSan report. // Use this to sanitize data which MSan won't be able to track, e.g. before // passing data to another process via shared memory. #define MSAN_CHECK_MEM_IS_INITIALIZED(p, size) \ - __msan_check_mem_is_initialized(p, size) + __msan_check_mem_is_initialized(p, size) #else // MEMORY_SANITIZER #define MSAN_UNPOISON(p, size) #define MSAN_CHECK_MEM_IS_INITIALIZED(p, size) diff --git a/third_party/base/macros.h b/third_party/base/macros.h deleted file mode 100644 index cd1655a496..0000000000 --- a/third_party/base/macros.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file contains macros and macro-like constructs (e.g., templates) that -// are commonly used throughout Chromium source. (It may also contain things -// that are closely related to things that are commonly used that belong in this -// file.) - -#ifndef THIRD_PARTY_BASE_MACROS_H_ -#define THIRD_PARTY_BASE_MACROS_H_ - -// The COMPILE_ASSERT macro can be used to verify that a compile time -// expression is true. For example, you could use it to verify the -// size of a static array: -// -// COMPILE_ASSERT(ARRAYSIZE_UNSAFE(content_type_names) == CONTENT_NUM_TYPES, -// content_type_names_incorrect_size); -// -// or to make sure a struct is smaller than a certain size: -// -// COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large); -// -// The second argument to the macro is the name of the variable. If -// the expression is false, most compilers will issue a warning/error -// containing the name of the variable. - -#undef COMPILE_ASSERT -#define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg) - -// A macro to disallow the copy constructor and operator= functions. -// This should be used in the private: declarations for a class. -#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&) = delete; \ - void operator=(const TypeName&) = delete - -#endif // THIRD_PARTY_BASE_MACROS_H_ -- cgit v1.2.3