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

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: search/replace fixup 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
Index: Source/wtf/Vector.h
diff --git a/Source/wtf/Vector.h b/Source/wtf/Vector.h
index 7a6421bd5bc1dab05e03044328f500687a4d5c77..d98eb73c36c9e442ab39ce6bab1777c69ea995f4 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, "Cant initialize with memset if there is a vtable");
Nico 2014/12/16 17:56:28 "cannot" maybe
Mostyn Bramley-Moore 2014/12/16 19:00:37 Done.
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());
}

Powered by Google App Engine
This is Rietveld 408576698