Commit Graph

29 Commits

Author SHA1 Message Date
Saleem Abdulrasool
f1d973b410 Windows: mark some constants as @inlinable
These constants should be freely inlined as they are simply casts or
redeclarations of macros which are not importable due to the "complex"
nature of them (they involve casts or otherwise non-integral constants).
2025-02-21 09:31:36 -08:00
Saleem Abdulrasool
fe2f410fb8 Windows: excise bits of WinSDK overlay
Conditionalise some of the conformances of `WindowsBool` to not be
available without reflection or on embedded. This matches how
`DarwinBoolean` is handled.
2025-02-21 09:31:36 -08:00
Saleem Abdulrasool
e4388c1597 Windows: adjust Swift style in WinSDK (NFC)
This cleans up the style to match Swift's style.
2025-02-21 09:31:36 -08:00
Saleem Abdulrasool
490c528104 Windows: add some defines from WinUser.h
Add the windows message queue status flags macros.  This should allow
the use of the macros when writing Windows code.
2023-06-12 07:34:36 -07:00
Egor Zhdan
07c723a6a5 WinSDK: explicitly re-export ucrt
ucrt symbols are already implicitly available after an `import WinSDK` statement, however, WinSDK generated Swift interface does not indicate that.

Besides, WinSDK Swift overlay uses `time_t` in its public interface, which is declared in ucrt, but there is no corresponding import statement.

This change adds the import statement, to make the dependencies & exports more clear for the users, and to help with IDE integration.
2021-01-10 17:53:19 +03:00
Saleem Abdulrasool
b228e17e4c WinSDK: use computed properties more aggressively
Rather than stored properties for constants that are not imported via
the clang importer, use computed properties.  Although this breaks ABI,
there is no guarantee of ABI stability on Windows.  The remaining
strings are left as stored properties as they may be interned by the
system.
2020-12-26 10:57:53 -08:00
Saleem Abdulrasool
9fb793431f WinSDK: adjust for 32-bit builds
Due to the type differences between 32-bit and 64-bit, the SDK overlay
would fail to build on Windows.  This adjusts that to allow building the
SDK overlay on 32-bit Windows again.
2020-12-08 13:31:10 -08:00
Saleem Abdulrasool
bf9ae4bb25 Platform: add RichEdit to modulemap
Add RichEdit to the module map file for WinSDK.
2020-05-25 18:26:53 -07:00
Saleem Abdulrasool
66b4c9ae7b WinSDK: add some more constants to the overlay
The WinReg.h constants for the register hives are not imported through
the clang importer due to the complicated casting.  Duplicate the values
to allow usage in Swift.
2020-04-22 11:44:49 -07:00
Saleem Abdulrasool
24617651e5 WinSDK: add some constants for the SDK overlay
Unfortunately, the types are not imported through the clang importer.
Add them to the overlay for use in applications.
2020-04-12 16:08:47 -07:00
Alex Langford
184d942ba0 [CMake] add_swift_target_library shouldn't implicitly set INSTALL_IN_TARGET
This makes it more explicit what the install component of a target
library is if you don't see one (and its marked as IS_SDK_OVERLAY).
Explicit in this case makes more sense, as you don't have to rely on
knowledge of how `add_swift_target_library` is implemented to understand
what component is used to install the target.
2019-08-02 13:51:52 -07:00
Puyan Lotfi
6691fda8ec Appending SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS to SWIFT_COMPILE_FLAGS.
There are situations where you want to build against a libc that is out
of tree or that is not the system libc (Or for cross build scenarios).
This is a change for passing the -sdk and include paths for things like
this.
2019-07-01 09:43:47 -07:00
Saleem Abdulrasool
b8dbd9f667 Windows: replace @_fixed_layout with @frozen
Address warning that `@_fixed_layout` has been replaced with `@frozen`.
2019-06-30 15:04:11 -07:00
Gwen Mittertreiner
2a76bcb032 Add WinSDK constants to get Symlink Information
Added FSCTL_GET_REPARSE_POINT, FSCTL_SET_REPARSE_POINT,
FSCTL_DELETE_REPARSE_POINT to allow manipulation of reparse points via
DeviceIoControl
2019-06-10 14:12:31 -07:00
Saleem Abdulrasool
8047351375 WinSDK: correct FIONBIO 2019-05-06 17:24:21 -07:00
Saleem Abdulrasool
83b290438c Windows: bridge BOOL to Bool
This allows the conversion of the Windows `BOOL` type to be converted to
`Bool` implicitly.  The implicit bridging allows for a more ergonomic
use of the native Windows APIs in Swift.

Due to the ambiguity between the Objective C `BOOL` and the Windows
`BOOL`, we must manually map the `BOOL` type to the appropriate type.
This required lifting the mapping entry for `ObjCBool` from the mapped
types XMACRO definition into the inline definition in the importer.

Take the opportunity to simplify the mapping code.

Adjust the standard library usage of the `BOOL` type which is now
eclipsed by the new `WindowsBool` type, preferring to use `Bool`
whenever possible.

Thanks to Jordan Rose for the suggestion to do this and a couple of
hints along the way.
2019-04-25 17:52:08 -07:00
Saleem Abdulrasool
5d2be1acc7 Windows: expose ConsoleAPI
This exposes the Windows 10 ConsoleAPI from the module.
2019-04-20 17:02:09 -07:00
Gwen Mittertreiner
47517ab544 Add Std Handle Values to WinSDK
Added the values of STD_*_HANDLE to WinSDK for use with GetStdHandle
2019-04-18 16:56:07 -07:00
Saleem Abdulrasool
4473b7464c WinSDK: add convenience conversions for FILETIME/time_t
This conversion is error prone and pretty common.  Provide a helper
initializer and conversion through a getter.
2019-03-15 16:16:56 -07:00
Saleem Abdulrasool
14d771436c WinSDK: add some constants from CommCtrl
This exposes the common control window class name constants to the Swift
side enabling the use of these constants to create Windows.
2019-03-10 21:23:59 -07:00
Saleem Abdulrasool
0e7ff6582a WinSDK: add CW_USEDEFAULT to the SDK overlay 2019-03-10 18:34:24 -07:00
Saleem Abdulrasool
52054d2443 WinSDK: overwrite INVALID_FILE_ATTRIBUTES
`INVALID_FILE_ATTRIBUTES` is imported as a signed value which will
overflow the unsigned usage.  Explicitly create it in the SDK overlay.
2019-03-07 13:30:47 -08:00
Saleem Abdulrasool
6e768e0998 WIndows: add an explicit cast
The constant value is imported as an unsigned value which means that we
cannot or the values together.  Add an explicit cast.
2019-02-20 09:44:19 -08:00
Saleem Abdulrasool
ed4cf1a1b9 Windows: add a couple of constants to WinSDK
Add some WinUser.h (User32) constants to WinSDK to make it easier to use
the WinSDK for more purposes (e.g. SwiftWin32).
2019-02-20 07:46:21 -08:00
Saleem Abdulrasool
cde0c32919 Windows: add some WinSock2 constants
This is the bare minimum of the WinSock2 constants that are needed for
the Foundation port to Windows which uses the socket APIs for
`-[NSTask run]` internal signalling.
2019-02-12 23:01:18 -08:00
Saleem Abdulrasool
6c642859ce stdlib: better type for WinSDK constant
Alter the constant type for the FileOperationFlag type.  This allows the
type system check the paramter type better.
2019-01-08 22:40:26 -08:00
Saleem Abdulrasool
3bd86ab18b Windows: add FOF_NO_UI into the overlay
This constant is needed for SHFileOperation which is needed for
Foundation.  Unfortunately, it is a complex macro which will not be
imported by the ClangImporter.
2019-01-07 19:04:04 -08:00
Saleem Abdulrasool
362235c166 WindowsSDK: add definition for INVALID_HANDLE_VALUE
Since handle's are so common place on Windows and the clang importer cannot
import the complex macro for INVALID_HANDLE_VALUE, define it locally to provide
an easier path to writing swift code on Windows.  This repairs the Windows
builds.
2018-12-21 09:18:12 -08:00
Saleem Abdulrasool
84e94f563c SDK: add SDK overlay for Windows
Introduce a WinSDK overlay for Windows.  This allows us to define some
shared constants that are not correctly imported right now.  This cleans
up the logic in the swift side of things and aids in the bring up.

Now that we have a SDK overlay for Windows, we should structure the tree
according to the OS family.
2018-11-30 16:55:42 -08:00