From 9a42b83e4cb9140cd7f716c2a17473a8d287b04a Mon Sep 17 00:00:00 2001 From: Sharadh Rajaraman Date: Fri, 26 Jul 2024 12:41:02 +0100 Subject: [PATCH] Unconditionally use `import std` with C++23 --- VulkanHppGenerator.cpp | 9 --------- snippets/includes.hpp | 3 +++ snippets/macros.hpp | 2 +- tests/CppStdModule/CMakeLists.txt | 2 -- vulkan/vulkan.cppm | 9 --------- vulkan/vulkan.hpp | 3 +++ vulkan/vulkan_hpp_macros.hpp | 2 +- 7 files changed, 8 insertions(+), 22 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index abec5c16e..ff83b1cec 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -794,15 +794,6 @@ void VulkanHppGenerator::generateCppModuleFile() const module; -// clang-format off -#include -// clang-format on - -#if defined( VULKAN_HPP_STD_MODULE ) -import VULKAN_HPP_STD_MODULE; -import VULKAN_HPP_STD_COMPAT_MODULE; -#endif - #include #include #include diff --git a/snippets/includes.hpp b/snippets/includes.hpp index 34d43ec26..8a66239fa 100644 --- a/snippets/includes.hpp +++ b/snippets/includes.hpp @@ -6,6 +6,9 @@ # include // strnlen # include // std::string # include // std::exchange +#else +import VULKAN_HPP_STD_MODULE; +import VULKAN_HPP_STD_COMPAT_MODULE; #endif #include diff --git a/snippets/macros.hpp b/snippets/macros.hpp index 2c9d4604b..a3cb02cd3 100644 --- a/snippets/macros.hpp +++ b/snippets/macros.hpp @@ -77,7 +77,7 @@ # define VULKAN_HPP_SUPPORT_SPAN #endif -#if !defined( VULKAN_HPP_STD_MODULE ) && ( 23 <= VULKAN_HPP_CPP_VERSION ) && defined( __cpp_lib_modules ) && defined( VULKAN_HPP_ENABLE_STD_MODULE ) +#if ( 23 <= VULKAN_HPP_CPP_VERSION ) && defined( __cpp_lib_modules ) && !defined( VULKAN_HPP_STD_MODULE ) # define VULKAN_HPP_STD_MODULE std # define VULKAN_HPP_STD_COMPAT_MODULE std.compat #endif diff --git a/tests/CppStdModule/CMakeLists.txt b/tests/CppStdModule/CMakeLists.txt index 79e3d8cc4..95b9fb6ab 100644 --- a/tests/CppStdModule/CMakeLists.txt +++ b/tests/CppStdModule/CMakeLists.txt @@ -1,7 +1,5 @@ cmake_minimum_required( VERSION 3.30 ) -set(CMAKE_CXX_MODULE_STD ON) - target_compile_features( VulkanHppModule PUBLIC cxx_std_23 ) target_compile_definitions( VulkanHppModule PUBLIC VULKAN_HPP_ENABLE_STD_MODULE ) diff --git a/vulkan/vulkan.cppm b/vulkan/vulkan.cppm index 3ebe1ab49..b4db70abd 100644 --- a/vulkan/vulkan.cppm +++ b/vulkan/vulkan.cppm @@ -10,15 +10,6 @@ module; -// clang-format off -#include -// clang-format on - -#if defined( VULKAN_HPP_STD_MODULE ) -import VULKAN_HPP_STD_MODULE; -import VULKAN_HPP_STD_COMPAT_MODULE; -#endif - #include #include #include diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index 5be194e41..8af8f5139 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -16,6 +16,9 @@ # include // strnlen # include // std::string # include // std::exchange +#else +import VULKAN_HPP_STD_MODULE; +import VULKAN_HPP_STD_COMPAT_MODULE; #endif #include diff --git a/vulkan/vulkan_hpp_macros.hpp b/vulkan/vulkan_hpp_macros.hpp index ddc70a154..a59bda421 100644 --- a/vulkan/vulkan_hpp_macros.hpp +++ b/vulkan/vulkan_hpp_macros.hpp @@ -87,7 +87,7 @@ # define VULKAN_HPP_SUPPORT_SPAN #endif -#if !defined( VULKAN_HPP_STD_MODULE ) && ( 23 <= VULKAN_HPP_CPP_VERSION ) && defined( __cpp_lib_modules ) && defined( VULKAN_HPP_ENABLE_STD_MODULE ) +#if ( 23 <= VULKAN_HPP_CPP_VERSION ) && defined( __cpp_lib_modules ) && !defined( VULKAN_HPP_STD_MODULE ) # define VULKAN_HPP_STD_MODULE std # define VULKAN_HPP_STD_COMPAT_MODULE std.compat #endif