Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: Source/wtf/Vector.h

Issue 802203004: replace COMPILE_ASSERT with static assert in wtf/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: final fixups Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/wtf/TypeTraits.cpp ('k') | Source/wtf/VectorTraits.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/Vector.h
diff --git a/Source/wtf/Vector.h b/Source/wtf/Vector.h
index 7a6421bd5bc1dab05e03044328f500687a4d5c77..50e924d617283b71049a3e538872d106314e1f79 100644
--- a/Source/wtf/Vector.h
+++ b/Source/wtf/Vector.h
@@ -208,7 +208,7 @@ static const size_t kInitialVectorSize = WTF_VECTOR_INITIAL_SIZE;
{
static void uninitializedFill(T* dst, T* dstEnd, const T& val)
{
- COMPILE_ASSERT(sizeof(T) == sizeof(char), Size_of_type_should_be_equal_to_one);
+ static_assert(sizeof(T) == sizeof(char), "size of type should be one");
#if COMPILER(GCC) && defined(_FORTIFY_SOURCE)
if (!__builtin_constant_p(dstEnd - dst) || (!(dstEnd - dst)))
#endif
@@ -598,8 +598,8 @@ static const size_t kInitialVectorSize = WTF_VECTOR_INITIAL_SIZE;
// finalizer can visit them safely. canInitializeWithMemset tells us
// that the class does not expect matching constructor and
// destructor calls as long as the memory is zeroed.
- COMPILE_ASSERT(!Allocator::isGarbageCollected || !VectorTraits<T>::needsDestruction || VectorTraits<T>::canInitializeWithMemset, ClassHasProblemsWithFinalizersCalledOnClearedMemory);
- COMPILE_ASSERT(!WTF::IsPolymorphic<T>::value || !VectorTraits<T>::canInitializeWithMemset, CantInitializeWithMemsetIfThereIsAVtable);
+ static_assert(!Allocator::isGarbageCollected || !VectorTraits<T>::needsDestruction || VectorTraits<T>::canInitializeWithMemset, "class has problems with finalizers called on cleared memory");
+ static_assert(!WTF::IsPolymorphic<T>::value || !VectorTraits<T>::canInitializeWithMemset, "cannot initialize with memset if there is a vtable");
m_size = 0;
}
@@ -610,7 +610,7 @@ static const size_t kInitialVectorSize = WTF_VECTOR_INITIAL_SIZE;
// finalizer can visit them safely. canInitializeWithMemset tells us
// that the class does not expect matching constructor and
// destructor calls as long as the memory is zeroed.
- COMPILE_ASSERT(!Allocator::isGarbageCollected || !VectorTraits<T>::needsDestruction || VectorTraits<T>::canInitializeWithMemset, ClassHasProblemsWithFinalizersCalledOnClearedMemory);
+ static_assert(!Allocator::isGarbageCollected || !VectorTraits<T>::needsDestruction || VectorTraits<T>::canInitializeWithMemset, "class has problems with finalizers called on cleared memory");
m_size = size;
TypeOperations::initialize(begin(), end());
}
« no previous file with comments | « Source/wtf/TypeTraits.cpp ('k') | Source/wtf/VectorTraits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698