Remove UBU in AlignedStorage This just needs using std::array Bug: 408010433 Change-Id: I6f0604d43c6577f2d068915260ee0f91ac89b2fb Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/299296 Reviewed-by: James Price <jrprice@google.com> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dan sinclair <dsinclair@chromium.org> Auto-Submit: Ryan Harrison <rharrison@chromium.org>
diff --git a/src/tint/utils/memory/aligned_storage.h b/src/tint/utils/memory/aligned_storage.h index 7c533bb..a147901 100644 --- a/src/tint/utils/memory/aligned_storage.h +++ b/src/tint/utils/memory/aligned_storage.h
@@ -28,13 +28,12 @@ #ifndef SRC_TINT_UTILS_MEMORY_ALIGNED_STORAGE_H_ #define SRC_TINT_UTILS_MEMORY_ALIGNED_STORAGE_H_ +#include <array> #include <cstddef> #include "src/tint/utils/macros/compiler.h" #include "src/tint/utils/memory/bitcast.h" -TINT_BEGIN_DISABLE_WARNING(UNSAFE_BUFFER_USAGE); - namespace tint { /// A structure that has the same size and alignment as Entry. @@ -42,17 +41,15 @@ template <typename T> struct alignas(alignof(T)) AlignedStorage { /// Byte array of length sizeof(T) - std::byte data[sizeof(T)]; + std::array<std::byte, sizeof(T)> data; /// @returns a pointer to aligned storage, reinterpreted as T& - T& Get() { return *Bitcast<T*>(&data[0]); } + T& Get() { return *Bitcast<T*>(data.data()); } /// @returns a pointer to aligned storage, reinterpreted as T& - const T& Get() const { return *Bitcast<const T*>(&data[0]); } + const T& Get() const { return *Bitcast<const T*>(data.data()); } }; } // namespace tint -TINT_END_DISABLE_WARNING(UNSAFE_BUFFER_USAGE); - #endif // SRC_TINT_UTILS_MEMORY_ALIGNED_STORAGE_H_