From 67ed3b15f028bc55d13fb8e1f40c1c8b90ca4e2e Mon Sep 17 00:00:00 2001 From: Stanca Serban Date: Fri, 22 Mar 2024 17:28:29 +0200 Subject: [PATCH] Backed out changeset dda9d04389e1 (bug 1882518) for causing build bustages in Assertions.h. CLOSED TREE --- mfbt/Assertions.h | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/mfbt/Assertions.h b/mfbt/Assertions.h index 4d324f28e603..634d34057935 100644 --- a/mfbt/Assertions.h +++ b/mfbt/Assertions.h @@ -17,18 +17,6 @@ # define MOZ_BUFFER_STDERR #endif -// It appears that this is sometimes compiled without XP_WIN -#if defined(WIN32) -# include -# define MOZ_GET_PID() _getpid() -#elif !defined(__wasi__) -# include -# define MOZ_GET_PID() getpid() -#else -// Prevent compiler warning -# define MOZ_GET_PID() -1 -#endif - #include "mozilla/Attributes.h" #include "mozilla/Compiler.h" #include "mozilla/Fuzzing.h" @@ -107,15 +95,14 @@ MOZ_MAYBE_UNUSED static void MOZ_ReportAssertionFailurePrintFrame( * method is primarily for internal use in this header, and only secondarily * for use in implementing release-build assertions. */ - MOZ_MAYBE_UNUSED static MOZ_COLD MOZ_NEVER_INLINE void MOZ_ReportAssertionFailure(const char* aStr, const char* aFilename, int aLine) MOZ_PRETEND_NORETURN_FOR_STATIC_ANALYSIS { MOZ_FUZZING_HANDLE_CRASH_EVENT4("MOZ_ASSERT", aFilename, aLine, aStr); #ifdef ANDROID __android_log_print(ANDROID_LOG_FATAL, "MOZ_Assert", - "[%d] Assertion failure: %s, at %s:%d\n", MOZ_GET_PID(), - aStr, aFilename, aLine); + "Assertion failure: %s, at %s:%d\n", aStr, aFilename, + aLine); # if defined(MOZ_DUMP_ASSERTION_STACK) MozWalkTheStackWithWriter(MOZ_ReportAssertionFailurePrintFrame, CallerPC(), /* aMaxFrames */ 0); @@ -123,12 +110,11 @@ MOZ_ReportAssertionFailure(const char* aStr, const char* aFilename, #else # if defined(MOZ_BUFFER_STDERR) char msg[1024] = ""; - snprintf(msg, sizeof(msg) - 1, "[%d] Assertion failure: %s, at %s:%d\n", - MOZ_GET_PID(), aStr, aFilename, aLine); + snprintf(msg, sizeof(msg) - 1, "Assertion failure: %s, at %s:%d\n", aStr, + aFilename, aLine); fputs(msg, stderr); # else - fprintf(stderr, "[%d] Assertion failure: %s, at %s:%d\n", MOZ_GET_PID(), aStr, - aFilename, aLine); + fprintf(stderr, "Assertion failure: %s, at %s:%d\n", aStr, aFilename, aLine); # endif # if defined(MOZ_DUMP_ASSERTION_STACK) MozWalkTheStack(stderr, CallerPC(), /* aMaxFrames */ 0); @@ -142,17 +128,15 @@ MOZ_MAYBE_UNUSED static MOZ_COLD MOZ_NEVER_INLINE void MOZ_ReportCrash( int aLine) MOZ_PRETEND_NORETURN_FOR_STATIC_ANALYSIS { #ifdef ANDROID __android_log_print(ANDROID_LOG_FATAL, "MOZ_CRASH", - "[%d] Hit MOZ_CRASH(%s) at %s:%d\n", MOZ_GET_PID(), aStr, - aFilename, aLine); + "Hit MOZ_CRASH(%s) at %s:%d\n", aStr, aFilename, aLine); #else # if defined(MOZ_BUFFER_STDERR) char msg[1024] = ""; - snprintf(msg, sizeof(msg) - 1, "[%d] Hit MOZ_CRASH(%s) at %s:%d\n", - MOZ_GET_PID(), aStr, aFilename, aLine); + snprintf(msg, sizeof(msg) - 1, "Hit MOZ_CRASH(%s) at %s:%d\n", aStr, + aFilename, aLine); fputs(msg, stderr); # else - fprintf(stderr, "[%d] Hit MOZ_CRASH(%s) at %s:%d\n", MOZ_GET_PID(), aStr, - aFilename, aLine); + fprintf(stderr, "Hit MOZ_CRASH(%s) at %s:%d\n", aStr, aFilename, aLine); # endif # if defined(MOZ_DUMP_ASSERTION_STACK) MozWalkTheStack(stderr, CallerPC(), /* aMaxFrames */ 0);