aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie Madill <jmadill@chromium.org>2017-03-15 16:17:46 -0400
committerMark Lobodzinski <mark@lunarg.com>2017-03-16 08:40:05 -0600
commitb2ff6504b93a35375387fb01470bd20c0b0cec73 (patch)
tree04a2b2115ba84b97df501cbe330a6234ac03317b
parent8ba558f477354c5271a7e87744bc0450282f8ce4 (diff)
downloadusermoji-b2ff6504b93a35375387fb01470bd20c0b0cec73.tar.xz
build: Fix potentially uninitialized VS2015 warning
This fixes the a few occurences in demos, the loader and a test. It also adds the warning to the always-on list so it will prevent future regressions. Fixes #1587. Change-Id: I26f69e977b57749a3ab4ddb548ada95384131edc
-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
5 files changed, 12 insertions, 3 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));