diff --git a/libcxx/include/__new/new_handler.h b/libcxx/include/__new/new_handler.h index 05f4e846c3ef9..2350f9ae9bc19 100644 --- a/libcxx/include/__new/new_handler.h +++ b/libcxx/include/__new/new_handler.h @@ -17,6 +17,11 @@ #if defined(_LIBCPP_ABI_VCRUNTIME) # include +// does not define 'get_new_handler' +// which makes the 'std' module build fail, this fixes it +namespace std { +_LIBCPP_EXPORTED_FROM_ABI new_handler get_new_handler() _NOEXCEPT; +} #else _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD typedef void (*new_handler)(); diff --git a/libcxx/modules/std.compat/ctime.inc b/libcxx/modules/std.compat/ctime.inc index eba8234a08969..7547b055b6807 100644 --- a/libcxx/modules/std.compat/ctime.inc +++ b/libcxx/modules/std.compat/ctime.inc @@ -14,15 +14,17 @@ export { using ::timespec _LIBCPP_USING_IF_EXISTS; using ::tm _LIBCPP_USING_IF_EXISTS; - using ::asctime _LIBCPP_USING_IF_EXISTS; using ::clock _LIBCPP_USING_IF_EXISTS; + using ::strftime _LIBCPP_USING_IF_EXISTS; + +#ifndef _LIBCPP_ABI_VCRUNTIME using ::ctime _LIBCPP_USING_IF_EXISTS; using ::difftime _LIBCPP_USING_IF_EXISTS; using ::gmtime _LIBCPP_USING_IF_EXISTS; using ::localtime _LIBCPP_USING_IF_EXISTS; using ::mktime _LIBCPP_USING_IF_EXISTS; - using ::strftime _LIBCPP_USING_IF_EXISTS; using ::time _LIBCPP_USING_IF_EXISTS; using ::timespec_get _LIBCPP_USING_IF_EXISTS; +#endif } // export diff --git a/libcxx/modules/std.cppm.in b/libcxx/modules/std.cppm.in index 984b18321923c..80a8ef9eb41a2 100644 --- a/libcxx/modules/std.cppm.in +++ b/libcxx/modules/std.cppm.in @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +#ifdef _LIBCPP_ABI_VCRUNTIME +#define _BUILD_STD_MODULE +#endif + // WARNING, this entire header is generated by // utils/generate_libcxx_cppm_in.py // DO NOT MODIFY! diff --git a/libcxx/modules/std/ctime.inc b/libcxx/modules/std/ctime.inc index 5bfa61917e5f2..e9f8ecb6ec63e 100644 --- a/libcxx/modules/std/ctime.inc +++ b/libcxx/modules/std/ctime.inc @@ -14,15 +14,17 @@ export namespace std { using std::timespec _LIBCPP_USING_IF_EXISTS; using std::tm _LIBCPP_USING_IF_EXISTS; - using std::asctime _LIBCPP_USING_IF_EXISTS; using std::clock _LIBCPP_USING_IF_EXISTS; + using std::strftime _LIBCPP_USING_IF_EXISTS; + +#ifndef _LIBCPP_ABI_VCRUNTIME using std::ctime _LIBCPP_USING_IF_EXISTS; using std::difftime _LIBCPP_USING_IF_EXISTS; using std::gmtime _LIBCPP_USING_IF_EXISTS; using std::localtime _LIBCPP_USING_IF_EXISTS; using std::mktime _LIBCPP_USING_IF_EXISTS; - using std::strftime _LIBCPP_USING_IF_EXISTS; using std::time _LIBCPP_USING_IF_EXISTS; using std::timespec_get _LIBCPP_USING_IF_EXISTS; +#endif } // namespace std diff --git a/libcxx/utils/generate_libcxx_cppm_in.py b/libcxx/utils/generate_libcxx_cppm_in.py index 39076a61b55b8..9cba0b3b8842d 100644 --- a/libcxx/utils/generate_libcxx_cppm_in.py +++ b/libcxx/utils/generate_libcxx_cppm_in.py @@ -13,7 +13,7 @@ def write_file(module): - with open(libcxx_root / "modules" / f"{module}.cppm.in", "w") as module_cpp_in: + with open(libcxx_root / "modules" / f"{module}.cppm.in", "w", encoding='utf-8') as module_cpp_in: module_cpp_in.write( """\ // -*- C++ -*- @@ -25,6 +25,10 @@ def write_file(module): // //===----------------------------------------------------------------------===// +#ifdef _LIBCPP_ABI_VCRUNTIME +#define _BUILD_STD_MODULE +#endif + // WARNING, this entire header is generated by // utils/generate_libcxx_cppm_in.py // DO NOT MODIFY!