Fix pedantic Clang warning/error

Move the addLayerIfAvailable() anonymous function to the condition where
it's actually used. Otherwise we get
"error: unused variable 'addLayerIfAvailable' [-Werror,-Wunused-variable]"

Bug: b/185779640
Change-Id: I2aaa0656bfcb0c1c0aa14c44837cf1b46ea02f54
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/53988
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis H├ętu <sugoi@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/tests/VulkanWrapper/VulkanTester.cpp b/tests/VulkanWrapper/VulkanTester.cpp
index 6d0e7e1..585aebf 100644
--- a/tests/VulkanWrapper/VulkanTester.cpp
+++ b/tests/VulkanWrapper/VulkanTester.cpp
@@ -274,6 +274,8 @@
 	extensionNames.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
 #endif
 
+	std::vector<const char *> layerNames;
+#if ENABLE_VALIDATION_LAYERS
 	auto addLayerIfAvailable = [](std::vector<const char *> &layers, const char *layer) {
 		static auto layerProperties = vk::enumerateInstanceLayerProperties();
 		if(std::find_if(layerProperties.begin(), layerProperties.end(), [layer](auto &lp) {
@@ -285,8 +287,6 @@
 		}
 	};
 
-	std::vector<const char *> layerNames;
-#if ENABLE_VALIDATION_LAYERS
 	addLayerIfAvailable(layerNames, "VK_LAYER_KHRONOS_validation");
 	addLayerIfAvailable(layerNames, "VK_LAYER_LUNARG_standard_validation");
 #endif