From d7486637078a9ef6c446f35ad94d311efa429cf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Mon, 3 Jul 2023 14:34:21 +0200 Subject: [PATCH] Undef True/False in case they are defined and introduce some constexpr True/False to replace them. (#1610) --- snippets/defines.hpp | 11 +++++++++++ vulkan/vulkan.hpp | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/snippets/defines.hpp b/snippets/defines.hpp index 276272d..b680d1e 100644 --- a/snippets/defines.hpp +++ b/snippets/defines.hpp @@ -14,6 +14,17 @@ # undef MemoryBarrier #endif +// XLib.h defines True/False, which collides with our vk::True/vk::False +// -> undef them and provide some namepace-secure constexpr +#if defined( True ) +# undef True +constexpr int True = 1; +#endif +#if defined( False ) +# undef False +constexpr int False = 0; +#endif + #if defined(__GNUC__) # define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ ) #endif diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index 9272162..f0fd72b 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -140,6 +140,17 @@ static_assert( VK_HEADER_VERSION == 256, "Wrong VK_HEADER_VERSION!" ); # undef MemoryBarrier #endif +// XLib.h defines True/False, which collides with our vk::True/vk::False +// -> undef them and provide some namepace-secure constexpr +#if defined( True ) +# undef True +constexpr int True = 1; +#endif +#if defined( False ) +# undef False +constexpr int False = 0; +#endif + #if defined( __GNUC__ ) # define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ ) #endif