mirror of
https://github.com/rui314/mold.git
synced 2024-10-05 00:57:08 +03:00
4fc27d2195
Otherwise fails with: /usr/include/c++/v1/__threading_support:370:43: error: use of undeclared identifier 'PTHREAD_MUTEX_RECURSIVE' 200809L triggers __USE_XOPEN2K8 to be defined which enables pthread.h to define the missing identifier. Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
21 lines
426 B
C++
21 lines
426 B
C++
// GNU's strerror_r is different from POSIX's strerror_r.
|
|
// In this file, we explicitly undefine _GNU_SOURCE to always
|
|
// use the POSIX version.
|
|
|
|
#define _POSIX_C_SOURCE 200809L
|
|
#undef _GNU_SOURCE
|
|
|
|
#include <cstring>
|
|
#include <errno.h>
|
|
#include <string_view>
|
|
|
|
namespace mold {
|
|
|
|
std::string_view errno_string() {
|
|
static thread_local char buf[200];
|
|
strerror_r(errno, buf, sizeof(buf));
|
|
return buf;
|
|
}
|
|
|
|
} // namespace mold
|