diff options
author | Abseil Team <absl-team@google.com> | 2018-01-25T18·52-0800 |
---|---|---|
committer | John Olson <jolson@google.com> | 2018-01-25T21·48-0500 |
commit | f6eea9486ae1935017f42d1f89005ddafb0bd53a (patch) | |
tree | 5e326da9fc58dcbed3b2073a5db5991956674ea3 | |
parent | cf1db73d2ad969f0ebbe6f5ed42678517e493da2 (diff) |
Changes imported from Abseil "staging" branch:
- a74a7e9027e3f90835ae0f553f98be294781da18 Internal change by Abseil Team <absl-team@google.com> - 2d32db6ed063f93b67886b9c27602d5aea3c21f7 Add /D_SCL_SECURE_NO_WARNINGS to MSVC builds to disable c... by Jon Cohen <cohenjon@google.com> - 54f40318d1de67b6b25f8aa68343f8bbcde8c304 Use sized delete in FixedArray. by Chris Kennelly <ckennelly@google.com> - 193f50b3500ab1a102a00df4e05ad7b969e9337b Fixes some warnings that show up during builds with msvc. by Greg Miller <jgm@google.com> GitOrigin-RevId: a74a7e9027e3f90835ae0f553f98be294781da18 Change-Id: I6d2b1f496974a1399ca5db6b71274368c2699a59
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | absl/base/internal/spinlock.h | 2 | ||||
-rw-r--r-- | absl/container/fixed_array.h | 8 | ||||
-rw-r--r-- | absl/container/fixed_array_test.cc | 1 | ||||
-rw-r--r-- | absl/types/any.h | 1 |
5 files changed, 6 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c65805ebdfbd..9d3262393317 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ if (MSVC) # /wd4267 conversion from 'size_t' to 'type2' # /wd4800 force value to bool 'true' or 'false' (performance warning) add_compile_options(/W3 /WX /wd4005 /wd4068 /wd4244 /wd4267 /wd4800) - add_definitions(/DNOMINMAX /DWIN32_LEAN_AND_MEAN=1 /D_CRT_SECURE_NO_WARNINGS) + add_definitions(/DNOMINMAX /DWIN32_LEAN_AND_MEAN=1 /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS) else() set(ABSL_STD_CXX_FLAG "-std=c++11" CACHE STRING "c++ std flag (default: c++11)") endif() diff --git a/absl/base/internal/spinlock.h b/absl/base/internal/spinlock.h index a9037e3ed05c..212abc669e62 100644 --- a/absl/base/internal/spinlock.h +++ b/absl/base/internal/spinlock.h @@ -227,7 +227,7 @@ inline uint32_t SpinLock::TryLockInternal(uint32_t lock_value, kSpinLockHeld | lock_value | wait_cycles | sched_disabled_bit, std::memory_order_acquire, std::memory_order_relaxed)) { } else { - base_internal::SchedulingGuard::EnableRescheduling(sched_disabled_bit); + base_internal::SchedulingGuard::EnableRescheduling(sched_disabled_bit != 0); } return lock_value; diff --git a/absl/container/fixed_array.h b/absl/container/fixed_array.h index 1fec9d2b3784..b92d90564d21 100644 --- a/absl/container/fixed_array.h +++ b/absl/container/fixed_array.h @@ -458,7 +458,7 @@ class FixedArray { // Loop optimizes to nothing for trivially destructible T. for (Holder* p = end(); p != begin();) (--p)->~Holder(); if (IsAllocated(size())) { - ::operator delete[](begin()); + std::allocator<Holder>().deallocate(p_, n_); } else { this->AnnotateDestruct(size()); } @@ -470,17 +470,13 @@ class FixedArray { private: Holder* MakeHolder(size_type n) { if (IsAllocated(n)) { - return Allocate(n); + return std::allocator<Holder>().allocate(n); } else { this->AnnotateConstruct(n); return this->data(); } } - Holder* Allocate(size_type n) { - return static_cast<Holder*>(::operator new[](n * sizeof(Holder))); - } - bool IsAllocated(size_type n) const { return n > inline_elements; } const size_type n_; diff --git a/absl/container/fixed_array_test.cc b/absl/container/fixed_array_test.cc index b6782f517a6c..2142132d1352 100644 --- a/absl/container/fixed_array_test.cc +++ b/absl/container/fixed_array_test.cc @@ -504,6 +504,7 @@ struct PickyDelete { TEST(FixedArrayTest, UsesGlobalAlloc) { absl::FixedArray<PickyDelete, 0> a(5); } + TEST(FixedArrayTest, Data) { static const int kInput[] = { 2, 3, 5, 7, 11, 13, 17 }; absl::FixedArray<int> fa(std::begin(kInput), std::end(kInput)); diff --git a/absl/types/any.h b/absl/types/any.h index 2e7bf21f55f6..cee9cd324fc9 100644 --- a/absl/types/any.h +++ b/absl/types/any.h @@ -373,6 +373,7 @@ class any { return typeid(void); } #endif // ABSL_ANY_DETAIL_HAS_RTTI + private: // Tagged type-erased abstraction for holding a cloneable object. class ObjInterface { |