From 15183dceabdb9e9800a3485d87e1c6922e9c5238 Mon Sep 17 00:00:00 2001 From: Ginn Chen Date: Thu, 11 Jun 2009 14:46:13 +0800 Subject: [PATCH] Bug 489299 TestSynchronization.cpp failed to compile with Sun Studio r=benjamin, jones.chris.g --- xpcom/tests/Makefile.in | 4 ++++ xpcom/tests/TestDeadlockDetector.cpp | 3 ++- xpcom/tests/TestDeadlockDetectorScalability.cpp | 12 ++++++------ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/xpcom/tests/Makefile.in b/xpcom/tests/Makefile.in index 897425c6d0b3..4a7bbbb83e6d 100644 --- a/xpcom/tests/Makefile.in +++ b/xpcom/tests/Makefile.in @@ -152,6 +152,10 @@ ifeq ($(OS_ARCH)$(OS_RELEASE),FreeBSD2) LIBS += -lpcap endif +ifdef SOLARIS_SUNPRO_CXX +CXXFLAGS += -features=extensions -D__FUNCTION__=__func__ +endif + ENABLE_CXX_EXCEPTIONS = 1 XPCSHELL_TESTS = unit diff --git a/xpcom/tests/TestDeadlockDetector.cpp b/xpcom/tests/TestDeadlockDetector.cpp index bee3703109eb..d1b7fb35a293 100644 --- a/xpcom/tests/TestDeadlockDetector.cpp +++ b/xpcom/tests/TestDeadlockDetector.cpp @@ -518,7 +518,8 @@ ContentionNoDeadlock_Child() nsresult ContentionNoDeadlock() { - Subprocess proc(__FUNCTION__); + const char * func = __func__; + Subprocess proc(func); proc.RunToCompletion(10000); if (0 != proc.mExitCode) { printf("(expected 0 == return code, got %d)\n", proc.mExitCode); diff --git a/xpcom/tests/TestDeadlockDetectorScalability.cpp b/xpcom/tests/TestDeadlockDetectorScalability.cpp index c6e3433ba234..5c868b33464b 100644 --- a/xpcom/tests/TestDeadlockDetectorScalability.cpp +++ b/xpcom/tests/TestDeadlockDetectorScalability.cpp @@ -56,13 +56,13 @@ #ifdef OLD_API # include "nsAutoLock.h" - typedef PRLock* lock_t; + typedef PRLock* moz_lock_t; # define NEWLOCK(n) nsAutoLock::NewLock(n) # define DELETELOCK(v) nsAutoLock::DestroyLock(v) # define AUTOLOCK(v, l) nsAutoLock v(l) #else # include "mozilla/Mutex.h" - typedef mozilla::Mutex* lock_t; + typedef mozilla::Mutex* moz_lock_t; # define NEWLOCK(n) new mozilla::Mutex(n) # define DELETELOCK(v) delete (v) # define AUTOLOCK(v, l) mozilla::MutexAutoLock v(*l) @@ -83,7 +83,7 @@ AllocLockRecurseUnlockFree(int i) if (0 == i) return; - lock_t lock = NEWLOCK("deadlockDetector.scalability.t1"); + moz_lock_t lock = NEWLOCK("deadlockDetector.scalability.t1"); { AUTOLOCK(_, lock); AllocLockRecurseUnlockFree(i - 1); @@ -111,8 +111,8 @@ LengthNDepChain(int N) static nsresult OneLockNDeps(const int N, const int K) { - lock_t lock = NEWLOCK("deadlockDetector.scalability.t2.master"); - lock_t* locks = new lock_t[N]; + moz_lock_t lock = NEWLOCK("deadlockDetector.scalability.t2.master"); + moz_lock_t* locks = new moz_lock_t[N]; if (!locks) NS_RUNTIMEABORT("couldn't allocate lock array"); @@ -156,7 +156,7 @@ OneLockNDeps(const int N, const int K) static nsresult MaxDepsNsq(const int N, const int K) { - lock_t* locks = new lock_t[N]; + moz_lock_t* locks = new moz_lock_t[N]; if (!locks) NS_RUNTIMEABORT("couldn't allocate lock array");