loader: Fix some non-msvc compiler warnings
authorBiswapriyo Nath <nathbappai@gmail.com>
Wed, 29 Jul 2020 04:58:18 +0000 (10:28 +0530)
committerLenny Komow <lenny@lunarg.com>
Wed, 19 Aug 2020 21:46:13 +0000 (15:46 -0600)
changes:
* loader/loader.c: cast dxgi_factory to void** type
* tests/loader_validation_tests.cpp: check if __STDC_FORMAT_MACROS is already defined
* tests/test_common.h: check if NOMINMAX is already defined
* tests/test_commogn.h: check _MSC_VER instead of WIN32 before pragma warning directive

Change-Id: I2fd78b760a90c2ac0e6463a60f5593a24ca904b8

loader/loader.c
tests/loader_validation_tests.cpp
tests/test_common.h

index 9bc7c7f..142cd97 100644 (file)
@@ -888,7 +888,7 @@ VkResult loaderGetRegistryFiles(const struct loader_instance *inst, char *locati
     }
 
     if (is_driver) {
-        HRESULT hres = fpCreateDXGIFactory1(&IID_IDXGIFactory1, &dxgi_factory);
+        HRESULT hres = fpCreateDXGIFactory1(&IID_IDXGIFactory1, (void **)&dxgi_factory);
         if (hres != S_OK) {
             loader_log(
                 inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0,
index e54c488..0082091 100644 (file)
@@ -27,7 +27,9 @@
  */
 
 // Following items are needed for C++ to work with PRIxLEAST64
+#ifndef __STDC_FORMAT_MACROS
 #define __STDC_FORMAT_MACROS
+#endif
 #include <inttypes.h>
 
 #include <stdint.h>  // For UINT32_MAX
index ac3f6a2..bd97696 100644 (file)
@@ -34,7 +34,9 @@
 #include <string.h>
 
 #ifdef _WIN32
+#ifndef NOMINMAX
 #define NOMINMAX
+#endif
 // WinSock2.h must be included *BEFORE* windows.h
 #include <winsock2.h>
 #endif
 #include <vulkan/vk_sdk_platform.h>
 #include <vulkan/vulkan.h>
 
-#ifdef _WIN32
+#ifdef _MSC_VER
 #pragma warning(push)
 /*
-    warnings 4251 and 4275 have to do with potential dll-interface mismatch
+    MSVC warnings 4251 and 4275 have to do with potential dll-interface mismatch
     between library (gtest) and users. Since we build the gtest library
     as part of the test build we know that the dll-interface will match and
     can disable these warnings.
@@ -71,7 +73,7 @@
 #pragma pop_macro("None")
 #endif
 
-#ifdef _WIN32
+#ifdef _MSC_VER
 #pragma warning(pop)
 #endif