vk_sdk_platform.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //
  2. // File: vk_sdk_platform.h
  3. //
  4. /*
  5. * Copyright (c) 2015-2023 LunarG, Inc.
  6. * Copyright (c) 2015-2023 The Khronos Group Inc.
  7. * Copyright (c) 2015-2023 Valve Corporation
  8. *
  9. * Licensed under the Apache License, Version 2.0 (the "License");
  10. * you may not use this file except in compliance with the License.
  11. * You may obtain a copy of the License at
  12. *
  13. * http://www.apache.org/licenses/LICENSE-2.0
  14. *
  15. * Unless required by applicable law or agreed to in writing, software
  16. * distributed under the License is distributed on an "AS IS" BASIS,
  17. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18. * See the License for the specific language governing permissions and
  19. * limitations under the License.
  20. */
  21. #pragma once
  22. // Allow users to suppress warnings generated by this header file by defining VK_SDK_PLATFORM_SUPRRESS_DEPRECATION_WARNING
  23. #ifndef VK_SDK_PLATFORM_SUPRRESS_DEPRECATION_WARNING
  24. #if defined(__GNUC__) && __GNUC__ >= 4
  25. #warning "vk_sdk_platform.h is deprecated and will be removed in future release! Use VK_SDK_PLATFORM_SUPRRESS_DEPRECATION_WARNING to suppress warning!"
  26. #endif
  27. // MSVC doesn't support warning directive
  28. #if defined(_MSC_VER)
  29. #pragma message("vk_sdk_platform.h is deprecated and will be removed in future release! Use VK_SDK_PLATFORM_SUPRRESS_DEPRECATION_WARNING to suppress warning!")
  30. #endif
  31. #endif
  32. #if defined(_WIN32)
  33. #ifndef NOMINMAX
  34. #define NOMINMAX
  35. #endif
  36. #ifndef __cplusplus
  37. #undef inline
  38. #define inline __inline
  39. #endif // __cplusplus
  40. #if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/)
  41. // C99:
  42. // Microsoft didn't implement C99 in Visual Studio; but started adding it with
  43. // VS2013. However, VS2013 still didn't have snprintf(). The following is a
  44. // work-around (Note: The _CRT_SECURE_NO_WARNINGS macro must be set in the
  45. // "CMakeLists.txt" file).
  46. // NOTE: This is fixed in Visual Studio 2015.
  47. #define snprintf _snprintf
  48. #endif
  49. #define strdup _strdup
  50. #endif // _WIN32
  51. // Check for noexcept support using clang, with fallback to Windows or GCC version numbers
  52. #ifndef NOEXCEPT
  53. #if defined(__clang__)
  54. #if __has_feature(cxx_noexcept)
  55. #define HAS_NOEXCEPT
  56. #endif
  57. #else
  58. #if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ * 10 + __GNUC_MINOR__ >= 46
  59. #define HAS_NOEXCEPT
  60. #else
  61. #if defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026 && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS
  62. #define HAS_NOEXCEPT
  63. #endif
  64. #endif
  65. #endif
  66. #ifdef HAS_NOEXCEPT
  67. #define NOEXCEPT noexcept
  68. #else
  69. #define NOEXCEPT
  70. #endif
  71. #endif