forked from mirrors/gecko-dev
Bug 1871006 - cherry-pick abseil-cpp #1553 to fix OpenBSD builds. r=ng,webrtc-reviewers
Cherry-picks https://github.com/abseil/abseil-cpp/pull/1553 We should uplift this to beta and release. Differential Revision: https://phabricator.services.mozilla.com/D197102
This commit is contained in:
parent
74842df880
commit
6f4660e677
1 changed files with 6 additions and 9 deletions
|
|
@ -56,8 +56,7 @@
|
|||
// ABSL_HAVE_SYSCALL_WRITE is defined when the platform provides the syscall
|
||||
// syscall(SYS_write, /*int*/ fd, /*char* */ buf, /*size_t*/ len);
|
||||
// for low level operations that want to avoid libc.
|
||||
#if (defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)) && \
|
||||
!defined(__ANDROID__)
|
||||
#if (defined(__linux__) || defined(__FreeBSD__)) && !defined(__ANDROID__)
|
||||
#include <sys/syscall.h>
|
||||
#define ABSL_HAVE_SYSCALL_WRITE 1
|
||||
#define ABSL_LOW_LEVEL_WRITE_SUPPORTED 1
|
||||
|
|
@ -93,8 +92,7 @@ constexpr char kTruncated[] = " ... (message truncated)\n";
|
|||
bool VADoRawLog(char** buf, int* size, const char* format, va_list ap)
|
||||
ABSL_PRINTF_ATTRIBUTE(3, 0);
|
||||
bool VADoRawLog(char** buf, int* size, const char* format, va_list ap) {
|
||||
if (*size < 0)
|
||||
return false;
|
||||
if (*size < 0) return false;
|
||||
int n = vsnprintf(*buf, static_cast<size_t>(*size), format, ap);
|
||||
bool result = true;
|
||||
if (n < 0 || n > *size) {
|
||||
|
|
@ -122,8 +120,7 @@ constexpr int kLogBufSize = 3000;
|
|||
bool DoRawLog(char** buf, int* size, const char* format, ...)
|
||||
ABSL_PRINTF_ATTRIBUTE(3, 4);
|
||||
bool DoRawLog(char** buf, int* size, const char* format, ...) {
|
||||
if (*size < 0)
|
||||
return false;
|
||||
if (*size < 0) return false;
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
int n = vsnprintf(*buf, static_cast<size_t>(*size), format, ap);
|
||||
|
|
@ -242,8 +239,8 @@ void AsyncSignalSafeWriteError(const char* s, size_t len) {
|
|||
_write(/* stderr */ 2, s, static_cast<unsigned>(len));
|
||||
#else
|
||||
// stderr logging unsupported on this platform
|
||||
(void) s;
|
||||
(void) len;
|
||||
(void)s;
|
||||
(void)len;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -258,7 +255,7 @@ void RawLog(absl::LogSeverity severity, const char* file, int line,
|
|||
bool RawLoggingFullySupported() {
|
||||
#ifdef ABSL_LOW_LEVEL_WRITE_SUPPORTED
|
||||
return true;
|
||||
#else // !ABSL_LOW_LEVEL_WRITE_SUPPORTED
|
||||
#else // !ABSL_LOW_LEVEL_WRITE_SUPPORTED
|
||||
return false;
|
||||
#endif // !ABSL_LOW_LEVEL_WRITE_SUPPORTED
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue