[NFC] More checks, comments on end of namespace braces.

This commit is contained in:
David Chisnall
2019-04-29 16:53:59 +01:00
parent 49ece8f4e1
commit 5c197e4ae4
33 changed files with 36 additions and 35 deletions

View File

@@ -1,8 +1,9 @@
Checks: '-clang-analyzer-security.insecureAPI.bzero,clang-diagnostic-*,google-readability-casting,readability-else-after-return,performance-unnecessary-copy-initialization,bugprone-use-after-move,modernize-use-nullptr,modernize-redundant-void-arg,modernize-return-braced-init-list,modernize-use-default-member-init,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-nodiscard,modernize-use-override,cppcoreguidelines-avoid-goto,misc-unconventional-assign-operator,cppcoreguidelines-narrowing-conversions,bugprone-assert-side-effect,bugprone-bool-pointer-implicit-conversion,bugprone-copy-constructor-init,bugprone-forward-declaration-namespace,bugprone-forwarding-reference-overload,bugprone-macro-parentheses,bugprone-macro-repeated-side-effects,bugprone-move-forwarding-reference,bugprone-misplaced-widening-cast,bugprone-swapped-arguments' Checks: '-clang-analyzer-security.insecureAPI.bzero,clang-diagnostic-*,google-readability-casting,readability-else-after-return,performance-unnecessary-copy-initialization,bugprone-use-after-move,modernize-use-nullptr,modernize-redundant-void-arg,modernize-return-braced-init-list,modernize-use-default-member-init,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-nodiscard,modernize-use-override,cppcoreguidelines-avoid-goto,misc-unconventional-assign-operator,cppcoreguidelines-narrowing-conversions,bugprone-assert-side-effect,bugprone-bool-pointer-implicit-conversion,bugprone-copy-constructor-init,bugprone-forward-declaration-namespace,bugprone-forwarding-reference-overload,bugprone-macro-parentheses,bugprone-macro-repeated-side-effects,bugprone-move-forwarding-reference,bugprone-misplaced-widening-cast,bugprone-swapped-arguments,bugprone-undelegated-constructor,bugprone-unused-raii,cert-dcl21-cpp,llvm-namespace-comment,misc-static-assert'
# It would be nice to enable: # It would be nice to enable:
# - readability-magic-numbers # - readability-magic-numbers
# - modernize-avoid-c-arrays # - modernize-avoid-c-arrays
# - cppcoreguidelines-pro-bounds-array-to-pointer-decay (assert breaks it). # - cppcoreguidelines-pro-bounds-array-to-pointer-decay (assert breaks it).
# - readability-braces-around-statements (mostly works, but is very confused by constexpr if).
CheckOptions: CheckOptions:
- key: modernize-use-default-member-init.UseAssignment - key: modernize-use-default-member-init.UseAssignment
value: '1' value: '1'

View File

@@ -110,4 +110,4 @@ namespace snmalloc
#endif #endif
} }
}; };
} } // namespace snmalloc

View File

@@ -39,4 +39,4 @@ namespace snmalloc
{ {
return reinterpret_cast<T*>(address); return reinterpret_cast<T*>(address);
} }
} } // namespace snmalloc

View File

@@ -491,5 +491,5 @@ namespace snmalloc
{ {
return t1 > t2 ? t1 : t2; return t1 > t2 ? t1 : t2;
} }
} } // namespace bits
} } // namespace snmalloc

View File

@@ -52,4 +52,4 @@ namespace snmalloc
return *this; return *this;
} }
}; };
} } // namespace snmalloc

View File

@@ -169,4 +169,4 @@ namespace snmalloc
#endif #endif
} }
}; };
} } // namespace snmalloc

View File

@@ -21,4 +21,4 @@ namespace snmalloc
lock.clear(std::memory_order_release); lock.clear(std::memory_order_release);
} }
}; };
} } // namespace snmalloc

View File

@@ -77,4 +77,4 @@ namespace snmalloc
return array[i & (rlength - 1)]; return array[i & (rlength - 1)];
} }
}; };
} } // namespace snmalloc

View File

@@ -72,4 +72,4 @@ namespace snmalloc
return top; return top;
} }
}; };
} } // namespace snmalloc

View File

@@ -79,4 +79,4 @@ namespace snmalloc
return nullptr; return nullptr;
} }
}; };
} } // namespace snmalloc

View File

@@ -1250,4 +1250,4 @@ namespace snmalloc
return page_map; return page_map;
} }
}; };
} } // namespace snmalloc

View File

@@ -143,4 +143,4 @@ namespace snmalloc
"SLAB_COUNT must be a power of 2"); "SLAB_COUNT must be a power of 2");
static_assert( static_assert(
SLAB_COUNT <= (UINT8_MAX + 1), "SLAB_COUNT must fit in a uint8_t"); SLAB_COUNT <= (UINT8_MAX + 1), "SLAB_COUNT must fit in a uint8_t");
}; } // namespace snmalloc

View File

@@ -16,4 +16,4 @@ namespace snmalloc
return allocator; return allocator;
} }
}; };
} } // namespace snmalloc

View File

@@ -389,4 +389,4 @@ namespace snmalloc
} }
#endif #endif
}; };
} } // namespace snmalloc

View File

@@ -29,4 +29,4 @@ namespace snmalloc
return kind; return kind;
} }
}; };
} } // namespace snmalloc

View File

@@ -176,4 +176,4 @@ namespace snmalloc
} }
using Alloc = Allocator<GlobalVirtual>; using Alloc = Allocator<GlobalVirtual>;
} } // namespace snmalloc

View File

@@ -410,4 +410,4 @@ namespace snmalloc
* passed as an argument. * passed as an argument.
*/ */
HEADER_GLOBAL GlobalVirtual default_memory_provider; HEADER_GLOBAL GlobalVirtual default_memory_provider;
} } // namespace snmalloc

View File

@@ -129,4 +129,4 @@ namespace snmalloc
((address_cast(p) - address_cast(this))) >> 8); ((address_cast(p) - address_cast(this))) >> 8);
} }
}; };
} } // namespace snmalloc

View File

@@ -170,4 +170,4 @@ namespace snmalloc
#endif #endif
} }
}; };
} } // namespace snmalloc

View File

@@ -357,4 +357,4 @@ namespace snmalloc
} while (length > 0); } while (length > 0);
} }
}; };
} } // namespace snmalloc

View File

@@ -95,4 +95,4 @@ namespace snmalloc
return p->list_next; return p->list_next;
} }
}; };
} } // namespace snmalloc

View File

@@ -18,4 +18,4 @@ namespace snmalloc
/// Used by the pool to keep the list of all entries ever created. /// Used by the pool to keep the list of all entries ever created.
T* list_next; T* list_next;
}; };
} } // namespace snmalloc

View File

@@ -47,4 +47,4 @@ namespace snmalloc
reinterpret_cast<uintptr_t>(&message_queue)); reinterpret_cast<uintptr_t>(&message_queue));
} }
}; };
} } // namespace snmalloc

View File

@@ -167,4 +167,4 @@ namespace snmalloc
return relative; return relative;
} }
#endif #endif
}; } // namespace snmalloc

View File

@@ -92,4 +92,4 @@ namespace snmalloc
return sizeclass_metadata return sizeclass_metadata
.medium_slab_slots[(sizeclass - NUM_SMALL_CLASSES)]; .medium_slab_slots[(sizeclass - NUM_SMALL_CLASSES)];
} }
} } // namespace snmalloc

View File

@@ -163,4 +163,4 @@ namespace snmalloc
return (address_cast(this) & SUPERSLAB_MASK) == address_cast(this); return (address_cast(this) & SUPERSLAB_MASK) == address_cast(this);
} }
}; };
} } // namespace snmalloc

View File

@@ -65,4 +65,4 @@ namespace snmalloc
{ {
return SlowAllocator{}; return SlowAllocator{};
} }
} } // namespace snmalloc

View File

@@ -242,4 +242,4 @@ namespace snmalloc
return NoStatusChange; return NoStatusChange;
} }
}; };
} } // namespace snmalloc

View File

@@ -266,4 +266,4 @@ namespace snmalloc
#else #else
using ThreadAlloc = ThreadAllocExplicitTLSCleanup; using ThreadAlloc = ThreadAllocExplicitTLSCleanup;
#endif #endif
} } // namespace snmalloc

View File

@@ -5,7 +5,7 @@
namespace snmalloc namespace snmalloc
{ {
void error(const char* const str); void error(const char* const str);
} } // namespace snmalloc
// If simultating OE, then we need the underlying platform // If simultating OE, then we need the underlying platform
#if !defined(OPEN_ENCLAVE) || defined(OPEN_ENCLAVE_SIMULATION) #if !defined(OPEN_ENCLAVE) || defined(OPEN_ENCLAVE_SIMULATION)
@@ -50,4 +50,4 @@ namespace snmalloc
{ {
Pal::error(str); Pal::error(str);
} }
} } // namespace snmalloc

View File

@@ -42,4 +42,4 @@ namespace snmalloc
*/ */
YesZero YesZero
}; };
} } // namespace snmalloc

View File

@@ -91,5 +91,5 @@ namespace snmalloc
return p; return p;
} }
}; };
} } // namespace snmalloc
#endif #endif

View File

@@ -29,4 +29,4 @@ namespace snmalloc
} }
} }
}; };
} } // namespace snmalloc