Bug 1347672 - Unbreak build on FreeBSD with GCC 6 or later. r?glandium
MozReview-Commit-ID: 67PaHOzlRUs
--- a/memory/mozalloc/mozalloc_abort.cpp
+++ b/memory/mozalloc/mozalloc_abort.cpp
@@ -16,24 +16,26 @@
#endif
#include <stdio.h>
#include "mozilla/Assertions.h"
void
mozalloc_abort(const char* const msg)
{
+ char error[128];
+ snprintf(error, sizeof(error)-1, "fatal: STL threw system_error: %s", msg);
#ifndef ANDROID
- fputs(msg, stderr);
+ fputs(error, stderr);
fputs("\n", stderr);
#else
- __android_log_print(ANDROID_LOG_ERROR, "Gecko", "mozalloc_abort: %s", msg);
+ __android_log_print(ANDROID_LOG_ERROR, "Gecko", "mozalloc_abort: %s", error);
#endif
#ifdef MOZ_WIDGET_ANDROID
- abortThroughJava(msg);
+ abortThroughJava(error);
#endif
MOZ_CRASH();
}
#ifdef MOZ_WIDGET_ANDROID
template <size_t N>
void fillAbortMessage(char (&msg)[N], uintptr_t retAddress) {
/*
--- a/memory/mozalloc/throw_gcc.h
+++ b/memory/mozalloc/throw_gcc.h
@@ -5,17 +5,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_throw_gcc_h
#define mozilla_throw_gcc_h
#include "mozilla/Attributes.h"
-#include <stdio.h> // snprintf
#include <string.h> // strerror
// For gcc, we define these inline to abort so that we're absolutely
// certain that (i) no exceptions are thrown from Gecko; (ii) these
// errors are always terminal and caught by breakpad.
#include "mozilla/mozalloc_abort.h"
@@ -127,19 +126,16 @@ MOZ_THROW_NORETURN MOZ_EXPORT MOZ_ALWAYS
__throw_ios_failure(const char* msg)
{
mozalloc_abort(msg);
}
MOZ_THROW_NORETURN MOZ_EXPORT MOZ_ALWAYS_INLINE void
__throw_system_error(int err)
{
- char error[128];
- snprintf(error, sizeof(error)-1,
- "fatal: STL threw system_error: %s (%d)", strerror(err), err);
- mozalloc_abort(error);
+ mozalloc_abort(strerror(err));
}
} // namespace std
#undef MOZ_THROW_NORETURN
#endif // mozilla_throw_gcc_h