diff --git a/stdlib/public/Platform/ucrt.modulemap b/stdlib/public/Platform/ucrt.modulemap index 68bcbfeddfeec..ad440863ad8c6 100644 --- a/stdlib/public/Platform/ucrt.modulemap +++ b/stdlib/public/Platform/ucrt.modulemap @@ -10,16 +10,13 @@ // //===----------------------------------------------------------------------===// +module _complex [system] { + header "complex.h" + export * +} + module ucrt [system] { module C { - module complex { - /* disallow the header in C++ mode as it forwards to `ccomplex`. */ - requires !cplusplus - - header "complex.h" - export * - } - module ctype { header "ctype.h" export * diff --git a/stdlib/public/Platform/ucrt.swift b/stdlib/public/Platform/ucrt.swift index 80181db44d5cf..09eaf11c9ab3d 100644 --- a/stdlib/public/Platform/ucrt.swift +++ b/stdlib/public/Platform/ucrt.swift @@ -11,6 +11,8 @@ //===----------------------------------------------------------------------===// @_exported import ucrt // Clang module +// Extra clang module that's split out from ucrt: +@_exported import _complex @available(swift, deprecated: 3.0, message: "Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting.") public let M_PI = Double.pi diff --git a/test/Interop/Cxx/stdlib/foundation-and-std-module.swift b/test/Interop/Cxx/stdlib/foundation-and-std-module.swift index 8dcc93b45c710..29d05d94e1462 100644 --- a/test/Interop/Cxx/stdlib/foundation-and-std-module.swift +++ b/test/Interop/Cxx/stdlib/foundation-and-std-module.swift @@ -3,14 +3,12 @@ // RUN: %target-swift-frontend %s -c -enable-experimental-cxx-interop -Xcc -std=c++17 -Xcc -fmodules-cache-path=%t // RUN: %target-swift-frontend %s -c -enable-experimental-cxx-interop -Xcc -std=c++20 -Xcc -fmodules-cache-path=%t -// RUN: find %t | %FileCheck %s - // RUN: %empty-directory(%t) // RUN: %target-swift-frontend %s -c -enable-experimental-cxx-interop -Xcc -std=c++17 -Xcc -fmodules-cache-path=%t -DADD_CXXSTDLIB // RUN: %target-swift-frontend %s -c -enable-experimental-cxx-interop -Xcc -std=c++20 -Xcc -fmodules-cache-path=%t -DADD_CXXSTDLIB -// REQUIRES: OS=macosx || OS=linux-gnu +// RUN: %{python} -c "import os, glob; print('\n'.join(glob.glob(os.path.join('%/t', '**', '*.pcm'), recursive=True)))" | %FileCheck %s #if canImport(Foundation) import Foundation diff --git a/test/stdlib/CRTWinAPIs.swift b/test/stdlib/CRTWinAPIs.swift new file mode 100644 index 0000000000000..07e8fb54054c7 --- /dev/null +++ b/test/stdlib/CRTWinAPIs.swift @@ -0,0 +1,12 @@ +// RUN: %target-typecheck-verify-swift +// REQUIRES: OS=windows-msvc + +// This file has CRT-specific C stdlib tests, that use +// some APIs present only in CRT. + +import CRT + +func complexFunctionsAvailableInSwift() { + let complexValue = _Cbuild(1.0, 2.0) // Construct a complex double using MSVC-specific API. + let _ = creal(complexValue) +}