diff --git a/c10/util/AlignOf.h b/c10/util/AlignOf.h index f5e24d6f53ed..29d74cff1e0c 100644 --- a/c10/util/AlignOf.h +++ b/c10/util/AlignOf.h @@ -35,6 +35,7 @@ namespace c10 { template struct AlignedCharArray { + // NOLINTNEXTLINE(*c-arrays) alignas(Alignment) char buffer[Size]; }; @@ -142,6 +143,7 @@ template < typename T9 = char, typename T10 = char> union SizerImpl { + // NOLINTNEXTLINE(*c-arrays) char arr1[sizeof(T1)], arr2[sizeof(T2)], arr3[sizeof(T3)], arr4[sizeof(T4)], arr5[sizeof(T5)], arr6[sizeof(T6)], arr7[sizeof(T7)], arr8[sizeof(T8)], arr9[sizeof(T9)], arr10[sizeof(T10)]; diff --git a/c10/util/Bitset.h b/c10/util/Bitset.h index 28263019f33f..fede88f682b7 100644 --- a/c10/util/Bitset.h +++ b/c10/util/Bitset.h @@ -5,8 +5,7 @@ #include #endif -namespace c10 { -namespace utils { +namespace c10::utils { /** * This is a simple bitset class with sizeof(long long int) bits. @@ -114,5 +113,4 @@ inline bool operator!=(bitset lhs, bitset rhs) noexcept { return !(lhs == rhs); } -} // namespace utils -} // namespace c10 +} // namespace c10::utils diff --git a/c10/util/CallOnce.h b/c10/util/CallOnce.h index 50467df5fa89..04ad455e3313 100644 --- a/c10/util/CallOnce.h +++ b/c10/util/CallOnce.h @@ -47,7 +47,7 @@ class once_flag { if (init_.load(std::memory_order_relaxed)) { return; } - c10::guts::invoke(f, std::forward(args)...); + c10::guts::invoke(std::forward(f), std::forward(args)...); init_.store(true, std::memory_order_release); } diff --git a/c10/util/ExclusivelyOwnedTensorTraits.h b/c10/util/ExclusivelyOwnedTensorTraits.h index 143b4df0a4e5..73ff45b8c38d 100644 --- a/c10/util/ExclusivelyOwnedTensorTraits.h +++ b/c10/util/ExclusivelyOwnedTensorTraits.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include diff --git a/c10/util/Float8_e4m3fn.cpp b/c10/util/Float8_e4m3fn.cpp index b5f866db2cd0..7e502d21be0e 100644 --- a/c10/util/Float8_e4m3fn.cpp +++ b/c10/util/Float8_e4m3fn.cpp @@ -1,10 +1,11 @@ #include #include +#include namespace c10 { static_assert( - std::is_standard_layout::value, + std::is_standard_layout_v, "c10::Float8_e4m3fn must be standard layout."); std::ostream& operator<<(std::ostream& out, const Float8_e4m3fn& value) { diff --git a/c10/util/FunctionRef.h b/c10/util/FunctionRef.h index 761bc809b91b..4cab3be078e4 100644 --- a/c10/util/FunctionRef.h +++ b/c10/util/FunctionRef.h @@ -50,14 +50,15 @@ class function_ref { template function_ref( + // NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) Callable&& callable, - typename std::enable_if::type, - function_ref>::value>::type* = nullptr, - typename std::enable_if, function_ref>>* = + nullptr, + std::enable_if_t, - Ret>::value>::type* = nullptr) - : callback(callback_fn::type>), + Ret>>* = nullptr) + : callback(callback_fn>), callable(reinterpret_cast(&callable)) {} Ret operator()(Params... params) const { diff --git a/c10/util/Metaprogramming.h b/c10/util/Metaprogramming.h index d3108ea191c9..d759da7a2a4e 100644 --- a/c10/util/Metaprogramming.h +++ b/c10/util/Metaprogramming.h @@ -1,7 +1,6 @@ #pragma once #include -#include #include namespace c10::guts { @@ -207,6 +206,7 @@ constexpr auto tuple_slice(Tuple t) { namespace detail { template auto tuple_map( + // NOLINTNEXTLINE(cppcoreguidelines-rvalue-reference-param-not-moved) std::tuple&& tuple, const Mapper& mapper, std::index_sequence) { diff --git a/c10/util/SmallBuffer.h b/c10/util/SmallBuffer.h index 1fc7c6f16be7..10a6628dfb64 100644 --- a/c10/util/SmallBuffer.h +++ b/c10/util/SmallBuffer.h @@ -1,5 +1,7 @@ #pragma once #include +#include +#include #include /** Helper class for allocating temporary fixed size arrays with SBO. @@ -16,9 +18,7 @@ namespace c10 { template class SmallBuffer { - static_assert( - std::is_trivial::value, - "SmallBuffer is intended for POD types"); + static_assert(std::is_trivial_v, "SmallBuffer is intended for POD types"); std::array storage_; size_t size_{}; diff --git a/c10/util/TypeList.h b/c10/util/TypeList.h index 21b3ba728baa..f1422e99e4d8 100644 --- a/c10/util/TypeList.h +++ b/c10/util/TypeList.h @@ -201,7 +201,7 @@ struct all { }; template