Without the #else clauses, any OS or CPU architecture not already listed causes a build failure. This already occurs in Xcode 12.2b3 when it attempts to build an arm64_32 architecture slice for watchOS - and of course, Windows is not listed as an OS platform (I didn't try building there, but it'd certainly be interesting!).
Unfortunately, many of the newer OS names (Windows, Android, WASI, etc.) did not appear until Swift 5.2 and 5.3. Worse, sometimes CPU architecture names are not available in every toolchain, even for the same Swift version - the aforementioned arm64_32 variant is not present in Swift's source code, for example, and is presumably restricted to Xcode's built-in toolchain at the present time.
As a result, it is counterproductive to add additional conditions, since they'd just cause different build failures elsewhere, so this PR only adds the fallback cases. ProcessInfo's operatingSystemVersionString property will begin providing much more robust output than it does in its present form in a future Swift release, probably the next minor update; it can then replace and improve upon the current use of platform conditionals and manually rendering the OS' version string.
Without the
#else
clauses, any OS or CPU architecture not already listed causes a build failure. This already occurs in Xcode 12.2b3 when it attempts to build anarm64_32
architecture slice for watchOS - and of course, Windows is not listed as an OS platform (I didn't try building there, but it'd certainly be interesting!).Unfortunately, many of the newer OS names (Windows, Android, WASI, etc.) did not appear until Swift 5.2 and 5.3. Worse, sometimes CPU architecture names are not available in every toolchain, even for the same Swift version - the aforementioned
arm64_32
variant is not present in Swift's source code, for example, and is presumably restricted to Xcode's built-in toolchain at the present time.As a result, it is counterproductive to add additional conditions, since they'd just cause different build failures elsewhere, so this PR only adds the fallback cases.
ProcessInfo
'soperatingSystemVersionString
property will begin providing much more robust output than it does in its present form in a future Swift release, probably the next minor update; it can then replace and improve upon the current use of platform conditionals and manually rendering the OS' version string.