diff --git a/generator/templates/dawn_wire/WireCmd.cpp b/generator/templates/dawn_wire/WireCmd.cpp index 9a1490a848..154707286e 100644 --- a/generator/templates/dawn_wire/WireCmd.cpp +++ b/generator/templates/dawn_wire/WireCmd.cpp @@ -138,12 +138,12 @@ }; {% if is_cmd %} - static_assert(offsetof({{Return}}{{name}}Transfer, commandSize) == 0, ""); - static_assert(offsetof({{Return}}{{name}}Transfer, commandId) == sizeof(CmdHeader), ""); + static_assert(offsetof({{Return}}{{name}}Transfer, commandSize) == 0); + static_assert(offsetof({{Return}}{{name}}Transfer, commandId) == sizeof(CmdHeader)); {% endif %} {% if record.chained %} - static_assert(offsetof({{Return}}{{name}}Transfer, chain) == 0, ""); + static_assert(offsetof({{Return}}{{name}}Transfer, chain) == 0); {% endif %} //* Returns the required transfer size for `record` in addition to the transfer structure. diff --git a/src/common/Compiler.h b/src/common/Compiler.h index 3f5bd588d6..ae4f5c0d76 100644 --- a/src/common/Compiler.h +++ b/src/common/Compiler.h @@ -78,7 +78,7 @@ extern void __cdecl __debugbreak(void); // It seems that (void) EXPR works on all compilers to silence the unused variable warning. #define DAWN_UNUSED(EXPR) (void)EXPR // Likewise using static asserting on sizeof(&FUNC) seems to make it tagged as used -#define DAWN_UNUSED_FUNC(FUNC) static_assert(sizeof(&FUNC) == sizeof(void (*)()), "") +#define DAWN_UNUSED_FUNC(FUNC) static_assert(sizeof(&FUNC) == sizeof(void (*)())) // Add noop replacements for macros for features that aren't supported by the compiler. #if !defined(DAWN_LIKELY) diff --git a/src/common/DynamicLib.h b/src/common/DynamicLib.h index 09a08198f8..0fe6ca1b9f 100644 --- a/src/common/DynamicLib.h +++ b/src/common/DynamicLib.h @@ -41,7 +41,7 @@ class DynamicLib { template bool GetProc(T** proc, const std::string& procName, std::string* error = nullptr) const { ASSERT(proc != nullptr); - static_assert(std::is_function::value, ""); + static_assert(std::is_function::value); *proc = reinterpret_cast(GetProc(procName, error)); return *proc != nullptr; diff --git a/src/common/Result.h b/src/common/Result.h index f9138087b1..28d2e2da68 100644 --- a/src/common/Result.h +++ b/src/common/Result.h @@ -310,14 +310,14 @@ template template Result::Result(Result&& other) : mPayload(other.mPayload) { other.mPayload = detail::kEmptyPayload; - static_assert(std::is_same::value || std::is_base_of::value, ""); + static_assert(std::is_same::value || std::is_base_of::value); } template template Result& Result::operator=(Result&& other) { ASSERT(mPayload == detail::kEmptyPayload); - static_assert(std::is_same::value || std::is_base_of::value, ""); + static_assert(std::is_same::value || std::is_base_of::value); mPayload = other.mPayload; other.mPayload = detail::kEmptyPayload; return *this; @@ -410,7 +410,7 @@ template template Result, E>::Result(Ref&& success) : mPayload(detail::MakePayload(success.Detach(), detail::Success)) { - static_assert(std::is_convertible::value, ""); + static_assert(std::is_convertible::value); } template @@ -426,14 +426,14 @@ Result, E>::Result(std::unique_ptr error) template template Result, E>::Result(Result, E>&& other) : mPayload(other.mPayload) { - static_assert(std::is_convertible::value, ""); + static_assert(std::is_convertible::value); other.mPayload = detail::kEmptyPayload; } template template Result, E>& Result, E>::operator=(Result, E>&& other) { - static_assert(std::is_convertible::value, ""); + static_assert(std::is_convertible::value); ASSERT(mPayload == detail::kEmptyPayload); mPayload = other.mPayload; other.mPayload = detail::kEmptyPayload; diff --git a/src/common/TypedInteger.h b/src/common/TypedInteger.h index fd45895283..fcba36d393 100644 --- a/src/common/TypedInteger.h +++ b/src/common/TypedInteger.h @@ -69,8 +69,8 @@ namespace detail { public: constexpr TypedIntegerImpl() : mValue(0) { - static_assert(alignof(TypedIntegerImpl) == alignof(T), ""); - static_assert(sizeof(TypedIntegerImpl) == sizeof(T), ""); + static_assert(alignof(TypedIntegerImpl) == alignof(T)); + static_assert(sizeof(TypedIntegerImpl) == sizeof(T)); } // Construction from non-narrowing integral types. @@ -134,7 +134,7 @@ namespace detail { template static constexpr std::enable_if_t::value, decltype(T(0) + T2(0))> AddImpl(TypedIntegerImpl lhs, TypedIntegerImpl rhs) { - static_assert(std::is_same::value, ""); + static_assert(std::is_same::value); // Overflow would wrap around ASSERT(lhs.mValue + rhs.mValue >= lhs.mValue); @@ -144,7 +144,7 @@ namespace detail { template static constexpr std::enable_if_t::value, decltype(T(0) + T2(0))> AddImpl(TypedIntegerImpl lhs, TypedIntegerImpl rhs) { - static_assert(std::is_same::value, ""); + static_assert(std::is_same::value); if (lhs.mValue > 0) { // rhs is positive: |rhs| is at most the distance between max and |lhs|. @@ -162,7 +162,7 @@ namespace detail { template static constexpr std::enable_if_t::value, decltype(T(0) - T2(0))> SubImpl(TypedIntegerImpl lhs, TypedIntegerImpl rhs) { - static_assert(std::is_same::value, ""); + static_assert(std::is_same::value); // Overflow would wrap around ASSERT(lhs.mValue - rhs.mValue <= lhs.mValue); @@ -173,7 +173,7 @@ namespace detail { static constexpr std::enable_if_t::value, decltype(T(0) - T2(0))> SubImpl( TypedIntegerImpl lhs, TypedIntegerImpl rhs) { - static_assert(std::is_same::value, ""); + static_assert(std::is_same::value); if (lhs.mValue > 0) { // rhs is positive: positive minus positive won't overflow @@ -190,7 +190,7 @@ namespace detail { template constexpr std::enable_if_t::value, TypedIntegerImpl> operator-() const { - static_assert(std::is_same::value, ""); + static_assert(std::is_same::value); // The negation of the most negative value cannot be represented. ASSERT(this->mValue != std::numeric_limits::min()); return TypedIntegerImpl(-this->mValue); diff --git a/src/common/ityp_array.h b/src/common/ityp_array.h index 68b428d5b0..bb00ecdec3 100644 --- a/src/common/ityp_array.h +++ b/src/common/ityp_array.h @@ -33,7 +33,7 @@ namespace ityp { using I = UnderlyingType; using Base = std::array; - static_assert(Size <= std::numeric_limits::max(), ""); + static_assert(Size <= std::numeric_limits::max()); public: constexpr array() = default; diff --git a/src/common/ityp_bitset.h b/src/common/ityp_bitset.h index 339cf18293..c166b3f197 100644 --- a/src/common/ityp_bitset.h +++ b/src/common/ityp_bitset.h @@ -28,7 +28,7 @@ namespace ityp { using I = UnderlyingType; using Base = std::bitset; - static_assert(sizeof(I) <= sizeof(size_t), ""); + static_assert(sizeof(I) <= sizeof(size_t)); constexpr bitset(const Base& rhs) : Base(rhs) { } diff --git a/src/common/ityp_stack_vec.h b/src/common/ityp_stack_vec.h index b88888b789..3a5c09b740 100644 --- a/src/common/ityp_stack_vec.h +++ b/src/common/ityp_stack_vec.h @@ -26,7 +26,7 @@ namespace ityp { using I = UnderlyingType; using Base = StackVector; using VectorBase = std::vector>; - static_assert(StaticCapacity <= std::numeric_limits::max(), ""); + static_assert(StaticCapacity <= std::numeric_limits::max()); public: stack_vec() : Base() { diff --git a/src/common/vulkan_platform.h b/src/common/vulkan_platform.h index 46818a782c..38569cb397 100644 --- a/src/common/vulkan_platform.h +++ b/src/common/vulkan_platform.h @@ -142,14 +142,14 @@ namespace dawn::native::vulkan { } // namespace dawn::native::vulkan -#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) \ - DAWN_DEFINE_NATIVE_NON_DISPATCHABLE_HANDLE(object) \ - namespace dawn::native::vulkan { \ - using object = detail::VkHandle; \ - static_assert(sizeof(object) == sizeof(uint64_t), ""); \ - static_assert(alignof(object) == detail::kUint64Alignment, ""); \ - static_assert(sizeof(object) == sizeof(::object), ""); \ - static_assert(alignof(object) == detail::kNativeVkHandleAlignment, ""); \ +#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) \ + DAWN_DEFINE_NATIVE_NON_DISPATCHABLE_HANDLE(object) \ + namespace dawn::native::vulkan { \ + using object = detail::VkHandle; \ + static_assert(sizeof(object) == sizeof(uint64_t)); \ + static_assert(alignof(object) == detail::kUint64Alignment); \ + static_assert(sizeof(object) == sizeof(::object)); \ + static_assert(alignof(object) == detail::kNativeVkHandleAlignment); \ } // namespace dawn::native::vulkan // Import additional parts of Vulkan that are supported on our architecture and preemptively include diff --git a/src/dawn_native/BindGroup.h b/src/dawn_native/BindGroup.h index 2510db74c2..fec56f324c 100644 --- a/src/dawn_native/BindGroup.h +++ b/src/dawn_native/BindGroup.h @@ -70,7 +70,7 @@ namespace dawn::native { descriptor, AlignPtr(reinterpret_cast(derived) + sizeof(Derived), descriptor->layout->GetBindingDataAlignment())) { - static_assert(std::is_base_of::value, ""); + static_assert(std::is_base_of::value); } // Constructor used only for mocking and testing. diff --git a/src/dawn_native/BindGroupLayout.h b/src/dawn_native/BindGroupLayout.h index 91c889007b..c5638dc956 100644 --- a/src/dawn_native/BindGroupLayout.h +++ b/src/dawn_native/BindGroupLayout.h @@ -106,7 +106,7 @@ namespace dawn::native { // this layout. size_t GetBindingDataSize() const; static constexpr size_t GetBindingDataAlignment() { - static_assert(alignof(Ref) <= alignof(BufferBindingData), ""); + static_assert(alignof(Ref) <= alignof(BufferBindingData)); return alignof(BufferBindingData); } diff --git a/src/dawn_native/CommandAllocator.h b/src/dawn_native/CommandAllocator.h index e6ad3c5bbb..362b33b05f 100644 --- a/src/dawn_native/CommandAllocator.h +++ b/src/dawn_native/CommandAllocator.h @@ -162,9 +162,9 @@ namespace dawn::native { template T* Allocate(E commandId) { - static_assert(sizeof(E) == sizeof(uint32_t), ""); - static_assert(alignof(E) == alignof(uint32_t), ""); - static_assert(alignof(T) <= kMaxSupportedAlignment, ""); + static_assert(sizeof(E) == sizeof(uint32_t)); + static_assert(alignof(E) == alignof(uint32_t)); + static_assert(alignof(T) <= kMaxSupportedAlignment); T* result = reinterpret_cast( Allocate(static_cast(commandId), sizeof(T), alignof(T))); if (!result) { @@ -176,7 +176,7 @@ namespace dawn::native { template T* AllocateData(size_t count) { - static_assert(alignof(T) <= kMaxSupportedAlignment, ""); + static_assert(alignof(T) <= kMaxSupportedAlignment); T* result = reinterpret_cast(AllocateData(sizeof(T) * count, alignof(T))); if (!result) { return nullptr; diff --git a/src/dawn_native/CommandBufferStateTracker.cpp b/src/dawn_native/CommandBufferStateTracker.cpp index c20ee993ef..f049d5ee0c 100644 --- a/src/dawn_native/CommandBufferStateTracker.cpp +++ b/src/dawn_native/CommandBufferStateTracker.cpp @@ -53,7 +53,7 @@ namespace dawn::native { VALIDATION_ASPECT_COUNT }; - static_assert(VALIDATION_ASPECT_COUNT == CommandBufferStateTracker::kNumAspects, ""); + static_assert(VALIDATION_ASPECT_COUNT == CommandBufferStateTracker::kNumAspects); static constexpr CommandBufferStateTracker::ValidationAspects kDispatchAspects = 1 << VALIDATION_ASPECT_PIPELINE | 1 << VALIDATION_ASPECT_BIND_GROUPS; diff --git a/src/dawn_native/CopyTextureForBrowserHelper.cpp b/src/dawn_native/CopyTextureForBrowserHelper.cpp index c0de264030..2a4c357438 100644 --- a/src/dawn_native/CopyTextureForBrowserHelper.cpp +++ b/src/dawn_native/CopyTextureForBrowserHelper.cpp @@ -219,7 +219,7 @@ namespace dawn::native { GammaTransferParams gammaEncodingParams = {}; GammaTransferParams gammaDecodingForDstSrgbParams = {}; }; - static_assert(sizeof(Uniform) == 176, ""); + static_assert(sizeof(Uniform) == 176); // TODO(crbug.com/dawn/856): Expand copyTextureForBrowser to support any // non-depth, non-stencil, non-compressed texture format pair copy. Now this API diff --git a/src/dawn_native/EnumMaskIterator.h b/src/dawn_native/EnumMaskIterator.h index e4fcc178e8..5954f91aa5 100644 --- a/src/dawn_native/EnumMaskIterator.h +++ b/src/dawn_native/EnumMaskIterator.h @@ -23,7 +23,7 @@ namespace dawn::native { template class EnumMaskIterator final { static constexpr size_t N = EnumBitmaskSize::value; - static_assert(N > 0, ""); + static_assert(N > 0); using U = std::underlying_type_t; diff --git a/src/dawn_native/Format.cpp b/src/dawn_native/Format.cpp index 30f4555d80..e409c0e1c1 100644 --- a/src/dawn_native/Format.cpp +++ b/src/dawn_native/Format.cpp @@ -53,7 +53,7 @@ namespace dawn::native { break; } - static_assert(static_cast(wgpu::TextureSampleType::Undefined) == 0, ""); + static_assert(static_cast(wgpu::TextureSampleType::Undefined) == 0); if (sampleType == wgpu::TextureSampleType::Undefined) { return SampleTypeBit::None; } @@ -61,26 +61,21 @@ namespace dawn::native { // Check that SampleTypeBit bits are in the same position / order as the respective // wgpu::TextureSampleType value. static_assert(SampleTypeBit::Float == - static_cast( - 1 << (static_cast(wgpu::TextureSampleType::Float) - 1)), - ""); + static_cast( + 1 << (static_cast(wgpu::TextureSampleType::Float) - 1))); static_assert( SampleTypeBit::UnfilterableFloat == - static_cast( - 1 << (static_cast(wgpu::TextureSampleType::UnfilterableFloat) - 1)), - ""); + static_cast( + 1 << (static_cast(wgpu::TextureSampleType::UnfilterableFloat) - 1))); static_assert(SampleTypeBit::Uint == - static_cast( - 1 << (static_cast(wgpu::TextureSampleType::Uint) - 1)), - ""); + static_cast( + 1 << (static_cast(wgpu::TextureSampleType::Uint) - 1))); static_assert(SampleTypeBit::Sint == - static_cast( - 1 << (static_cast(wgpu::TextureSampleType::Sint) - 1)), - ""); + static_cast( + 1 << (static_cast(wgpu::TextureSampleType::Sint) - 1))); static_assert(SampleTypeBit::Depth == - static_cast( - 1 << (static_cast(wgpu::TextureSampleType::Depth) - 1)), - ""); + static_cast( + 1 << (static_cast(wgpu::TextureSampleType::Depth) - 1))); return static_cast(1 << (static_cast(sampleType) - 1)); } @@ -131,8 +126,8 @@ namespace dawn::native { size_t ComputeFormatIndex(wgpu::TextureFormat format) { // This takes advantage of overflows to make the index of TextureFormat::Undefined outside // of the range of the FormatTable. - static_assert(static_cast(wgpu::TextureFormat::Undefined) - 1 > kKnownFormatCount, - ""); + static_assert(static_cast(wgpu::TextureFormat::Undefined) - 1 > + kKnownFormatCount); return static_cast(static_cast(format) - 1); } diff --git a/src/dawn_native/ObjectContentHasher.h b/src/dawn_native/ObjectContentHasher.h index 710eadc21d..9e6ac4068b 100644 --- a/src/dawn_native/ObjectContentHasher.h +++ b/src/dawn_native/ObjectContentHasher.h @@ -49,7 +49,7 @@ namespace dawn::native { static constexpr void Call(ObjectContentHasher* recorder, T* obj) { // Calling Record(objPtr) is not allowed. This check exists to only prevent such // mistakes. - static_assert(obj == nullptr, ""); + static_assert(obj == nullptr); } }; diff --git a/src/dawn_native/PerStage.h b/src/dawn_native/PerStage.h index 3fa65c6c1d..35ea216873 100644 --- a/src/dawn_native/PerStage.h +++ b/src/dawn_native/PerStage.h @@ -33,19 +33,16 @@ namespace dawn::native { const absl::FormatConversionSpec& spec, absl::FormatSink* s); - static_assert(static_cast(SingleShaderStage::Vertex) < kNumStages, ""); - static_assert(static_cast(SingleShaderStage::Fragment) < kNumStages, ""); - static_assert(static_cast(SingleShaderStage::Compute) < kNumStages, ""); + static_assert(static_cast(SingleShaderStage::Vertex) < kNumStages); + static_assert(static_cast(SingleShaderStage::Fragment) < kNumStages); + static_assert(static_cast(SingleShaderStage::Compute) < kNumStages); static_assert(static_cast(wgpu::ShaderStage::Vertex) == - (1 << static_cast(SingleShaderStage::Vertex)), - ""); + (1 << static_cast(SingleShaderStage::Vertex))); static_assert(static_cast(wgpu::ShaderStage::Fragment) == - (1 << static_cast(SingleShaderStage::Fragment)), - ""); + (1 << static_cast(SingleShaderStage::Fragment))); static_assert(static_cast(wgpu::ShaderStage::Compute) == - (1 << static_cast(SingleShaderStage::Compute)), - ""); + (1 << static_cast(SingleShaderStage::Compute))); BitSetIterator IterateStages(wgpu::ShaderStage stages); wgpu::ShaderStage StageBit(SingleShaderStage stage); diff --git a/src/dawn_native/QueryHelper.cpp b/src/dawn_native/QueryHelper.cpp index 2fa0727f84..7c8e9425ec 100644 --- a/src/dawn_native/QueryHelper.cpp +++ b/src/dawn_native/QueryHelper.cpp @@ -29,10 +29,10 @@ namespace dawn::native { namespace { // Assert the offsets in dawn::native::TimestampParams are same with the ones in the shader - static_assert(offsetof(dawn::native::TimestampParams, first) == 0, ""); - static_assert(offsetof(dawn::native::TimestampParams, count) == 4, ""); - static_assert(offsetof(dawn::native::TimestampParams, offset) == 8, ""); - static_assert(offsetof(dawn::native::TimestampParams, period) == 12, ""); + static_assert(offsetof(dawn::native::TimestampParams, first) == 0); + static_assert(offsetof(dawn::native::TimestampParams, count) == 4); + static_assert(offsetof(dawn::native::TimestampParams, offset) == 8); + static_assert(offsetof(dawn::native::TimestampParams, period) == 12); static const char sConvertTimestampsToNanoseconds[] = R"( struct Timestamp { diff --git a/src/dawn_native/null/DeviceNull.cpp b/src/dawn_native/null/DeviceNull.cpp index 7aa1483e1c..1141be3eba 100644 --- a/src/dawn_native/null/DeviceNull.cpp +++ b/src/dawn_native/null/DeviceNull.cpp @@ -228,7 +228,7 @@ namespace dawn::native::null { } MaybeError Device::IncrementMemoryUsage(uint64_t bytes) { - static_assert(kMaxMemoryUsage <= std::numeric_limits::max(), ""); + static_assert(kMaxMemoryUsage <= std::numeric_limits::max()); if (bytes > kMaxMemoryUsage || mMemoryUsage > kMaxMemoryUsage - bytes) { return DAWN_OUT_OF_MEMORY_ERROR("Out of memory."); } diff --git a/src/dawn_native/vulkan/DescriptorSetAllocator.cpp b/src/dawn_native/vulkan/DescriptorSetAllocator.cpp index c18d44a3fd..a8fb8c37c2 100644 --- a/src/dawn_native/vulkan/DescriptorSetAllocator.cpp +++ b/src/dawn_native/vulkan/DescriptorSetAllocator.cpp @@ -56,7 +56,7 @@ namespace dawn::native::vulkan { mMaxSets = kMaxDescriptorsPerPool; } else { ASSERT(totalDescriptorCount <= kMaxBindingsPerPipelineLayout); - static_assert(kMaxBindingsPerPipelineLayout <= kMaxDescriptorsPerPool, ""); + static_assert(kMaxBindingsPerPipelineLayout <= kMaxDescriptorsPerPool); // Compute the total number of descriptors sets that fits given the max. mMaxSets = kMaxDescriptorsPerPool / totalDescriptorCount; diff --git a/src/dawn_native/vulkan/RenderPipelineVk.cpp b/src/dawn_native/vulkan/RenderPipelineVk.cpp index f38766adb5..7db2e70562 100644 --- a/src/dawn_native/vulkan/RenderPipelineVk.cpp +++ b/src/dawn_native/vulkan/RenderPipelineVk.cpp @@ -210,17 +210,13 @@ namespace dawn::native::vulkan { bool isDeclaredInFragmentShader) { // Vulkan and Dawn color write masks match, static assert it and return the mask static_assert(static_cast(wgpu::ColorWriteMask::Red) == - VK_COLOR_COMPONENT_R_BIT, - ""); + VK_COLOR_COMPONENT_R_BIT); static_assert(static_cast(wgpu::ColorWriteMask::Green) == - VK_COLOR_COMPONENT_G_BIT, - ""); + VK_COLOR_COMPONENT_G_BIT); static_assert(static_cast(wgpu::ColorWriteMask::Blue) == - VK_COLOR_COMPONENT_B_BIT, - ""); + VK_COLOR_COMPONENT_B_BIT); static_assert(static_cast(wgpu::ColorWriteMask::Alpha) == - VK_COLOR_COMPONENT_A_BIT, - ""); + VK_COLOR_COMPONENT_A_BIT); // According to Vulkan SPEC (Chapter 14.3): "The input values to blending or color // attachment writes are undefined for components which do not correspond to a fragment diff --git a/src/dawn_wire/server/ObjectStorage.h b/src/dawn_wire/server/ObjectStorage.h index dd373f287e..7c49eeecaa 100644 --- a/src/dawn_wire/server/ObjectStorage.h +++ b/src/dawn_wire/server/ObjectStorage.h @@ -71,8 +71,8 @@ namespace dawn::wire::server { // an std::unordered_set. This lets us avoid providing our own hash and // equality comparison operators. inline uint64_t PackObjectTypeAndId(ObjectType type, ObjectId id) { - static_assert(sizeof(ObjectType) * 8 <= 32, ""); - static_assert(sizeof(ObjectId) * 8 <= 32, ""); + static_assert(sizeof(ObjectType) * 8 <= 32); + static_assert(sizeof(ObjectId) * 8 <= 32); return (static_cast(type) << 32) + id; } diff --git a/src/tests/end2end/TextureFormatTests.cpp b/src/tests/end2end/TextureFormatTests.cpp index fc6032ae62..35afa36871 100644 --- a/src/tests/end2end/TextureFormatTests.cpp +++ b/src/tests/end2end/TextureFormatTests.cpp @@ -350,7 +350,7 @@ class TextureFormatTest : public DawnTest { template void DoUnormTest(FormatTestInfo formatInfo) { - static_assert(!std::is_signed::value && std::is_integral::value, ""); + static_assert(!std::is_signed::value && std::is_integral::value); ASSERT(sizeof(T) * formatInfo.componentCount == formatInfo.texelByteSize); ASSERT(formatInfo.type == wgpu::TextureComponentType::Float); @@ -364,7 +364,7 @@ class TextureFormatTest : public DawnTest { template void DoSnormTest(FormatTestInfo formatInfo) { - static_assert(std::is_signed::value && std::is_integral::value, ""); + static_assert(std::is_signed::value && std::is_integral::value); ASSERT(sizeof(T) * formatInfo.componentCount == formatInfo.texelByteSize); ASSERT(formatInfo.type == wgpu::TextureComponentType::Float); @@ -380,7 +380,7 @@ class TextureFormatTest : public DawnTest { template void DoUintTest(FormatTestInfo formatInfo) { - static_assert(!std::is_signed::value && std::is_integral::value, ""); + static_assert(!std::is_signed::value && std::is_integral::value); ASSERT(sizeof(T) * formatInfo.componentCount == formatInfo.texelByteSize); ASSERT(formatInfo.type == wgpu::TextureComponentType::Uint); @@ -394,7 +394,7 @@ class TextureFormatTest : public DawnTest { template void DoSintTest(FormatTestInfo formatInfo) { - static_assert(std::is_signed::value && std::is_integral::value, ""); + static_assert(std::is_signed::value && std::is_integral::value); ASSERT(sizeof(T) * formatInfo.componentCount == formatInfo.texelByteSize); ASSERT(formatInfo.type == wgpu::TextureComponentType::Sint); diff --git a/src/tests/end2end/VertexStateTests.cpp b/src/tests/end2end/VertexStateTests.cpp index 9eb0999946..7a1ec79462 100644 --- a/src/tests/end2end/VertexStateTests.cpp +++ b/src/tests/end2end/VertexStateTests.cpp @@ -577,7 +577,7 @@ TEST_P(VertexStateTest, OverlappingVertexAttributes) { uint32_t uints[2]; uint16_t halfs[2]; }; - static_assert(sizeof(Data) == 16, ""); + static_assert(sizeof(Data) == 16); Data data{1.f, {2u, 3u}, {Float32ToFloat16(4.f), Float32ToFloat16(5.f)}}; wgpu::Buffer vertexBuffer = diff --git a/src/tests/perf_tests/DawnPerfTestPlatform.cpp b/src/tests/perf_tests/DawnPerfTestPlatform.cpp index 9ccf8c8205..a8ddabb992 100644 --- a/src/tests/perf_tests/DawnPerfTestPlatform.cpp +++ b/src/tests/perf_tests/DawnPerfTestPlatform.cpp @@ -35,10 +35,10 @@ namespace { {1, dawn::platform::TraceCategory::GPUWork}, }; - static_assert(static_cast(dawn::platform::TraceCategory::General) == 0, ""); - static_assert(static_cast(dawn::platform::TraceCategory::Validation) == 1, ""); - static_assert(static_cast(dawn::platform::TraceCategory::Recording) == 2, ""); - static_assert(static_cast(dawn::platform::TraceCategory::GPUWork) == 3, ""); + static_assert(static_cast(dawn::platform::TraceCategory::General) == 0); + static_assert(static_cast(dawn::platform::TraceCategory::Validation) == 1); + static_assert(static_cast(dawn::platform::TraceCategory::Recording) == 2); + static_assert(static_cast(dawn::platform::TraceCategory::GPUWork) == 3); } // anonymous namespace diff --git a/src/tests/unittests/EnumMaskIteratorTests.cpp b/src/tests/unittests/EnumMaskIteratorTests.cpp index 59b008f807..0dd5e59e24 100644 --- a/src/tests/unittests/EnumMaskIteratorTests.cpp +++ b/src/tests/unittests/EnumMaskIteratorTests.cpp @@ -42,7 +42,7 @@ namespace dawn { namespace dawn::native { - static_assert(EnumBitmaskSize::value == 3, ""); + static_assert(EnumBitmaskSize::value == 3); TEST(EnumMaskIteratorTests, None) { for (TestAspect aspect : IterateEnumMask(static_cast(0))) { diff --git a/src/tests/unittests/ITypArrayTests.cpp b/src/tests/unittests/ITypArrayTests.cpp index ce71cda5a8..8d43947e98 100644 --- a/src/tests/unittests/ITypArrayTests.cpp +++ b/src/tests/unittests/ITypArrayTests.cpp @@ -28,9 +28,9 @@ class ITypArrayTest : public testing::Test { static constexpr Array kArr = {Val(0), Val(1), Val(2), Val(3), Val(4), Val(5), Val(6), Val(7), Val(8), Val(9)}; - static_assert(kArr[Key(3)] == Val(3), ""); - static_assert(kArr.at(Key(7)) == Val(7), ""); - static_assert(kArr.size() == Key(10), ""); + static_assert(kArr[Key(3)] == Val(3)); + static_assert(kArr.at(Key(7)) == Val(7)); + static_assert(kArr.size() == Key(10)); }; }; diff --git a/src/tests/unittests/ITypBitsetTests.cpp b/src/tests/unittests/ITypBitsetTests.cpp index 88390a51de..178c9130b3 100644 --- a/src/tests/unittests/ITypBitsetTests.cpp +++ b/src/tests/unittests/ITypBitsetTests.cpp @@ -28,17 +28,17 @@ class ITypBitsetTest : public testing::Test { struct ConstexprTest { static constexpr Bitset kBitset = {1 << 0 | 1 << 3 | 1 << 7 | 1 << 8}; - static_assert(kBitset[Key(0)] == true, ""); - static_assert(kBitset[Key(1)] == false, ""); - static_assert(kBitset[Key(2)] == false, ""); - static_assert(kBitset[Key(3)] == true, ""); - static_assert(kBitset[Key(4)] == false, ""); - static_assert(kBitset[Key(5)] == false, ""); - static_assert(kBitset[Key(6)] == false, ""); - static_assert(kBitset[Key(7)] == true, ""); - static_assert(kBitset[Key(8)] == true, ""); + static_assert(kBitset[Key(0)] == true); + static_assert(kBitset[Key(1)] == false); + static_assert(kBitset[Key(2)] == false); + static_assert(kBitset[Key(3)] == true); + static_assert(kBitset[Key(4)] == false); + static_assert(kBitset[Key(5)] == false); + static_assert(kBitset[Key(6)] == false); + static_assert(kBitset[Key(7)] == true); + static_assert(kBitset[Key(8)] == true); - static_assert(kBitset.size() == 9, ""); + static_assert(kBitset.size() == 9); }; void ExpectBits(const Bitset& bits, std::set indices) { diff --git a/src/tests/unittests/MathTests.cpp b/src/tests/unittests/MathTests.cpp index 6517d0660a..71d0e8eb44 100644 --- a/src/tests/unittests/MathTests.cpp +++ b/src/tests/unittests/MathTests.cpp @@ -54,9 +54,9 @@ TEST(Math, Log2) { ASSERT_EQ(Log2(0xFFFFFFFFu), 31u); ASSERT_EQ(Log2(static_cast(0xFFFFFFFFFFFFFFFF)), 63u); - static_assert(ConstexprLog2(1u) == 0u, ""); - static_assert(ConstexprLog2(0xFFFFFFFFu) == 31u, ""); - static_assert(ConstexprLog2(static_cast(0xFFFFFFFFFFFFFFFF)) == 63u, ""); + static_assert(ConstexprLog2(1u) == 0u); + static_assert(ConstexprLog2(0xFFFFFFFFu) == 31u); + static_assert(ConstexprLog2(static_cast(0xFFFFFFFFFFFFFFFF)) == 63u); // Test boundary between two logs ASSERT_EQ(Log2(0x80000000u), 31u); @@ -64,16 +64,16 @@ TEST(Math, Log2) { ASSERT_EQ(Log2(static_cast(0x8000000000000000)), 63u); ASSERT_EQ(Log2(static_cast(0x7FFFFFFFFFFFFFFF)), 62u); - static_assert(ConstexprLog2(0x80000000u) == 31u, ""); - static_assert(ConstexprLog2(0x7FFFFFFFu) == 30u, ""); - static_assert(ConstexprLog2(static_cast(0x8000000000000000)) == 63u, ""); - static_assert(ConstexprLog2(static_cast(0x7FFFFFFFFFFFFFFF)) == 62u, ""); + static_assert(ConstexprLog2(0x80000000u) == 31u); + static_assert(ConstexprLog2(0x7FFFFFFFu) == 30u); + static_assert(ConstexprLog2(static_cast(0x8000000000000000)) == 63u); + static_assert(ConstexprLog2(static_cast(0x7FFFFFFFFFFFFFFF)) == 62u); ASSERT_EQ(Log2(16u), 4u); ASSERT_EQ(Log2(15u), 3u); - static_assert(ConstexprLog2(16u) == 4u, ""); - static_assert(ConstexprLog2(15u) == 3u, ""); + static_assert(ConstexprLog2(16u) == 4u); + static_assert(ConstexprLog2(15u) == 3u); } // Tests for Log2Ceil @@ -83,9 +83,9 @@ TEST(Math, Log2Ceil) { ASSERT_EQ(Log2Ceil(0xFFFFFFFFu), 32u); ASSERT_EQ(Log2Ceil(static_cast(0xFFFFFFFFFFFFFFFF)), 64u); - static_assert(ConstexprLog2Ceil(1u) == 0u, ""); - static_assert(ConstexprLog2Ceil(0xFFFFFFFFu) == 32u, ""); - static_assert(ConstexprLog2Ceil(static_cast(0xFFFFFFFFFFFFFFFF)) == 64u, ""); + static_assert(ConstexprLog2Ceil(1u) == 0u); + static_assert(ConstexprLog2Ceil(0xFFFFFFFFu) == 32u); + static_assert(ConstexprLog2Ceil(static_cast(0xFFFFFFFFFFFFFFFF)) == 64u); // Test boundary between two logs ASSERT_EQ(Log2Ceil(0x80000001u), 32u); @@ -95,20 +95,20 @@ TEST(Math, Log2Ceil) { ASSERT_EQ(Log2Ceil(static_cast(0x8000000000000000)), 63u); ASSERT_EQ(Log2Ceil(static_cast(0x7FFFFFFFFFFFFFFF)), 63u); - static_assert(ConstexprLog2Ceil(0x80000001u) == 32u, ""); - static_assert(ConstexprLog2Ceil(0x80000000u) == 31u, ""); - static_assert(ConstexprLog2Ceil(0x7FFFFFFFu) == 31u, ""); - static_assert(ConstexprLog2Ceil(static_cast(0x8000000000000001)) == 64u, ""); - static_assert(ConstexprLog2Ceil(static_cast(0x8000000000000000)) == 63u, ""); - static_assert(ConstexprLog2Ceil(static_cast(0x7FFFFFFFFFFFFFFF)) == 63u, ""); + static_assert(ConstexprLog2Ceil(0x80000001u) == 32u); + static_assert(ConstexprLog2Ceil(0x80000000u) == 31u); + static_assert(ConstexprLog2Ceil(0x7FFFFFFFu) == 31u); + static_assert(ConstexprLog2Ceil(static_cast(0x8000000000000001)) == 64u); + static_assert(ConstexprLog2Ceil(static_cast(0x8000000000000000)) == 63u); + static_assert(ConstexprLog2Ceil(static_cast(0x7FFFFFFFFFFFFFFF)) == 63u); ASSERT_EQ(Log2Ceil(17u), 5u); ASSERT_EQ(Log2Ceil(16u), 4u); ASSERT_EQ(Log2Ceil(15u), 4u); - static_assert(ConstexprLog2Ceil(17u) == 5u, ""); - static_assert(ConstexprLog2Ceil(16u) == 4u, ""); - static_assert(ConstexprLog2Ceil(15u) == 4u, ""); + static_assert(ConstexprLog2Ceil(17u) == 5u); + static_assert(ConstexprLog2Ceil(16u) == 4u); + static_assert(ConstexprLog2Ceil(15u) == 4u); } // Tests for IsPowerOfTwo diff --git a/src/tests/unittests/PlacementAllocatedTests.cpp b/src/tests/unittests/PlacementAllocatedTests.cpp index 9ff7d1d901..10cae04c88 100644 --- a/src/tests/unittests/PlacementAllocatedTests.cpp +++ b/src/tests/unittests/PlacementAllocatedTests.cpp @@ -66,7 +66,7 @@ TEST_F(PlacementAllocatedTests, DeletionDoesNotFreeMemory) { delete foo; // Touch the memory, this shouldn't crash. - static_assert(sizeof(Foo) >= sizeof(uint32_t), ""); + static_assert(sizeof(Foo) >= sizeof(uint32_t)); *reinterpret_cast(foo) = 42; free(ptr); @@ -87,7 +87,7 @@ TEST_F(PlacementAllocatedTests, DeletingDerivedClassCallsBaseDestructor) { } // Touch the memory, this shouldn't crash. - static_assert(sizeof(Bar) >= sizeof(uint32_t), ""); + static_assert(sizeof(Bar) >= sizeof(uint32_t)); *reinterpret_cast(bar) = 42; free(ptr); @@ -108,7 +108,7 @@ TEST_F(PlacementAllocatedTests, DeletingBaseClassCallsDerivedDestructor) { } // Touch the memory, this shouldn't crash. - static_assert(sizeof(Bar) >= sizeof(uint32_t), ""); + static_assert(sizeof(Bar) >= sizeof(uint32_t)); *reinterpret_cast(foo) = 42; free(ptr); diff --git a/src/tests/unittests/ToBackendTests.cpp b/src/tests/unittests/ToBackendTests.cpp index 76513503db..56514bfb4b 100644 --- a/src/tests/unittests/ToBackendTests.cpp +++ b/src/tests/unittests/ToBackendTests.cpp @@ -45,7 +45,7 @@ TEST(ToBackend, Pointers) { const AdapterBase* base = adapter; auto backendAdapter = ToBackend(base); - static_assert(std::is_same::value, ""); + static_assert(std::is_same::value); ASSERT_EQ(adapter, backendAdapter); adapter->Release(); @@ -55,7 +55,7 @@ TEST(ToBackend, Pointers) { AdapterBase* base = adapter; auto backendAdapter = ToBackend(base); - static_assert(std::is_same::value, ""); + static_assert(std::is_same::value); ASSERT_EQ(adapter, backendAdapter); adapter->Release(); @@ -69,7 +69,7 @@ TEST(ToBackend, Ref) { const Ref base(adapter); const auto& backendAdapter = ToBackend(base); - static_assert(std::is_same&>::value, ""); + static_assert(std::is_same&>::value); ASSERT_EQ(adapter, backendAdapter.Get()); adapter->Release(); @@ -79,7 +79,7 @@ TEST(ToBackend, Ref) { Ref base(adapter); auto backendAdapter = ToBackend(base); - static_assert(std::is_same&>::value, ""); + static_assert(std::is_same&>::value); ASSERT_EQ(adapter, backendAdapter.Get()); adapter->Release(); diff --git a/src/tests/unittests/TypedIntegerTests.cpp b/src/tests/unittests/TypedIntegerTests.cpp index 50cfe1d9c7..efa7d5675a 100644 --- a/src/tests/unittests/TypedIntegerTests.cpp +++ b/src/tests/unittests/TypedIntegerTests.cpp @@ -31,8 +31,8 @@ TEST_F(TypedIntegerTest, ConstructionAndCast) { Unsigned uvalue(7); EXPECT_EQ(static_cast(uvalue), 7u); - static_assert(static_cast(Signed(3)) == 3, ""); - static_assert(static_cast(Unsigned(28)) == 28, ""); + static_assert(static_cast(Signed(3)) == 3); + static_assert(static_cast(Unsigned(28)) == 28); } // Test typed integer comparison operators @@ -146,8 +146,8 @@ TEST_F(TypedIntegerTest, NumericLimits) { } TEST_F(TypedIntegerTest, UnderlyingType) { - static_assert(std::is_same, uint32_t>::value, ""); - static_assert(std::is_same, int32_t>::value, ""); + static_assert(std::is_same, uint32_t>::value); + static_assert(std::is_same, int32_t>::value); } // Tests for bounds assertions on arithmetic overflow and underflow. diff --git a/src/tests/unittests/validation/BindGroupValidationTests.cpp b/src/tests/unittests/validation/BindGroupValidationTests.cpp index 1c275c539b..b1ec580623 100644 --- a/src/tests/unittests/validation/BindGroupValidationTests.cpp +++ b/src/tests/unittests/validation/BindGroupValidationTests.cpp @@ -1190,10 +1190,8 @@ TEST_F(BindGroupLayoutValidationTest, DynamicBufferNumberLimit) { // In this test, we use all the same shader stage. Ensure that this does not exceed the // per-stage limit. - static_assert(kMaxDynamicUniformBuffersPerPipelineLayout <= kMaxUniformBuffersPerShaderStage, - ""); - static_assert(kMaxDynamicStorageBuffersPerPipelineLayout <= kMaxStorageBuffersPerShaderStage, - ""); + static_assert(kMaxDynamicUniformBuffersPerPipelineLayout <= kMaxUniformBuffersPerShaderStage); + static_assert(kMaxDynamicStorageBuffersPerPipelineLayout <= kMaxStorageBuffersPerShaderStage); for (uint32_t i = 0; i < kMaxDynamicUniformBuffersPerPipelineLayout; ++i) { maxUniformDB.push_back(utils::BindingLayoutEntryInitializationHelper(