Bug 712939 - Use JS_ENUM_HEADER and JS_ENUM_FOOTER only where absolutely necessary, and don't expose them for general use. r=jandem

This commit is contained in:
Jeff Walden 2014-11-07 18:33:20 -08:00
Родитель 040244db4f
Коммит e7ab01f9cd
2 изменённых файлов: 20 добавлений и 6 удалений

Просмотреть файл

@ -84,7 +84,8 @@ JS_ENUM_HEADER(JSValueType, uint8_t)
JSVAL_TYPE_MISSING = 0x21 JSVAL_TYPE_MISSING = 0x21
} JS_ENUM_FOOTER(JSValueType); } JS_ENUM_FOOTER(JSValueType);
JS_STATIC_ASSERT(sizeof(JSValueType) == 1); static_assert(sizeof(JSValueType) == 1,
"compiler typed enum support is apparently buggy");
#if defined(JS_NUNBOX32) #if defined(JS_NUNBOX32)
@ -102,7 +103,8 @@ JS_ENUM_HEADER(JSValueTag, uint32_t)
JSVAL_TAG_OBJECT = JSVAL_TAG_CLEAR | JSVAL_TYPE_OBJECT JSVAL_TAG_OBJECT = JSVAL_TAG_CLEAR | JSVAL_TYPE_OBJECT
} JS_ENUM_FOOTER(JSValueTag); } JS_ENUM_FOOTER(JSValueTag);
JS_STATIC_ASSERT(sizeof(JSValueTag) == 4); static_assert(sizeof(JSValueTag) == sizeof(uint32_t),
"compiler typed enum support is apparently buggy");
#elif defined(JS_PUNBOX64) #elif defined(JS_PUNBOX64)
@ -120,7 +122,8 @@ JS_ENUM_HEADER(JSValueTag, uint32_t)
JSVAL_TAG_OBJECT = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_OBJECT JSVAL_TAG_OBJECT = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_OBJECT
} JS_ENUM_FOOTER(JSValueTag); } JS_ENUM_FOOTER(JSValueTag);
JS_STATIC_ASSERT(sizeof(JSValueTag) == sizeof(uint32_t)); static_assert(sizeof(JSValueTag) == sizeof(uint32_t),
"compiler typed enum support is apparently buggy");
JS_ENUM_HEADER(JSValueShiftedTag, uint64_t) JS_ENUM_HEADER(JSValueShiftedTag, uint64_t)
{ {
@ -135,10 +138,21 @@ JS_ENUM_HEADER(JSValueShiftedTag, uint64_t)
JSVAL_SHIFTED_TAG_OBJECT = (((uint64_t)JSVAL_TAG_OBJECT) << JSVAL_TAG_SHIFT) JSVAL_SHIFTED_TAG_OBJECT = (((uint64_t)JSVAL_TAG_OBJECT) << JSVAL_TAG_SHIFT)
} JS_ENUM_FOOTER(JSValueShiftedTag); } JS_ENUM_FOOTER(JSValueShiftedTag);
JS_STATIC_ASSERT(sizeof(JSValueShiftedTag) == sizeof(uint64_t)); static_assert(sizeof(JSValueShiftedTag) == sizeof(uint64_t),
"compiler typed enum support is apparently buggy");
#endif #endif
/*
* All our supported compilers implement C++11 |enum Foo : T| syntax, so don't
* expose these macros. (This macro exists *only* because gcc bug 51242
* <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51242> makes bit-fields of
* typed enums trigger a warning that can't be turned off. Don't expose it
* beyond this file!)
*/
#undef JS_ENUM_HEADER
#undef JS_ENUM_FOOTER
#else /* !defined(__SUNPRO_CC) && !defined(__xlC__) */ #else /* !defined(__SUNPRO_CC) && !defined(__xlC__) */
typedef uint8_t JSValueType; typedef uint8_t JSValueType;

Просмотреть файл

@ -588,7 +588,7 @@ class Shape : public gc::TenuredCell
HeapPtrBaseShape base_; HeapPtrBaseShape base_;
PreBarrieredId propid_; PreBarrieredId propid_;
JS_ENUM_HEADER(SlotInfo, uint32_t) enum SlotInfo : uint32_t
{ {
/* Number of fixed slots in objects with this shape. */ /* Number of fixed slots in objects with this shape. */
// FIXED_SLOTS_MAX is the biggest count of fixed slots a Shape can store // FIXED_SLOTS_MAX is the biggest count of fixed slots a Shape can store
@ -613,7 +613,7 @@ class Shape : public gc::TenuredCell
* other shapes. * other shapes.
*/ */
SLOT_MASK = JS_BIT(24) - 1 SLOT_MASK = JS_BIT(24) - 1
} JS_ENUM_FOOTER(SlotInfo); };
uint32_t slotInfo; /* mask of above info */ uint32_t slotInfo; /* mask of above info */
uint8_t attrs; /* attributes, see jsapi.h JSPROP_* */ uint8_t attrs; /* attributes, see jsapi.h JSPROP_* */