Backed out changeset d3cc90db1908 (bug 1324093)
authorIris Hsiao <ihsiao@mozilla.com>
Fri, 13 Jan 2017 10:51:25 +0800
changeset 374251 a991fee52cc9bc4fc72af3500a236c43cb50e612
parent 374250 b5ecc8950d720df408cfa60636c9e947ab7b9f0c
child 374252 2b2ae61e73f5d2e47403a4c891d613bf31561914
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1324093
milestone53.0a1
backs outd3cc90db1908a37934800e45e3b83a1883ca138b
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset d3cc90db1908 (bug 1324093)
mfbt/Assertions.h
--- a/mfbt/Assertions.h
+++ b/mfbt/Assertions.h
@@ -42,17 +42,17 @@ AnnotateMozCrashReason(const char* reaso
 #  define MOZ_CRASH_ANNOTATE(...) AnnotateMozCrashReason(__VA_ARGS__)
 #else
 #  define MOZ_CRASH_ANNOTATE(...) do { /* nothing */ } while (0)
 #endif
 
 #include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef _MSC_VER
+#ifdef WIN32
    /*
     * TerminateProcess and GetCurrentProcess are defined in <winbase.h>, which
     * further depends on <windef.h>.  We hardcode these few definitions manually
     * because those headers clutter the global namespace with a significant
     * number of undesired macros and symbols.
     */
 MOZ_BEGIN_EXTERN_C
 __declspec(dllimport) int __stdcall
@@ -187,43 +187,52 @@ MOZ_ReportCrash(const char* aStr, const 
  */
 #if defined(_MSC_VER)
    /*
     * On MSVC use the __debugbreak compiler intrinsic, which produces an inline
     * (not nested in a system function) breakpoint.  This distinctively invokes
     * Breakpad without requiring system library symbols on all stack-processing
     * machines, as a nested breakpoint would require.
     *
-    * We use __LINE__ to prevent the compiler from folding multiple crash sites
-    * together, which would make crash reports hard to understand.
-    *
     * We use TerminateProcess with the exit code aborting would generate
     * because we don't want to invoke atexit handlers, destructors, library
     * unload handlers, and so on when our process might be in a compromised
     * state.
     *
     * We don't use abort() because it'd cause Windows to annoyingly pop up the
     * process error dialog multiple times.  See bug 345118 and bug 426163.
     *
+    * We follow TerminateProcess() with a call to MOZ_NoReturn() so that the
+    * compiler doesn't hassle us to provide a return statement after a
+    * MOZ_REALLY_CRASH() call.
+    *
     * (Technically these are Windows requirements, not MSVC requirements.  But
     * practically you need MSVC for debugging, and we only ship builds created
     * by MSVC, so doing it this way reduces complexity.)
     */
 
-static MOZ_COLD MOZ_NORETURN MOZ_NEVER_INLINE void MOZ_NoReturn(int aLine)
-{
-  *((volatile int*) NULL) = aLine;
-  TerminateProcess(GetCurrentProcess(), 3);
-}
+__declspec(noreturn) __inline void MOZ_NoReturn() {}
 
-#  define MOZ_REALLY_CRASH() \
-     do { \
-       __debugbreak(); \
-       MOZ_NoReturn(__LINE__); \
-     } while (0)
+#  ifdef __cplusplus
+#    define MOZ_REALLY_CRASH() \
+       do { \
+         ::__debugbreak(); \
+         *((volatile int*) NULL) = __LINE__; \
+         ::TerminateProcess(::GetCurrentProcess(), 3); \
+         ::MOZ_NoReturn(); \
+       } while (0)
+#  else
+#    define MOZ_REALLY_CRASH() \
+       do { \
+         __debugbreak(); \
+         *((volatile int*) NULL) = __LINE__; \
+         TerminateProcess(GetCurrentProcess(), 3); \
+         MOZ_NoReturn(); \
+       } while (0)
+#  endif
 #else
 #  ifdef __cplusplus
 #    define MOZ_REALLY_CRASH() \
        do { \
          *((volatile int*) NULL) = __LINE__; \
          ::abort(); \
        } while (0)
 #  else