diff --git a/flang/runtime/CMakeLists.txt b/flang/runtime/CMakeLists.txt --- a/flang/runtime/CMakeLists.txt +++ b/flang/runtime/CMakeLists.txt @@ -50,7 +50,6 @@ include(CheckCXXSymbolExists) include(CheckCXXSourceCompiles) -check_cxx_symbol_exists(strerror string.h HAVE_STRERROR) check_cxx_symbol_exists(strerror_r string.h HAVE_STRERROR_R) # Can't use symbol exists here as the function is overloaded in C++ check_cxx_source_compiles( @@ -69,10 +68,6 @@ set(NO_LTO_FLAGS "") endif() -if (NOT (HAVE_STRERROR OR HAVE_STRERROR_R OR HAVE_DECL_STRERROR_S)) - message(FATAL_ERROR "None of strerror, strerror_r, strerror_s found.") -endif() - configure_file(config.h.cmake config.h) # include_directories is used here instead of target_include_directories # because add_flang_library creates multiple objects (STATIC/SHARED, OBJECT) diff --git a/flang/runtime/io-error.cpp b/flang/runtime/io-error.cpp --- a/flang/runtime/io-error.cpp +++ b/flang/runtime/io-error.cpp @@ -122,14 +122,11 @@ #endif #elif HAVE_DECL_STRERROR_S // "Windows Secure API" ok = ::strerror_s(buffer, bufferLength, ioStat_) == 0; -#elif HAVE_STRERROR +#else // Copy the thread un-safe result of strerror into // the buffer as fast as possible to minimize impact // of collision of strerror in multiple threads. msg = strerror(ioStat_); -#else - // Strange that this system doesn't even have strerror - return false; #endif if (msg) { ToFortranDefaultCharacter(buffer, bufferLength, msg); diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -299,7 +299,6 @@ check_symbol_exists(posix_spawn spawn.h HAVE_POSIX_SPAWN) check_symbol_exists(pread unistd.h HAVE_PREAD) check_symbol_exists(sbrk unistd.h HAVE_SBRK) -check_symbol_exists(strerror string.h HAVE_STRERROR) check_symbol_exists(strerror_r string.h HAVE_STRERROR_R) check_symbol_exists(strerror_s string.h HAVE_DECL_STRERROR_S) check_symbol_exists(setenv stdlib.h HAVE_SETENV) diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake --- a/llvm/include/llvm/Config/config.h.cmake +++ b/llvm/include/llvm/Config/config.h.cmake @@ -176,9 +176,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SIGNAL_H ${HAVE_SIGNAL_H} -/* Define to 1 if you have the `strerror' function. */ -#cmakedefine HAVE_STRERROR ${HAVE_STRERROR} - /* Define to 1 if you have the `strerror_r' function. */ #cmakedefine HAVE_STRERROR_R ${HAVE_STRERROR_R} diff --git a/llvm/lib/Support/Errno.cpp b/llvm/lib/Support/Errno.cpp --- a/llvm/lib/Support/Errno.cpp +++ b/llvm/lib/Support/Errno.cpp @@ -55,17 +55,11 @@ #elif HAVE_DECL_STRERROR_S // "Windows Secure API" strerror_s(buffer, MaxErrStrLen - 1, errnum); str = buffer; -#elif defined(HAVE_STRERROR) +#else // Copy the thread un-safe result of strerror into // the buffer as fast as possible to minimize impact // of collision of strerror in multiple threads. str = strerror(errnum); -#else - // Strange that this system doesn't even have strerror - // but, oh well, just use a generic message - raw_string_ostream stream(str); - stream << "Error #" << errnum; - stream.flush(); #endif return str; } diff --git a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn --- a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn @@ -99,7 +99,6 @@ "HAVE_LIBPSAPI=", "HAVE_MALLCTL=", "HAVE_SIGNAL_H=1", - "HAVE_STRERROR=1", "HAVE_SYS_STAT_H=1", "HAVE_SYS_TYPES_H=1", "HAVE_VALGRIND_VALGRIND_H=", diff --git a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h --- a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h +++ b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h @@ -189,9 +189,6 @@ /* Define to 1 if you have the header file. */ #define HAVE_SIGNAL_H 1 -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - /* Define to 1 if you have the `strerror_r' function. */ /* HAVE_STRERROR_R defined in Bazel */ diff --git a/utils/bazel/llvm_configs/config.h.cmake b/utils/bazel/llvm_configs/config.h.cmake --- a/utils/bazel/llvm_configs/config.h.cmake +++ b/utils/bazel/llvm_configs/config.h.cmake @@ -176,9 +176,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SIGNAL_H ${HAVE_SIGNAL_H} -/* Define to 1 if you have the `strerror' function. */ -#cmakedefine HAVE_STRERROR ${HAVE_STRERROR} - /* Define to 1 if you have the `strerror_r' function. */ #cmakedefine HAVE_STRERROR_R ${HAVE_STRERROR_R}