summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--demos/cube.c3
-rw-r--r--demos/cube.cpp3
-rw-r--r--demos/smoke/ShellWin32.cpp2
-rw-r--r--loader/loader.c4
-rw-r--r--tests/layer_validation_tests.cpp8
6 files changed, 16 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a982fefe..b53696fb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -68,6 +68,9 @@ if(WIN32)
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/GR->")
# Warn about nested declarations
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/w34456>")
+ # Warn about potentially uninitialized variables
+ add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/w34701>")
+ add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/w34703>")
endif()
if(NOT WIN32)
diff --git a/demos/cube.c b/demos/cube.c
index 8985c971..b1706a96 100644
--- a/demos/cube.c
+++ b/demos/cube.c
@@ -3530,6 +3530,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine,
int argc;
char **argv;
+ // Ensure wParam is initialized.
+ msg.wParam = 0;
+
// Use the CommandLine functions to get the command line arguments.
// Unfortunately, Microsoft outputs
// this information as wide characters for Unicode, and we simply want the
diff --git a/demos/cube.cpp b/demos/cube.cpp
index 011c456f..082ab4d0 100644
--- a/demos/cube.cpp
+++ b/demos/cube.cpp
@@ -2678,6 +2678,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine,
int argc;
char **argv;
+ // Ensure wParam is initialized.
+ msg.wParam = 0;
+
// Use the CommandLine functions to get the command line arguments.
// Unfortunately, Microsoft outputs
// this information as wide characters for Unicode, and we simply want the
diff --git a/demos/smoke/ShellWin32.cpp b/demos/smoke/ShellWin32.cpp
index f5b68259..69ef38b4 100644
--- a/demos/smoke/ShellWin32.cpp
+++ b/demos/smoke/ShellWin32.cpp
@@ -90,7 +90,7 @@ void ShellWin32::create_window() {
PFN_vkGetInstanceProcAddr ShellWin32::load_vk() {
const char filename[] = "vulkan-1.dll";
HMODULE mod;
- PFN_vkGetInstanceProcAddr get_proc;
+ PFN_vkGetInstanceProcAddr get_proc = NULL;
mod = LoadLibrary(filename);
if (mod) {
diff --git a/loader/loader.c b/loader/loader.c
index 9a99759e..9b794b63 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -3976,8 +3976,8 @@ VkResult loader_create_device_chain(const struct loader_physical_device_tramp *p
VkDeviceCreateInfo loader_create_info;
VkResult res;
- PFN_vkGetDeviceProcAddr fpGDPA, nextGDPA = loader_gpa_device_internal;
- PFN_vkGetInstanceProcAddr fpGIPA, nextGIPA = loader_gpa_instance_internal;
+ PFN_vkGetDeviceProcAddr fpGDPA = NULL, nextGDPA = loader_gpa_device_internal;
+ PFN_vkGetInstanceProcAddr fpGIPA = NULL, nextGIPA = loader_gpa_instance_internal;
memcpy(&loader_create_info, pCreateInfo, sizeof(VkDeviceCreateInfo));
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 9ef889de..88bc089a 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -1355,7 +1355,7 @@ TEST_F(VkLayerTest, SparseResidencyImageCreateUnsupportedTypes) {
TEST_DESCRIPTION("Create images with sparse residency with unsupported types");
// Determine which device feature are available
- VkPhysicalDeviceFeatures available_features;
+ VkPhysicalDeviceFeatures available_features = {};
ASSERT_NO_FATAL_FAILURE(GetPhysicalDeviceFeatures(&available_features));
// Mask out device features we don't want
@@ -1421,7 +1421,7 @@ TEST_F(VkLayerTest, SparseResidencyImageCreateUnsupportedSamples) {
TEST_DESCRIPTION("Create images with sparse residency with unsupported tiling or sample counts");
// Determine which device feature are available
- VkPhysicalDeviceFeatures available_features;
+ VkPhysicalDeviceFeatures available_features = {};
ASSERT_NO_FATAL_FAILURE(GetPhysicalDeviceFeatures(&available_features));
// These tests all require that the device support sparse residency for 2D images
@@ -16069,7 +16069,7 @@ TEST_F(VkLayerTest, CompressedImageMipCopyTests) {
ASSERT_NO_FATAL_FAILURE(InitState());
- VkPhysicalDeviceFeatures device_features;
+ VkPhysicalDeviceFeatures device_features = {};
ASSERT_NO_FATAL_FAILURE(GetPhysicalDeviceFeatures(&device_features));
VkFormat compressed_format = VK_FORMAT_UNDEFINED;
if (device_features.textureCompressionBC) {
@@ -16547,7 +16547,7 @@ TEST_F(VkLayerTest, ImageBufferCopyTests) {
}
// Test compressed formats, if supported
- VkPhysicalDeviceFeatures device_features;
+ VkPhysicalDeviceFeatures device_features = {};
ASSERT_NO_FATAL_FAILURE(GetPhysicalDeviceFeatures(&device_features));
if (!(device_features.textureCompressionBC || device_features.textureCompressionETC2 ||
device_features.textureCompressionASTC_LDR)) {