diff --git a/CMakeLists.txt b/CMakeLists.txt index 92687aba..fa7037e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,10 +25,15 @@ target_sources(msft_proxy TYPE HEADERS BASE_DIRS include FILES + include/proxy.h include/proxy/proxy.h include/proxy/proxy_macros.h include/proxy/proxy_fmt.h include/proxy/proxy.ixx + include/proxy/v3/proxy.h + include/proxy/v4/proxy.h + include/proxy/v4/proxy_macros.h + include/proxy/v4/proxy_fmt.h ) target_compile_features(msft_proxy INTERFACE cxx_std_20) diff --git a/include/proxy.h b/include/proxy.h new file mode 100644 index 00000000..98cd07b4 --- /dev/null +++ b/include/proxy.h @@ -0,0 +1,23 @@ +// Compatibility header for Proxy 3. + +#ifndef _MSFT_PROXY_3_COMPAT_ +#define _MSFT_PROXY_3_COMPAT_ + +#include "proxy/v3/proxy.h" // IWYU pragma: export + +#warning `#include "proxy.h"` is deprecated starting with Proxy 4. \ +Use `#include ` to access the latest Proxy APIs. \ + \ +Note: To access the old Proxy 3 APIs, use `#include `. + +namespace pro { using namespace pro::v3; } + +#if defined(PRO_4_DEF_MEM_DISPATCH) +#warning Proxy 3 compatibility header should not be included when a later version of Proxy is also included. +#else +#define PRO_DEF_MEM_DISPATCH(name, ...) PRO_3_DEF_MEM_DISPATCH(name, __VA_ARGS__) +#define PRO_DEF_FREE_DISPATCH(name, ...) PRO_3_DEF_FREE_DISPATCH(name, __VA_ARGS__) +#define PRO_DEF_FREE_AS_MEM_DISPATCH(name, ...) PRO_3_DEF_FREE_AS_MEM_DISPATCH(name, __VA_ARGS__) +#endif + +#endif // _MSFT_PROXY_3_COMPAT_ diff --git a/include/proxy/proxy.h b/include/proxy/proxy.h index c3697d94..6447445c 100644 --- a/include/proxy/proxy.h +++ b/include/proxy/proxy.h @@ -1,2381 +1,2 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -#ifndef _MSFT_PROXY_ -#define _MSFT_PROXY_ - -#include "proxy_macros.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if __STDC_HOSTED__ -#include -#if __has_include() -#include -#endif // __has_include() -#endif // __STDC_HOSTED__ - -#if __cpp_rtti >= 199711L -#include -#include -#endif // __cpp_rtti >= 199711L - -#if __has_cpp_attribute(msvc::no_unique_address) -#define ___PRO_NO_UNIQUE_ADDRESS_ATTRIBUTE msvc::no_unique_address -#elif __has_cpp_attribute(no_unique_address) -#define ___PRO_NO_UNIQUE_ADDRESS_ATTRIBUTE no_unique_address -#else -#error Proxy requires C++20 attribute no_unique_address. -#endif - -#if __cpp_exceptions >= 199711L -#define ___PRO_THROW(...) throw __VA_ARGS__ -#else -#define ___PRO_THROW(...) std::abort() -#endif // __cpp_exceptions >= 199711L - -namespace pro { - -namespace details { - -struct applicable_traits { static constexpr bool applicable = true; }; -struct inapplicable_traits { static constexpr bool applicable = false; }; - -template