diff --git a/.clang-tidy b/.clang-tidy index ebba2b9..f3ca8c9 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -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: # - readability-magic-numbers # - modernize-avoid-c-arrays # - cppcoreguidelines-pro-bounds-array-to-pointer-decay (assert breaks it). +# - readability-braces-around-statements (mostly works, but is very confused by constexpr if). CheckOptions: - key: modernize-use-default-member-init.UseAssignment value: '1' diff --git a/src/ds/aba.h b/src/ds/aba.h index 143c495..4275ad5 100644 --- a/src/ds/aba.h +++ b/src/ds/aba.h @@ -110,4 +110,4 @@ namespace snmalloc #endif } }; -} +} // namespace snmalloc diff --git a/src/ds/address.h b/src/ds/address.h index 97ed3b3..e332197 100644 --- a/src/ds/address.h +++ b/src/ds/address.h @@ -39,4 +39,4 @@ namespace snmalloc { return reinterpret_cast(address); } -} +} // namespace snmalloc diff --git a/src/ds/bits.h b/src/ds/bits.h index 59cd7c3..208df18 100644 --- a/src/ds/bits.h +++ b/src/ds/bits.h @@ -491,5 +491,5 @@ namespace snmalloc { return t1 > t2 ? t1 : t2; } - } -} + } // namespace bits +} // namespace snmalloc diff --git a/src/ds/csv.h b/src/ds/csv.h index 9c7f8f7..63419ef 100644 --- a/src/ds/csv.h +++ b/src/ds/csv.h @@ -52,4 +52,4 @@ namespace snmalloc return *this; } }; -} \ No newline at end of file +} // namespace snmalloc \ No newline at end of file diff --git a/src/ds/dllist.h b/src/ds/dllist.h index 8893261..bd10aad 100644 --- a/src/ds/dllist.h +++ b/src/ds/dllist.h @@ -169,4 +169,4 @@ namespace snmalloc #endif } }; -} +} // namespace snmalloc diff --git a/src/ds/flaglock.h b/src/ds/flaglock.h index 8ae69a9..341471c 100644 --- a/src/ds/flaglock.h +++ b/src/ds/flaglock.h @@ -21,4 +21,4 @@ namespace snmalloc lock.clear(std::memory_order_release); } }; -} +} // namespace snmalloc diff --git a/src/ds/helpers.h b/src/ds/helpers.h index 2c1014a..819d73b 100644 --- a/src/ds/helpers.h +++ b/src/ds/helpers.h @@ -77,4 +77,4 @@ namespace snmalloc return array[i & (rlength - 1)]; } }; -} +} // namespace snmalloc diff --git a/src/ds/mpmcstack.h b/src/ds/mpmcstack.h index 3e9cdf2..25dd2ef 100644 --- a/src/ds/mpmcstack.h +++ b/src/ds/mpmcstack.h @@ -72,4 +72,4 @@ namespace snmalloc return top; } }; -} +} // namespace snmalloc diff --git a/src/ds/mpscq.h b/src/ds/mpscq.h index 05ce221..f554473 100644 --- a/src/ds/mpscq.h +++ b/src/ds/mpscq.h @@ -79,4 +79,4 @@ namespace snmalloc return nullptr; } }; -} +} // namespace snmalloc diff --git a/src/mem/alloc.h b/src/mem/alloc.h index 8200a77..bb8ed61 100644 --- a/src/mem/alloc.h +++ b/src/mem/alloc.h @@ -1250,4 +1250,4 @@ namespace snmalloc return page_map; } }; -} +} // namespace snmalloc diff --git a/src/mem/allocconfig.h b/src/mem/allocconfig.h index 48c0552..3b2cb14 100644 --- a/src/mem/allocconfig.h +++ b/src/mem/allocconfig.h @@ -143,4 +143,4 @@ namespace snmalloc "SLAB_COUNT must be a power of 2"); static_assert( SLAB_COUNT <= (UINT8_MAX + 1), "SLAB_COUNT must fit in a uint8_t"); -}; +} // namespace snmalloc diff --git a/src/mem/allocslab.h b/src/mem/allocslab.h index f1ac1dd..4982f49 100644 --- a/src/mem/allocslab.h +++ b/src/mem/allocslab.h @@ -16,4 +16,4 @@ namespace snmalloc return allocator; } }; -} +} // namespace snmalloc diff --git a/src/mem/allocstats.h b/src/mem/allocstats.h index 592fb3f..b4871b9 100644 --- a/src/mem/allocstats.h +++ b/src/mem/allocstats.h @@ -389,4 +389,4 @@ namespace snmalloc } #endif }; -} +} // namespace snmalloc diff --git a/src/mem/baseslab.h b/src/mem/baseslab.h index ae63fc5..9ca661c 100644 --- a/src/mem/baseslab.h +++ b/src/mem/baseslab.h @@ -29,4 +29,4 @@ namespace snmalloc return kind; } }; -} +} // namespace snmalloc diff --git a/src/mem/globalalloc.h b/src/mem/globalalloc.h index b380ac6..552c313 100644 --- a/src/mem/globalalloc.h +++ b/src/mem/globalalloc.h @@ -176,4 +176,4 @@ namespace snmalloc } using Alloc = Allocator; -} +} // namespace snmalloc diff --git a/src/mem/largealloc.h b/src/mem/largealloc.h index 16c1df8..d80a30c 100644 --- a/src/mem/largealloc.h +++ b/src/mem/largealloc.h @@ -410,4 +410,4 @@ namespace snmalloc * passed as an argument. */ HEADER_GLOBAL GlobalVirtual default_memory_provider; -} +} // namespace snmalloc diff --git a/src/mem/mediumslab.h b/src/mem/mediumslab.h index d6a022d..ce533d8 100644 --- a/src/mem/mediumslab.h +++ b/src/mem/mediumslab.h @@ -129,4 +129,4 @@ namespace snmalloc ((address_cast(p) - address_cast(this))) >> 8); } }; -} +} // namespace snmalloc diff --git a/src/mem/metaslab.h b/src/mem/metaslab.h index b34c534..641378a 100644 --- a/src/mem/metaslab.h +++ b/src/mem/metaslab.h @@ -170,4 +170,4 @@ namespace snmalloc #endif } }; -} +} // namespace snmalloc diff --git a/src/mem/pagemap.h b/src/mem/pagemap.h index efc0f68..89bfd4f 100644 --- a/src/mem/pagemap.h +++ b/src/mem/pagemap.h @@ -357,4 +357,4 @@ namespace snmalloc } while (length > 0); } }; -} +} // namespace snmalloc diff --git a/src/mem/pool.h b/src/mem/pool.h index b365790..f180b9c 100644 --- a/src/mem/pool.h +++ b/src/mem/pool.h @@ -95,4 +95,4 @@ namespace snmalloc return p->list_next; } }; -} +} // namespace snmalloc diff --git a/src/mem/pooled.h b/src/mem/pooled.h index d312d07..e9a10af 100644 --- a/src/mem/pooled.h +++ b/src/mem/pooled.h @@ -18,4 +18,4 @@ namespace snmalloc /// Used by the pool to keep the list of all entries ever created. T* list_next; }; -} \ No newline at end of file +} // namespace snmalloc \ No newline at end of file diff --git a/src/mem/remoteallocator.h b/src/mem/remoteallocator.h index f9d2768..21c2583 100644 --- a/src/mem/remoteallocator.h +++ b/src/mem/remoteallocator.h @@ -47,4 +47,4 @@ namespace snmalloc reinterpret_cast(&message_queue)); } }; -} +} // namespace snmalloc diff --git a/src/mem/sizeclass.h b/src/mem/sizeclass.h index 27c1669..ecaf682 100644 --- a/src/mem/sizeclass.h +++ b/src/mem/sizeclass.h @@ -167,4 +167,4 @@ namespace snmalloc return relative; } #endif -}; +} // namespace snmalloc diff --git a/src/mem/sizeclasstable.h b/src/mem/sizeclasstable.h index 9794d4d..97afa26 100644 --- a/src/mem/sizeclasstable.h +++ b/src/mem/sizeclasstable.h @@ -92,4 +92,4 @@ namespace snmalloc return sizeclass_metadata .medium_slab_slots[(sizeclass - NUM_SMALL_CLASSES)]; } -} +} // namespace snmalloc diff --git a/src/mem/slab.h b/src/mem/slab.h index fcf3a9b..87b745e 100644 --- a/src/mem/slab.h +++ b/src/mem/slab.h @@ -163,4 +163,4 @@ namespace snmalloc return (address_cast(this) & SUPERSLAB_MASK) == address_cast(this); } }; -} +} // namespace snmalloc diff --git a/src/mem/slowalloc.h b/src/mem/slowalloc.h index c726cfc..f2fcba1 100644 --- a/src/mem/slowalloc.h +++ b/src/mem/slowalloc.h @@ -65,4 +65,4 @@ namespace snmalloc { return SlowAllocator{}; } -} +} // namespace snmalloc diff --git a/src/mem/superslab.h b/src/mem/superslab.h index 63d179e..9cd3cdf 100644 --- a/src/mem/superslab.h +++ b/src/mem/superslab.h @@ -242,4 +242,4 @@ namespace snmalloc return NoStatusChange; } }; -} +} // namespace snmalloc diff --git a/src/mem/threadalloc.h b/src/mem/threadalloc.h index 5cd45dd..c16a666 100644 --- a/src/mem/threadalloc.h +++ b/src/mem/threadalloc.h @@ -266,4 +266,4 @@ namespace snmalloc #else using ThreadAlloc = ThreadAllocExplicitTLSCleanup; #endif -} +} // namespace snmalloc diff --git a/src/pal/pal.h b/src/pal/pal.h index a5a43ae..7eb5a8f 100644 --- a/src/pal/pal.h +++ b/src/pal/pal.h @@ -5,7 +5,7 @@ namespace snmalloc { void error(const char* const str); -} +} // namespace snmalloc // If simultating OE, then we need the underlying platform #if !defined(OPEN_ENCLAVE) || defined(OPEN_ENCLAVE_SIMULATION) @@ -50,4 +50,4 @@ namespace snmalloc { Pal::error(str); } -} +} // namespace snmalloc diff --git a/src/pal/pal_consts.h b/src/pal/pal_consts.h index 7cb40d9..e5e165d 100644 --- a/src/pal/pal_consts.h +++ b/src/pal/pal_consts.h @@ -42,4 +42,4 @@ namespace snmalloc */ YesZero }; -} +} // namespace snmalloc diff --git a/src/pal/pal_freebsd.h b/src/pal/pal_freebsd.h index f75347d..18dbd5f 100644 --- a/src/pal/pal_freebsd.h +++ b/src/pal/pal_freebsd.h @@ -91,5 +91,5 @@ namespace snmalloc return p; } }; -} +} // namespace snmalloc #endif diff --git a/src/pal/pal_plain.h b/src/pal/pal_plain.h index 965490c..b55edb4 100644 --- a/src/pal/pal_plain.h +++ b/src/pal/pal_plain.h @@ -29,4 +29,4 @@ namespace snmalloc } } }; -} +} // namespace snmalloc