Bug 726230: remove obsolete typedefs JSIntn, JSUIntn, r=luke

--HG--
extra : rebase_source : f7f84755fe86f10109cd7332583212b1aa1e719d
This commit is contained in:
David Mandelin 2012-02-10 18:07:35 -08:00
parent c8c68369b3
commit 6b38b9109e
6 changed files with 47 additions and 31 deletions

View File

@ -55,8 +55,8 @@ union JSVariant {
nsString;
int;
double;
bool; // We'd like to use JSBool here, but JSBool is really JSIntn,
// and IPC::ParamTraits mistakes JSIntn for int.
bool; // We'd like to use JSBool here, but IPC::ParamTraits would
// treat JSBool as int.
};
union OperationStatus {

View File

@ -46,6 +46,6 @@
*/
#include "jstypes.h"
typedef JSIntn intN;
typedef JSUintn uintN;
typedef int intN;
typedef unsigned uintN;
#endif /* jscompat_h___ */

View File

@ -580,7 +580,7 @@ static struct NumArgState* BuildArgArray( const char *fmt, va_list ap, int* rv,
nas[ cn ].type = TYPE_UINT32;
} else if (sizeof(void *) == sizeof(int64_t)) {
nas[ cn ].type = TYPE_UINT64;
} else if (sizeof(void *) == sizeof(JSIntn)) {
} else if (sizeof(void *) == sizeof(int)) {
nas[ cn ].type = TYPE_UINTN;
} else {
nas[ cn ].type = TYPE_UNKNOWN;
@ -642,7 +642,7 @@ static struct NumArgState* BuildArgArray( const char *fmt, va_list ap, int* rv,
case TYPE_INT16:
case TYPE_UINT16:
case TYPE_INTN:
case TYPE_UINTN: (void)va_arg( ap, JSIntn ); break;
case TYPE_UINTN: (void)va_arg( ap, int ); break;
case TYPE_INT32: (void)va_arg( ap, int32_t ); break;
@ -656,7 +656,7 @@ static struct NumArgState* BuildArgArray( const char *fmt, va_list ap, int* rv,
case TYPE_WSTRING: (void)va_arg( ap, jschar* ); break;
case TYPE_INTSTR: (void)va_arg( ap, JSIntn* ); break;
case TYPE_INTSTR: (void)va_arg( ap, int* ); break;
case TYPE_DOUBLE: (void)va_arg( ap, double ); break;

View File

@ -98,7 +98,7 @@ extern JS_PUBLIC_API(char*) JS_sprintf_append(char *last, const char *fmt, ...);
** data. The return value is a count of the number of characters fed to
** the stuff function, or (uint32_t)-1 if an error occurs.
*/
typedef JSIntn (*JSStuffFunc)(void *arg, const char *s, uint32_t slen);
typedef int (*JSStuffFunc)(void *arg, const char *s, uint32_t slen);
extern JS_PUBLIC_API(uint32_t) JS_sxprintf(JSStuffFunc f, void *arg, const char *fmt, ...);

View File

@ -219,19 +219,6 @@
JS_BEGIN_EXTERN_C
/************************************************************************
** TYPES: JSUintn
** JSIntn
** DESCRIPTION:
** The JSIntn types are most appropriate for automatic variables. They are
** guaranteed to be at least 16 bits, though various architectures may
** define them to be wider (e.g., 32 or even 64 bits). These types are
** never valid for fields of a structure.
************************************************************************/
typedef int JSIntn;
typedef unsigned int JSUintn;
/************************************************************************
** TYPES: JSBool
** DESCRIPTION:
@ -240,9 +227,9 @@ typedef unsigned int JSUintn;
** 'if (bool)', 'while (!bool)', '(bool) ? x : y' etc., to test booleans
** just as you would C int-valued conditions.
************************************************************************/
typedef JSIntn JSBool;
#define JS_TRUE (JSIntn)1
#define JS_FALSE (JSIntn)0
typedef int JSBool;
#define JS_TRUE (int)1
#define JS_FALSE (int)0
/************************************************************************
** TYPES: JSPackedBool

View File

@ -69,13 +69,42 @@ JS_PUBLIC_DATA(uint32_t) OOM_counter = 0;
*/
JS_STATIC_ASSERT(sizeof(void *) == sizeof(void (*)()));
/*
* |JS_Assert| historically took |JSIntn ln| as its last argument. We've
* boiled |JSIntn ln| down to simply |int ln| so that mfbt may declare the
* function without depending on the |JSIntn| typedef, so we must manually
* verify that the |JSIntn| typedef is consistent.
*/
JS_STATIC_ASSERT((tl::IsSameType<JSIntn, int>::result));
static JS_NEVER_INLINE void
CrashInJS()
{
/*
* We write 123 here so that the machine code for this function is
* unique. Otherwise the linker, trying to be smart, might use the
* same code for CrashInJS and for some other function. That
* messes up the signature in minidumps.
*/
#if defined(WIN32)
/*
* We used to call DebugBreak() on Windows, but amazingly, it causes
* the MSVS 2010 debugger not to be able to recover a call stack.
*/
*((volatile int *) NULL) = 123;
exit(3);
#elif defined(__APPLE__)
/*
* On Mac OS X, Breakpad ignores signals. Only real Mach exceptions are
* trapped.
*/
*((volatile int *) NULL) = 123; /* To continue from here in GDB: "return" then "continue". */
raise(SIGABRT); /* In case above statement gets nixed by the optimizer. */
#else
raise(SIGABRT); /* To continue from here in GDB: "signal 0". */
#endif
}
JS_PUBLIC_API(void)
JS_Assert(const char *s, const char *file, int ln)
{
fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln);
fflush(stderr);
CrashInJS();
}
#ifdef JS_BASIC_STATS