Bug 1508064 - Use clang-format off in parts of js/ r=jandem

Protect tabular macros or struct initializers that can mangled by
clang-format.

Differential Revision: https://phabricator.services.mozilla.com/D12239

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ted Campbell 2018-11-19 16:04:03 +00:00
Родитель 2b703c59e4
Коммит 5d89dbbb32
3 изменённых файлов: 10 добавлений и 4 удалений

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

@ -115,6 +115,7 @@ static bool
Escape(JSContext* cx, const CharT* chars, uint32_t length, InlineCharBuffer<Latin1Char>& newChars,
uint32_t* newLengthOut)
{
// clang-format off
static const uint8_t shouldPassThrough[128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@ -125,6 +126,7 @@ Escape(JSContext* cx, const CharT* chars, uint32_t length, InlineCharBuffer<Lati
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* `abcdefghijklmno */
1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz{\}~ DEL */
};
// clang-format on
/* Take a first pass and see how big the result string will need to be. */
uint32_t newLength = length;

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

@ -161,6 +161,7 @@ class SrcNote {
};
};
// clang-format off
#define FOR_EACH_SRC_NOTE_TYPE(M) \
M(SRC_NULL, "null", 0) /* Terminates a note vector. */ \
M(SRC_IF, "if", 0) /* JSOP_IFEQ bytecode is from an if-then. */ \
@ -189,6 +190,7 @@ class SrcNote {
M(SRC_UNUSED22, "unused22", 0) /* Unused. */ \
M(SRC_UNUSED23, "unused23", 0) /* Unused. */ \
M(SRC_XDELTA, "xdelta", 0) /* 24-31 are for extended delta notes. */
// clang-format on
enum SrcNoteType {
#define DEFINE_SRC_NOTE_TYPE(sym, name, arity) sym,

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

@ -36,6 +36,7 @@ namespace gc {
// - whether they can be allocated in the nursery
// - whether they can be compacted
// clang-format off
#define FOR_EACH_OBJECT_ALLOCKIND(D) \
/* AllocKind TraceKind TypeName SizedType BGFinal Nursery Compact */ \
D(FUNCTION, Object, JSObject, JSFunction, true, true, true) \
@ -73,6 +74,7 @@ namespace gc {
#define FOR_EACH_NURSERY_STRING_ALLOCKIND(D) \
D(FAT_INLINE_STRING, String, JSFatInlineString, JSFatInlineString, true, true, true) \
D(STRING, String, JSString, JSString, true, true, true)
// clang-format on
#define FOR_EACH_NONOBJECT_ALLOCKIND(D) \
FOR_EACH_NONOBJECT_NONNURSERY_ALLOCKIND(D) \
@ -82,9 +84,9 @@ namespace gc {
FOR_EACH_OBJECT_ALLOCKIND(D) \
FOR_EACH_NONOBJECT_ALLOCKIND(D)
enum class AllocKind : uint8_t {
#define DEFINE_ALLOC_KIND(allocKind, _1, _2, _3, _4, _5, _6) allocKind,
enum class AllocKind : uint8_t {
// clang-format off
FOR_EACH_OBJECT_ALLOCKIND(DEFINE_ALLOC_KIND)
OBJECT_LIMIT,
@ -97,9 +99,9 @@ enum class AllocKind : uint8_t {
FIRST = 0,
OBJECT_FIRST = FUNCTION // Hardcoded to first object kind.
#undef DEFINE_ALLOC_KIND
// clang-format on
};
#undef DEFINE_ALLOC_KIND
static_assert(int(AllocKind::FIRST) == 0,
"Various places depend on AllocKind starting at 0");