bug 480700 - no more static asserts in headers. r=brendan

This commit is contained in:
Igor Bukanov
2009-03-05 12:12:50 +01:00
parent af70950aef
commit 1929780174
17 changed files with 141 additions and 74 deletions

View File

@@ -56,6 +56,28 @@
#include "jsscan.h"
#include "jsstr.h"
/*
* ATOM_HASH assumes that JSHashNumber is 32-bit even on 64-bit systems.
*/
JS_STATIC_ASSERT(sizeof(JSHashNumber) == 4);
JS_STATIC_ASSERT(sizeof(JSAtom *) == JS_BYTES_PER_WORD);
/*
* Start and limit offsets for atom pointers in JSAtomState must be aligned
* on the word boundary.
*/
JS_STATIC_ASSERT(ATOM_OFFSET_START % sizeof(JSAtom *) == 0);
JS_STATIC_ASSERT(ATOM_OFFSET_LIMIT % sizeof(JSAtom *) == 0);
/*
* JS_BOOLEAN_STR and JS_TYPE_STR assume that boolean names starts from the
* index 1 and type name starts from the index 1+2 atoms in JSAtomState.
*/
JS_STATIC_ASSERT(1 * sizeof(JSAtom *) ==
offsetof(JSAtomState, booleanAtoms) - ATOM_OFFSET_START);
JS_STATIC_ASSERT((1 + 2) * sizeof(JSAtom *) ==
offsetof(JSAtomState, typeAtoms) - ATOM_OFFSET_START);
const char *
js_AtomToPrintableString(JSContext *cx, JSAtom *atom)
{