diff --git a/Sources/TSCBasic/CMakeLists.txt b/Sources/TSCBasic/CMakeLists.txt index d8b85eaa..a1f5bcc2 100644 --- a/Sources/TSCBasic/CMakeLists.txt +++ b/Sources/TSCBasic/CMakeLists.txt @@ -52,6 +52,8 @@ add_library(TSCBasic misc.swift) target_compile_options(TSCBasic PUBLIC + # Don't use GNU strerror_r on Android. + "$<$:SHELL:-Xcc -U_GNU_SOURCE>" # Ignore secure function warnings on Windows. "$<$:SHELL:-Xcc -D_CRT_SECURE_NO_WARNINGS>") target_link_libraries(TSCBasic PRIVATE diff --git a/Sources/TSCBasic/misc.swift b/Sources/TSCBasic/misc.swift index d85dd096..58a302de 100644 --- a/Sources/TSCBasic/misc.swift +++ b/Sources/TSCBasic/misc.swift @@ -8,7 +8,6 @@ See http://swift.org/CONTRIBUTORS.txt for Swift project authors */ -@_implementationOnly import TSCclibc import TSCLibc import Foundation #if os(Windows) @@ -328,7 +327,7 @@ extension SystemError: CustomStringConvertible { var cap = 64 while cap <= 16 * 1024 { var buf = [Int8](repeating: 0, count: cap) - let err = TSCclibc.tsc_strerror_r(errno, &buf, buf.count) + let err = TSCLibc.strerror_r(errno, &buf, buf.count) if err == EINVAL { return "Unknown error \(errno)" } diff --git a/Sources/TSCclibc/CMakeLists.txt b/Sources/TSCclibc/CMakeLists.txt index d3c1e78e..bbeb1911 100644 --- a/Sources/TSCclibc/CMakeLists.txt +++ b/Sources/TSCclibc/CMakeLists.txt @@ -7,7 +7,7 @@ # See http://swift.org/CONTRIBUTORS.txt for Swift project authors add_library(TSCclibc STATIC - libc.c process.c strerror.c) + libc.c process.c) target_include_directories(TSCclibc PUBLIC include) target_compile_definitions(TSCclibc PRIVATE diff --git a/Sources/TSCclibc/include/module.modulemap b/Sources/TSCclibc/include/module.modulemap index e3ee9bc8..82bddc8e 100644 --- a/Sources/TSCclibc/include/module.modulemap +++ b/Sources/TSCclibc/include/module.modulemap @@ -2,6 +2,5 @@ module TSCclibc { header "TSCclibc.h" header "indexstore_functions.h" header "process.h" - header "strerror.h" export * } diff --git a/Sources/TSCclibc/include/strerror.h b/Sources/TSCclibc/include/strerror.h deleted file mode 100644 index ca03e2c5..00000000 --- a/Sources/TSCclibc/include/strerror.h +++ /dev/null @@ -1,5 +0,0 @@ -#include - -#ifndef _WIN32 -extern int tsc_strerror_r(int errnum, char *buf, size_t buflen); -#endif diff --git a/Sources/TSCclibc/strerror.c b/Sources/TSCclibc/strerror.c deleted file mode 100644 index 9dc082ad..00000000 --- a/Sources/TSCclibc/strerror.c +++ /dev/null @@ -1,9 +0,0 @@ -#undef _GNU_SOURCE -#include "strerror.h" -#include - -#ifndef _WIN32 -int tsc_strerror_r(int errnum, char *buf, size_t buflen) { - return strerror_r(errnum, buf, buflen); -} -#endif