Skip to content

Commit 1a732e0

Browse files
authored
Merge pull request swiftlang#35140 from compnerd/inversion
shims: invert the condition and prefer the clang path
2 parents 211270c + 10b8ce5 commit 1a732e0

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

stdlib/public/SwiftShims/SwiftStddef.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,22 @@
1717
// result, using stddef.h here would pull in Darwin module (which includes
1818
// libc). This creates a dependency cycle, so we can't use stddef.h in
1919
// SwiftShims.
20+
//
2021
// On Linux, the story is different. We get the error message
2122
// "/usr/include/x86_64-linux-gnu/sys/types.h:146:10: error: 'stddef.h' file not
2223
// found"
2324
// This is a known Clang/Ubuntu bug.
24-
#if !defined(__APPLE__) && !defined(__linux__)
25+
//
26+
// On Windows, the complicated setup between clang and MSVC causes a cicular
27+
// dependency between `ucrt` and `SwiftShims`, preventing a successful build of
28+
// the module.
29+
//
30+
// Opt to use teh compiler vended type whenever possible.
31+
#if defined(__clang__)
32+
typedef __SIZE_TYPE__ __swift_size_t;
33+
#else
2534
#include <stddef.h>
2635
typedef size_t __swift_size_t;
27-
#else
28-
typedef __SIZE_TYPE__ __swift_size_t;
2936
#endif
3037

3138
// This selects the signed equivalent of the unsigned type chosen for size_t.

test/Serialization/autolinking-inlinable-inferred.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,11 @@ bfunc()
5555
// CHECK-NORMAL-SAME: [[PUBLIC:![0-9]+]],
5656
// CHECK-NORMAL-SAME: [[SWIFTONONESUPPORT:![0-9]+]],
5757
// CHECK-NORMAL-SAME: [[SWIFTCORE:![0-9]+]],
58-
// CHECK-NORMAL-windows-msvc-SAME: [[STDIO:![0-9]+]],
5958

6059
// This is the same set as the above, just in a different order due to a
6160
// different traversal of the transitive import graph.
6261
// CHECK-IMPL_ONLY-SAME: [[SWIFTONONESUPPORT:![0-9]+]],
6362
// CHECK-IMPL_ONLY-SAME: [[SWIFTCORE:![0-9]+]],
64-
// CHECK-IMPL_ONLY-windows-msvc-SAME: [[STDIO:![0-9]+]],
6563
// CHECK-IMPL_ONLY-SAME: [[MODULE:![0-9]+]],
6664
// CHECK-IMPL_ONLY-SAME: [[PUBLIC:![0-9]+]],
6765

@@ -77,7 +75,6 @@ bfunc()
7775
// CHECK-DAG: [[PUBLIC]] = !{!{{"-lautolinking_public"|"/DEFAULTLIB:autolinking_public.lib"}}}
7876
// CHECK-DAG: [[SWIFTONONESUPPORT]] = !{!{{"-lswiftSwiftOnoneSupport"|"/DEFAULTLIB:swiftSwiftOnoneSupport.lib"}}}
7977
// CHECK-DAG: [[SWIFTCORE]] = !{!{{"-lswiftCore"|"/DEFAULTLIB:swiftCore.lib"}}}
80-
// CHECK-windows-msvc-DAG: [[STDIO]] = !{!"/DEFAULTLIB:legacy_stdio_definitions.lib"}
8178
// CHECK-DAG: [[OTHER]] = !{!{{"-lautolinking_other"|"/DEFAULTLIB:autolinking_other.lib"}}}
8279
// CHECK-DAG: [[OTHER2]] = !{!{{"-lautolinking_other2"|"/DEFAULTLIB:autolinking_other2.lib"}}}
8380
// CHECK-DAG: [[OBJC]] = !{!{{"-lobjc"|"/DEFAULTLIB:objc.lib"}}}

0 commit comments

Comments
 (0)