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

Unified Diff: Source/wtf/HashTable.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/BloomFilter.h ('k') | Source/wtf/ListHashSet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/HashTable.h
diff --git a/Source/wtf/HashTable.h b/Source/wtf/HashTable.h
index 3f907bf4685973ab2c8b2d997c8b745419fac129..72099fdee50b4164cd409399a79f3e98a18a4ff9 100644
--- a/Source/wtf/HashTable.h
+++ b/Source/wtf/HashTable.h
@@ -600,9 +600,9 @@ namespace WTF {
template<unsigned size>
struct HashTableCapacityForSize {
static const unsigned value = HashTableCapacityForSizeSplitter<size, !(size & (size - 1))>::value;
- COMPILE_ASSERT(size > 0, HashTableNonZeroMinimumCapacity);
- COMPILE_ASSERT(!static_cast<int>(value >> 31), HashTableNoCapacityOverflow);
- COMPILE_ASSERT(value > (2 * size), HashTableCapacityHoldsContentSize);
+ static_assert(size > 0, "HashTable minimum capacity should be > 0");
+ static_assert(!static_cast<int>(value >> 31), "HashTable capacity should not overflow 32bit int");
+ static_assert(value > (2 * size), "HashTable capacity should be able to hold content size");
};
template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits, typename Allocator>
@@ -993,7 +993,7 @@ namespace WTF {
// like to check this on the whole value (key-value pair), but
// IsPolymorphic will return false for a pair of two types, even if
// one of the components is polymorphic.
- COMPILE_ASSERT(!Traits::emptyValueIsZero || !IsPolymorphic<KeyType>::value, EmptyValueCannotBeZeroForThingsWithAVtable);
+ static_assert(!Traits::emptyValueIsZero || !IsPolymorphic<KeyType>::value, "empty value cannot be zero for things with a vtable");
if (Traits::emptyValueIsZero) {
result = Allocator::template allocateZeroedHashTableBacking<ValueType, HashTable>(allocSize);
} else {
« no previous file with comments | « Source/wtf/BloomFilter.h ('k') | Source/wtf/ListHashSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698