Skip to content

Commit e727d1a

Browse files
authored
Keep libtool from complaining about ExecutablePath.cpp being empty. (#1402)
On non-OpenBSD (so, everywhere), libtool complains that ExecutablePath.cpp is empty. Silence it by providing a dummy symbol. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent 6a52f30 commit e727d1a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Sources/_TestingInternals/ExecutablePath.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ static void captureEarlyCWD(void) {
2929
earlyCWD.store(buffer);
3030
}
3131
}
32+
#endif
3233

3334
const char *swt_getEarlyCWD(void) {
35+
#if defined(__OpenBSD__)
3436
return earlyCWD.load();
35-
}
37+
#else
38+
return nullptr;
3639
#endif
40+
}

Sources/_TestingInternals/include/ExecutablePath.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616

1717
SWT_ASSUME_NONNULL_BEGIN
1818

19-
#if defined(__OpenBSD__)
2019
/// Get the current working directory as it was set shortly after the process
2120
/// started and before `main()` has been called.
2221
///
2322
/// This function is necessary on OpenBSD so that we can (as correctly as
2423
/// possible) resolve the executable path when the first argument is a relative
2524
/// path (which can occur when manually invoking the test executable.)
25+
///
26+
/// On all other platforms, this function always returns `nullptr`.
2627
SWT_EXTERN const char *_Nullable swt_getEarlyCWD(void);
27-
#endif
2828

2929
SWT_ASSUME_NONNULL_END
3030

0 commit comments

Comments
 (0)