From 36af06343cc61eb2a0bd55b5805d49e19a7b8aac Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Wed, 20 Apr 2022 01:54:25 +0000 Subject: [PATCH] Fixup readability/namespace issues. This CL fixes a few readability/namespace issues and suppresses one which is in conflict with the current formatting rules. Bug: dawn:1339 Change-Id: Ifb688b05d50ebc3e698a77700178f87c93b14a46 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86867 Reviewed-by: Corentin Wallez Commit-Queue: Dan Sinclair Auto-Submit: Dan Sinclair --- src/dawn/CPPLINT.cfg | 1 - src/dawn/native/vulkan/external_memory/MemoryService.h | 4 ++-- .../native/vulkan/external_memory/MemoryServiceDmaBuf.cpp | 6 +++--- .../native/vulkan/external_memory/MemoryServiceNull.cpp | 4 ++-- .../native/vulkan/external_memory/MemoryServiceOpaqueFD.cpp | 4 ++-- .../vulkan/external_memory/MemoryServiceZirconHandle.cpp | 4 ++-- .../native/vulkan/external_semaphore/SemaphoreService.h | 4 ++-- .../native/vulkan/external_semaphore/SemaphoreServiceFD.cpp | 4 ++-- .../vulkan/external_semaphore/SemaphoreServiceNull.cpp | 4 ++-- .../external_semaphore/SemaphoreServiceZirconHandle.cpp | 4 ++-- src/dawn/tests/unittests/native/DestroyObjectTests.cpp | 2 ++ src/dawn/tests/white_box/VulkanImageWrappingTests.cpp | 6 +++--- 12 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/dawn/CPPLINT.cfg b/src/dawn/CPPLINT.cfg index 6c1f701a08..d4594ba0ed 100644 --- a/src/dawn/CPPLINT.cfg +++ b/src/dawn/CPPLINT.cfg @@ -1,6 +1,5 @@ filter=-build/namespaces filter=-readability/casting -filter=-readability/namespace filter=-readability/todo filter=-runtime/explicit filter=-runtime/indentation_namespace diff --git a/src/dawn/native/vulkan/external_memory/MemoryService.h b/src/dawn/native/vulkan/external_memory/MemoryService.h index b03fb10499..2b1e00bc08 100644 --- a/src/dawn/native/vulkan/external_memory/MemoryService.h +++ b/src/dawn/native/vulkan/external_memory/MemoryService.h @@ -25,7 +25,7 @@ namespace dawn::native::vulkan { struct VulkanDeviceInfo; } // namespace dawn::native::vulkan -namespace dawn::native { namespace vulkan::external_memory { +namespace dawn::native::vulkan::external_memory { struct MemoryImportParams { VkDeviceSize allocationSize; @@ -73,6 +73,6 @@ namespace dawn::native { namespace vulkan::external_memory { bool mSupported = false; }; -}} // namespace dawn::native::vulkan::external_memory +} // namespace dawn::native::vulkan::external_memory #endif // SRC_DAWN_NATIVE_VULKAN_EXTERNAL_MEMORY_MEMORYSERVICE_H_ diff --git a/src/dawn/native/vulkan/external_memory/MemoryServiceDmaBuf.cpp b/src/dawn/native/vulkan/external_memory/MemoryServiceDmaBuf.cpp index 3cd6d92d97..cd8a5b9f16 100644 --- a/src/dawn/native/vulkan/external_memory/MemoryServiceDmaBuf.cpp +++ b/src/dawn/native/vulkan/external_memory/MemoryServiceDmaBuf.cpp @@ -23,7 +23,7 @@ #include "dawn/native/vulkan/VulkanError.h" #include "dawn/native/vulkan/external_memory/MemoryService.h" -namespace dawn::native { namespace vulkan::external_memory { +namespace dawn::native::vulkan::external_memory { namespace { @@ -113,7 +113,7 @@ namespace dawn::native { namespace vulkan::external_memory { return false; } - } // anonymous namespace + } // namespace Service::Service(Device* device) : mDevice(device), mSupported(CheckSupport(device->GetDeviceInfo())) { @@ -356,4 +356,4 @@ namespace dawn::native { namespace vulkan::external_memory { return image; } -}} // namespace dawn::native::vulkan::external_memory +} // namespace dawn::native::vulkan::external_memory diff --git a/src/dawn/native/vulkan/external_memory/MemoryServiceNull.cpp b/src/dawn/native/vulkan/external_memory/MemoryServiceNull.cpp index 7b3c239916..c2307bf51f 100644 --- a/src/dawn/native/vulkan/external_memory/MemoryServiceNull.cpp +++ b/src/dawn/native/vulkan/external_memory/MemoryServiceNull.cpp @@ -15,7 +15,7 @@ #include "dawn/native/vulkan/DeviceVk.h" #include "dawn/native/vulkan/external_memory/MemoryService.h" -namespace dawn::native { namespace vulkan::external_memory { +namespace dawn::native::vulkan::external_memory { Service::Service(Device* device) : mDevice(device) { DAWN_UNUSED(mDevice); @@ -62,4 +62,4 @@ namespace dawn::native { namespace vulkan::external_memory { return DAWN_UNIMPLEMENTED_ERROR("Using null memory service to interop inside Vulkan"); } -}} // namespace dawn::native::vulkan::external_memory +} // namespace dawn::native::vulkan::external_memory diff --git a/src/dawn/native/vulkan/external_memory/MemoryServiceOpaqueFD.cpp b/src/dawn/native/vulkan/external_memory/MemoryServiceOpaqueFD.cpp index ad5461726d..b5a780bbd9 100644 --- a/src/dawn/native/vulkan/external_memory/MemoryServiceOpaqueFD.cpp +++ b/src/dawn/native/vulkan/external_memory/MemoryServiceOpaqueFD.cpp @@ -21,7 +21,7 @@ #include "dawn/native/vulkan/VulkanError.h" #include "dawn/native/vulkan/external_memory/MemoryService.h" -namespace dawn::native { namespace vulkan::external_memory { +namespace dawn::native::vulkan::external_memory { Service::Service(Device* device) : mDevice(device), mSupported(CheckSupport(device->GetDeviceInfo())) { @@ -157,4 +157,4 @@ namespace dawn::native { namespace vulkan::external_memory { return image; } -}} // namespace dawn::native::vulkan::external_memory +} // namespace dawn::native::vulkan::external_memory diff --git a/src/dawn/native/vulkan/external_memory/MemoryServiceZirconHandle.cpp b/src/dawn/native/vulkan/external_memory/MemoryServiceZirconHandle.cpp index 96c04a7c39..85fdeac8e9 100644 --- a/src/dawn/native/vulkan/external_memory/MemoryServiceZirconHandle.cpp +++ b/src/dawn/native/vulkan/external_memory/MemoryServiceZirconHandle.cpp @@ -21,7 +21,7 @@ #include "dawn/native/vulkan/VulkanError.h" #include "dawn/native/vulkan/external_memory/MemoryService.h" -namespace dawn::native { namespace vulkan::external_memory { +namespace dawn::native::vulkan::external_memory { Service::Service(Device* device) : mDevice(device), mSupported(CheckSupport(device->GetDeviceInfo())) { @@ -159,4 +159,4 @@ namespace dawn::native { namespace vulkan::external_memory { return image; } -}} // namespace dawn::native::vulkan::external_memory +} // namespace dawn::native::vulkan::external_memory diff --git a/src/dawn/native/vulkan/external_semaphore/SemaphoreService.h b/src/dawn/native/vulkan/external_semaphore/SemaphoreService.h index 259afa8df4..2da5834a77 100644 --- a/src/dawn/native/vulkan/external_semaphore/SemaphoreService.h +++ b/src/dawn/native/vulkan/external_semaphore/SemaphoreService.h @@ -25,7 +25,7 @@ namespace dawn::native::vulkan { class Device; } // namespace dawn::native::vulkan -namespace dawn::native { namespace vulkan::external_semaphore { +namespace dawn::native::vulkan::external_semaphore { class Service { public: @@ -55,6 +55,6 @@ namespace dawn::native { namespace vulkan::external_semaphore { bool mSupported = false; }; -}} // namespace dawn::native::vulkan::external_semaphore +} // namespace dawn::native::vulkan::external_semaphore #endif // SRC_DAWN_NATIVE_VULKAN_EXTERNAL_SEMAPHORE_SEMAPHORESERVICE_H_ diff --git a/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceFD.cpp b/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceFD.cpp index a234b875fd..6909491a3c 100644 --- a/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceFD.cpp +++ b/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceFD.cpp @@ -27,7 +27,7 @@ static constexpr VkExternalSemaphoreHandleTypeFlagBits kHandleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR; #endif // defined(DAWN_USE_SYNC_FDS) -namespace dawn::native { namespace vulkan::external_semaphore { +namespace dawn::native::vulkan::external_semaphore { Service::Service(Device* device) : mDevice(device), @@ -136,4 +136,4 @@ namespace dawn::native { namespace vulkan::external_semaphore { return fd; } -}} // namespace dawn::native::vulkan::external_semaphore +} // namespace dawn::native::vulkan::external_semaphore diff --git a/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceNull.cpp b/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceNull.cpp index 3146e3771a..ba32609de3 100644 --- a/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceNull.cpp +++ b/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceNull.cpp @@ -15,7 +15,7 @@ #include "dawn/native/vulkan/DeviceVk.h" #include "dawn/native/vulkan/external_semaphore/SemaphoreService.h" -namespace dawn::native { namespace vulkan::external_semaphore { +namespace dawn::native::vulkan::external_semaphore { Service::Service(Device* device) : mDevice(device) { DAWN_UNUSED(mDevice); @@ -47,4 +47,4 @@ namespace dawn::native { namespace vulkan::external_semaphore { return DAWN_UNIMPLEMENTED_ERROR("Using null semaphore service to interop inside Vulkan"); } -}} // namespace dawn::native::vulkan::external_semaphore +} // namespace dawn::native::vulkan::external_semaphore diff --git a/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceZirconHandle.cpp b/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceZirconHandle.cpp index 3a1a5bcdbb..db5b800d49 100644 --- a/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceZirconHandle.cpp +++ b/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceZirconHandle.cpp @@ -20,7 +20,7 @@ #include "dawn/native/vulkan/VulkanError.h" #include "dawn/native/vulkan/external_semaphore/SemaphoreService.h" -namespace dawn::native { namespace vulkan::external_semaphore { +namespace dawn::native::vulkan::external_semaphore { Service::Service(Device* device) : mDevice(device), @@ -134,4 +134,4 @@ namespace dawn::native { namespace vulkan::external_semaphore { return handle; } -}} // namespace dawn::native::vulkan::external_semaphore +} // namespace dawn::native::vulkan::external_semaphore diff --git a/src/dawn/tests/unittests/native/DestroyObjectTests.cpp b/src/dawn/tests/unittests/native/DestroyObjectTests.cpp index 01c09add51..e70682d040 100644 --- a/src/dawn/tests/unittests/native/DestroyObjectTests.cpp +++ b/src/dawn/tests/unittests/native/DestroyObjectTests.cpp @@ -763,4 +763,6 @@ namespace dawn::native { namespace { EXPECT_FALSE(textureView->IsAlive()); } + // TODO(https://crbug.com/dawn/1381) Remove when namespaces are not indented. + // NOLINTNEXTLINE(readability/namespace) }} // namespace dawn::native:: diff --git a/src/dawn/tests/white_box/VulkanImageWrappingTests.cpp b/src/dawn/tests/white_box/VulkanImageWrappingTests.cpp index 1bb9c28017..0a34e90b0e 100644 --- a/src/dawn/tests/white_box/VulkanImageWrappingTests.cpp +++ b/src/dawn/tests/white_box/VulkanImageWrappingTests.cpp @@ -22,7 +22,7 @@ #include "dawn/utils/ComboRenderPipelineDescriptor.h" #include "dawn/utils/WGPUHelpers.h" -namespace dawn::native { namespace vulkan { +namespace dawn::native::vulkan { using ExternalTexture = VulkanImageWrappingTestBackend::ExternalTexture; using ExternalSemaphore = VulkanImageWrappingTestBackend::ExternalSemaphore; @@ -124,7 +124,7 @@ namespace dawn::native { namespace vulkan { std::unique_ptr defaultTexture; }; - } // anonymous namespace + } // namespace using VulkanImageWrappingValidationTests = VulkanImageWrappingTestBase; @@ -885,4 +885,4 @@ namespace dawn::native { namespace vulkan { DAWN_INSTANTIATE_TEST(VulkanImageWrappingValidationTests, VulkanBackend()); DAWN_INSTANTIATE_TEST(VulkanImageWrappingUsageTests, VulkanBackend()); -}} // namespace dawn::native::vulkan +} // namespace dawn::native::vulkan