diff --git a/runtime/bin/gen_snapshot.cc b/runtime/bin/gen_snapshot.cc index 3da8be85ca2..8b3db04615d 100644 --- a/runtime/bin/gen_snapshot.cc +++ b/runtime/bin/gen_snapshot.cc @@ -89,7 +89,7 @@ enum SnapshotKind { static SnapshotKind snapshot_kind = kCore; // The ordering of this list must match the SnapshotKind enum above. -static const char* kSnapshotKindNames[] = { +static const char* const kSnapshotKindNames[] = { // clang-format off "core", "core-jit", diff --git a/runtime/bin/io_natives.cc b/runtime/bin/io_natives.cc index ed0c7811b56..83503b515d2 100644 --- a/runtime/bin/io_natives.cc +++ b/runtime/bin/io_natives.cc @@ -192,7 +192,7 @@ namespace bin { IO_NATIVE_LIST(DECLARE_FUNCTION); -static struct NativeEntries { +static const struct NativeEntries { const char* name_; Dart_NativeFunction function_; int argument_count_; @@ -209,7 +209,7 @@ Dart_NativeFunction IONativeLookup(Dart_Handle name, *auto_setup_scope = true; int num_entries = sizeof(IOEntries) / sizeof(struct NativeEntries); for (int i = 0; i < num_entries; i++) { - struct NativeEntries* entry = &(IOEntries[i]); + const struct NativeEntries* entry = &(IOEntries[i]); if ((strcmp(function_name, entry->name_) == 0) && (entry->argument_count_ == argument_count)) { return reinterpret_cast(entry->function_); @@ -221,7 +221,7 @@ Dart_NativeFunction IONativeLookup(Dart_Handle name, const uint8_t* IONativeSymbol(Dart_NativeFunction nf) { int num_entries = sizeof(IOEntries) / sizeof(struct NativeEntries); for (int i = 0; i < num_entries; i++) { - struct NativeEntries* entry = &(IOEntries[i]); + const struct NativeEntries* entry = &(IOEntries[i]); if (reinterpret_cast(entry->function_) == nf) { return reinterpret_cast(entry->name_); } diff --git a/runtime/bin/main_options.cc b/runtime/bin/main_options.cc index dd82f2d0f3c..faf1d5c0d21 100644 --- a/runtime/bin/main_options.cc +++ b/runtime/bin/main_options.cc @@ -28,7 +28,7 @@ namespace dart { namespace bin { // These strings must match the enum SnapshotKind in main_options.h. -static const char* kSnapshotKindNames[] = { +static const char* const kSnapshotKindNames[] = { "none", "kernel", "app-jit", @@ -36,7 +36,7 @@ static const char* kSnapshotKindNames[] = { }; // These strings must match the enum VerbosityLevel in main_options.h. -static const char* kVerbosityLevelNames[] = { +static const char* const kVerbosityLevelNames[] = { "error", "warning", "info", "all", nullptr, }; diff --git a/runtime/bin/options.h b/runtime/bin/options.h index bb5f5eeae2c..32e185efea9 100644 --- a/runtime/bin/options.h +++ b/runtime/bin/options.h @@ -84,7 +84,7 @@ class CallbackOptionProcessor : public OptionProcessor { #define DEFINE_ENUM_OPTION(name, enum_name, variable) \ DEFINE_STRING_OPTION_CB(name, { \ - const char** kNames = k##enum_name##Names; \ + const char* const* kNames = k##enum_name##Names; \ for (intptr_t i = 0; kNames[i] != NULL; i++) { \ if (strcmp(value, kNames[i]) == 0) { \ variable = static_cast(i); \ diff --git a/runtime/vm/bootstrap_natives.cc b/runtime/vm/bootstrap_natives.cc index 5d9d84be49c..91b4f6faa13 100644 --- a/runtime/vm/bootstrap_natives.cc +++ b/runtime/vm/bootstrap_natives.cc @@ -21,7 +21,7 @@ namespace dart { // List all native functions implemented in the vm or core bootstrap dart // libraries so that we can resolve the native function to it's entry // point. -static struct NativeEntries { +static const struct NativeEntries { const char* name_; BootstrapNativeFunction function_; int argument_count_; @@ -46,7 +46,7 @@ Dart_NativeFunction BootstrapNatives::Lookup(Dart_Handle name, ASSERT(function_name != NULL); int num_entries = sizeof(BootStrapEntries) / sizeof(struct NativeEntries); for (int i = 0; i < num_entries; i++) { - struct NativeEntries* entry = &(BootStrapEntries[i]); + const struct NativeEntries* entry = &(BootStrapEntries[i]); if ((strcmp(function_name, entry->name_) == 0) && (entry->argument_count_ == argument_count)) { return reinterpret_cast(entry->function_); @@ -58,7 +58,7 @@ Dart_NativeFunction BootstrapNatives::Lookup(Dart_Handle name, const uint8_t* BootstrapNatives::Symbol(Dart_NativeFunction nf) { int num_entries = sizeof(BootStrapEntries) / sizeof(struct NativeEntries); for (int i = 0; i < num_entries; i++) { - struct NativeEntries* entry = &(BootStrapEntries[i]); + const struct NativeEntries* entry = &(BootStrapEntries[i]); if (reinterpret_cast(entry->function_) == nf) { return reinterpret_cast(entry->name_); } diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc index fd75159177f..f39a59da8e8 100644 --- a/runtime/vm/clustered_snapshot.cc +++ b/runtime/vm/clustered_snapshot.cc @@ -5838,7 +5838,7 @@ class VMDeserializationRoots : public DeserializationRoots { }; #if !defined(DART_PRECOMPILED_RUNTIME) -static const char* kObjectStoreFieldNames[] = { +static const char* const kObjectStoreFieldNames[] = { #define DECLARE_OBJECT_STORE_FIELD(Type, Name) #Name, OBJECT_STORE_FIELD_LIST(DECLARE_OBJECT_STORE_FIELD, DECLARE_OBJECT_STORE_FIELD, diff --git a/runtime/vm/compiler/assembler/disassembler_x86.cc b/runtime/vm/compiler/assembler/disassembler_x86.cc index 16ce521f4c3..77021e42a43 100644 --- a/runtime/vm/compiler/assembler/disassembler_x86.cc +++ b/runtime/vm/compiler/assembler/disassembler_x86.cc @@ -209,7 +209,7 @@ void InstructionTable::AddJumpConditionalShort() { static InstructionTable instruction_table; -static InstructionDesc cmov_instructions[16] = { +static const InstructionDesc cmov_instructions[16] = { {"cmovo", TWO_OPERANDS_INSTR, REG_OPER_OP_ORDER, false}, {"cmovno", TWO_OPERANDS_INSTR, REG_OPER_OP_ORDER, false}, {"cmovc", TWO_OPERANDS_INSTR, REG_OPER_OP_ORDER, false}, @@ -641,8 +641,8 @@ int DisassemblerX64::F6F7Instruction(uint8_t* data) { uint8_t modrm = *(data + 1); int mod, regop, rm; get_modrm(modrm, &mod, ®op, &rm); - static const char* mnemonics[] = {"test", NULL, "not", "neg", - "mul", "imul", "div", "idiv"}; + static const char* const mnemonics[] = {"test", NULL, "not", "neg", + "mul", "imul", "div", "idiv"}; const char* mnem = mnemonics[regop]; if (mod == 3 && regop != 0) { if (regop > 3) { @@ -1529,8 +1529,8 @@ int DisassemblerX64::TwoByteOpcodeInstruction(uint8_t* data) { current += PrintOperands(idesc.mnem, idesc.op_order_, current); } else if (0x10 <= opcode && opcode <= 0x16) { // ...ps xmm, xmm/m128 - static const char* mnemonics[] = {"movups", NULL, "movhlps", NULL, - "unpcklps", "unpckhps", "movlhps"}; + static const char* const mnemonics[] = { + "movups", NULL, "movhlps", NULL, "unpcklps", "unpckhps", "movlhps"}; const char* mnemonic = mnemonics[opcode - 0x10]; if (mnemonic == NULL) { UnimplementedInstruction(); @@ -1613,7 +1613,7 @@ const char* DisassemblerX64::TwoByteMnemonic(uint8_t opcode) { return xmm_instructions[opcode & 0xF].ps_name; } if (0xA2 <= opcode && opcode <= 0xBF) { - static const char* mnemonics[] = { + static const char* const mnemonics[] = { "cpuid", "bt", "shld", "shld", NULL, NULL, NULL, NULL, NULL, "bts", "shrd", "shrd", NULL, "imul", "cmpxchg", "cmpxchg", NULL, NULL, diff --git a/runtime/vm/compiler/backend/il_printer.cc b/runtime/vm/compiler/backend/il_printer.cc index b954beee562..1bfffd0fe69 100644 --- a/runtime/vm/compiler/backend/il_printer.cc +++ b/runtime/vm/compiler/backend/il_printer.cc @@ -787,7 +787,7 @@ void DoubleTestOpInstr::PrintOperandsTo(BaseTextBuffer* f) const { value()->PrintTo(f); } -static const char* simd_op_kind_string[] = { +static const char* const simd_op_kind_string[] = { #define CASE(Arity, Mask, Name, ...) #Name, SIMD_OP_LIST(CASE, CASE) #undef CASE diff --git a/runtime/vm/compiler/intrinsifier.cc b/runtime/vm/compiler/intrinsifier.cc index a1a097329bd..bce561c92a0 100644 --- a/runtime/vm/compiler/intrinsifier.cc +++ b/runtime/vm/compiler/intrinsifier.cc @@ -157,37 +157,37 @@ struct IntrinsicDesc { struct LibraryInstrinsicsDesc { Library& library; - IntrinsicDesc* intrinsics; + const IntrinsicDesc* intrinsics; }; #define DEFINE_INTRINSIC(class_name, function_name, destination, fp) \ {#class_name, #function_name}, // clang-format off -static IntrinsicDesc core_intrinsics[] = { +static const IntrinsicDesc core_intrinsics[] = { CORE_LIB_INTRINSIC_LIST(DEFINE_INTRINSIC) CORE_INTEGER_LIB_INTRINSIC_LIST(DEFINE_INTRINSIC) GRAPH_CORE_INTRINSICS_LIST(DEFINE_INTRINSIC) {nullptr, nullptr}, }; -static IntrinsicDesc math_intrinsics[] = { +static const IntrinsicDesc math_intrinsics[] = { MATH_LIB_INTRINSIC_LIST(DEFINE_INTRINSIC) GRAPH_MATH_LIB_INTRINSIC_LIST(DEFINE_INTRINSIC) {nullptr, nullptr}, }; -static IntrinsicDesc typed_data_intrinsics[] = { +static const IntrinsicDesc typed_data_intrinsics[] = { GRAPH_TYPED_DATA_INTRINSICS_LIST(DEFINE_INTRINSIC) {nullptr, nullptr}, }; -static IntrinsicDesc developer_intrinsics[] = { +static const IntrinsicDesc developer_intrinsics[] = { DEVELOPER_LIB_INTRINSIC_LIST(DEFINE_INTRINSIC) {nullptr, nullptr}, }; -static IntrinsicDesc internal_intrinsics[] = { +static const IntrinsicDesc internal_intrinsics[] = { INTERNAL_LIB_INTRINSIC_LIST(DEFINE_INTRINSIC) {nullptr, nullptr}, }; @@ -204,7 +204,7 @@ void Intrinsifier::InitializeState() { Error& error = Error::Handle(zone); static const intptr_t kNumLibs = 5; - LibraryInstrinsicsDesc intrinsics[kNumLibs] = { + const LibraryInstrinsicsDesc intrinsics[kNumLibs] = { {Library::Handle(zone, Library::CoreLibrary()), core_intrinsics}, {Library::Handle(zone, Library::MathLibrary()), math_intrinsics}, {Library::Handle(zone, Library::TypedDataLibrary()), @@ -216,7 +216,7 @@ void Intrinsifier::InitializeState() { for (intptr_t i = 0; i < kNumLibs; i++) { lib = intrinsics[i].library.ptr(); - for (IntrinsicDesc* intrinsic = intrinsics[i].intrinsics; + for (const IntrinsicDesc* intrinsic = intrinsics[i].intrinsics; intrinsic->class_name != nullptr; intrinsic++) { func = Function::null(); if (strcmp(intrinsic->class_name, "::") == 0) { diff --git a/runtime/vm/compiler/method_recognizer.cc b/runtime/vm/compiler/method_recognizer.cc index 873f9e060b4..0c5a85a95b8 100644 --- a/runtime/vm/compiler/method_recognizer.cc +++ b/runtime/vm/compiler/method_recognizer.cc @@ -356,7 +356,7 @@ Token::Kind MethodTokenRecognizer::RecognizeTokenKind(const String& name) { #define RECOGNIZE_FACTORY(symbol, class_name, constructor_name, cid, fp) \ {Symbols::k##symbol##Id, cid, fp, #symbol ", " #cid}, // NOLINT -static struct { +static const struct { const intptr_t symbol_id; const intptr_t cid; const uint32_t finger_print; diff --git a/runtime/vm/constants_arm.cc b/runtime/vm/constants_arm.cc index 21ae8522676..19034276ad8 100644 --- a/runtime/vm/constants_arm.cc +++ b/runtime/vm/constants_arm.cc @@ -12,7 +12,7 @@ namespace dart { using dart::bit_cast; -const char* cpu_reg_names[kNumberOfCpuRegisters] = { +const char* const cpu_reg_names[kNumberOfCpuRegisters] = { #if defined(TARGET_OS_MACOS) || defined(TARGET_OS_MACOS_IOS) "r0", "r1", "r2", "r3", "r4", "pp", "r6", "fp", "r8", "r9", "thr", "r11", "ip", "sp", "lr", "pc", @@ -22,13 +22,13 @@ const char* cpu_reg_names[kNumberOfCpuRegisters] = { #endif }; -const char* fpu_reg_names[kNumberOfFpuRegisters] = { +const char* const fpu_reg_names[kNumberOfFpuRegisters] = { "q0", "q1", "q2", "q3", "q4", "q5", "q6", "q7", #if defined(VFPv3_D32) "q8", "q9", "q10", "q11", "q12", "q13", "q14", "q15", #endif }; -const char* fpu_d_reg_names[kNumberOfDRegisters] = { +const char* const fpu_d_reg_names[kNumberOfDRegisters] = { "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15", #if defined(VFPv3_D32) @@ -36,7 +36,7 @@ const char* fpu_d_reg_names[kNumberOfDRegisters] = { "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31", #endif }; -const char* fpu_s_reg_names[kNumberOfSRegisters] = { +const char* const fpu_s_reg_names[kNumberOfSRegisters] = { "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", diff --git a/runtime/vm/constants_arm.h b/runtime/vm/constants_arm.h index b72a0934c30..8130b72781b 100644 --- a/runtime/vm/constants_arm.h +++ b/runtime/vm/constants_arm.h @@ -291,10 +291,10 @@ const FpuRegister FpuTMP = QTMP; const int kNumberOfFpuRegisters = kNumberOfQRegisters; const FpuRegister kNoFpuRegister = kNoQRegister; -extern const char* cpu_reg_names[kNumberOfCpuRegisters]; -extern const char* fpu_reg_names[kNumberOfFpuRegisters]; -extern const char* fpu_s_reg_names[kNumberOfSRegisters]; -extern const char* fpu_d_reg_names[kNumberOfDRegisters]; +extern const char* const cpu_reg_names[kNumberOfCpuRegisters]; +extern const char* const fpu_reg_names[kNumberOfFpuRegisters]; +extern const char* const fpu_s_reg_names[kNumberOfSRegisters]; +extern const char* const fpu_d_reg_names[kNumberOfDRegisters]; // Register aliases. const Register TMP = IP; // Used as scratch register by assembler. diff --git a/runtime/vm/constants_arm64.cc b/runtime/vm/constants_arm64.cc index 7945838ea28..b30808b64ac 100644 --- a/runtime/vm/constants_arm64.cc +++ b/runtime/vm/constants_arm64.cc @@ -10,13 +10,13 @@ namespace dart { -const char* cpu_reg_names[kNumberOfCpuRegisters] = { +const char* const cpu_reg_names[kNumberOfCpuRegisters] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21", "nr", "r23", "r24", "ip0", "ip1", "pp", "r28", "fp", "lr", "r31", }; -const char* fpu_reg_names[kNumberOfFpuRegisters] = { +const char* const fpu_reg_names[kNumberOfFpuRegisters] = { "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", diff --git a/runtime/vm/constants_arm64.h b/runtime/vm/constants_arm64.h index 91ff40ec991..61f2c4a28fc 100644 --- a/runtime/vm/constants_arm64.h +++ b/runtime/vm/constants_arm64.h @@ -126,8 +126,8 @@ const FpuRegister FpuTMP = VTMP; const int kNumberOfFpuRegisters = kNumberOfVRegisters; const FpuRegister kNoFpuRegister = kNoVRegister; -extern const char* cpu_reg_names[kNumberOfCpuRegisters]; -extern const char* fpu_reg_names[kNumberOfFpuRegisters]; +extern const char* const cpu_reg_names[kNumberOfCpuRegisters]; +extern const char* const fpu_reg_names[kNumberOfFpuRegisters]; // Register aliases. const Register TMP = R16; // Used as scratch register by assembler. diff --git a/runtime/vm/constants_ia32.cc b/runtime/vm/constants_ia32.cc index 2d83fdd2d95..bbe4febf17d 100644 --- a/runtime/vm/constants_ia32.cc +++ b/runtime/vm/constants_ia32.cc @@ -10,10 +10,10 @@ namespace dart { -const char* cpu_reg_names[kNumberOfCpuRegisters] = {"eax", "ecx", "edx", "ebx", - "esp", "ebp", "esi", "edi"}; +const char* const cpu_reg_names[kNumberOfCpuRegisters] = { + "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"}; -const char* fpu_reg_names[kNumberOfXmmRegisters] = { +const char* const fpu_reg_names[kNumberOfXmmRegisters] = { "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"}; // Although 'kArgumentRegisters' and 'kFpuArgumentRegisters' are both 0, we have diff --git a/runtime/vm/constants_ia32.h b/runtime/vm/constants_ia32.h index df188c208e2..b83e1966699 100644 --- a/runtime/vm/constants_ia32.h +++ b/runtime/vm/constants_ia32.h @@ -64,8 +64,8 @@ const FpuRegister FpuTMP = XMM7; const int kNumberOfFpuRegisters = kNumberOfXmmRegisters; const FpuRegister kNoFpuRegister = kNoXmmRegister; -extern const char* cpu_reg_names[kNumberOfCpuRegisters]; -extern const char* fpu_reg_names[kNumberOfXmmRegisters]; +extern const char* const cpu_reg_names[kNumberOfCpuRegisters]; +extern const char* const fpu_reg_names[kNumberOfXmmRegisters]; // Register aliases. const Register TMP = kNoRegister; // No scratch register used by assembler. diff --git a/runtime/vm/constants_x64.cc b/runtime/vm/constants_x64.cc index 24e9abc812d..6312a546f90 100644 --- a/runtime/vm/constants_x64.cc +++ b/runtime/vm/constants_x64.cc @@ -10,11 +10,11 @@ namespace dart { -const char* cpu_reg_names[kNumberOfCpuRegisters] = { +const char* const cpu_reg_names[kNumberOfCpuRegisters] = { "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi", "r8", "r9", "r10", "r11", "r12", "r13", "thr", "pp"}; -const char* fpu_reg_names[kNumberOfXmmRegisters] = { +const char* const fpu_reg_names[kNumberOfXmmRegisters] = { "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"}; diff --git a/runtime/vm/constants_x64.h b/runtime/vm/constants_x64.h index e20d75560ad..546a0f2f382 100644 --- a/runtime/vm/constants_x64.h +++ b/runtime/vm/constants_x64.h @@ -96,8 +96,8 @@ const FpuRegister FpuTMP = XMM15; const int kNumberOfFpuRegisters = kNumberOfXmmRegisters; const FpuRegister kNoFpuRegister = kNoXmmRegister; -extern const char* cpu_reg_names[kNumberOfCpuRegisters]; -extern const char* fpu_reg_names[kNumberOfXmmRegisters]; +extern const char* const cpu_reg_names[kNumberOfCpuRegisters]; +extern const char* const fpu_reg_names[kNumberOfXmmRegisters]; enum RexBits { REX_NONE = 0, diff --git a/runtime/vm/raw_object_fields.cc b/runtime/vm/raw_object_fields.cc index 1b09c409c88..454551b3c3d 100644 --- a/runtime/vm/raw_object_fields.cc +++ b/runtime/vm/raw_object_fields.cc @@ -234,7 +234,7 @@ const char* OffsetsTable::FieldNameForOffset(intptr_t class_id, OFFSET_OF(Untagged##class_name, field_name)}, // clang-format off -OffsetsTable::OffsetsTableEntry OffsetsTable::offsets_table[] = { +const OffsetsTable::OffsetsTableEntry OffsetsTable::offsets_table[] = { COMMON_CLASSES_AND_FIELDS(DEFINE_OFFSETS_TABLE_ENTRY) #if !defined(PRODUCT) NON_PRODUCT_CLASSES_AND_FIELDS(DEFINE_OFFSETS_TABLE_ENTRY) diff --git a/runtime/vm/raw_object_fields.h b/runtime/vm/raw_object_fields.h index 2b456be81b7..6a4f5720f00 100644 --- a/runtime/vm/raw_object_fields.h +++ b/runtime/vm/raw_object_fields.h @@ -31,11 +31,11 @@ class OffsetsTable : public ZoneAllocated { struct OffsetsTableEntry { const intptr_t class_id; - const char* field_name; - intptr_t offset; + const char* const field_name; + const intptr_t offset; }; - static OffsetsTableEntry offsets_table[]; + static const OffsetsTableEntry offsets_table[]; private: struct IntAndIntToStringMapTraits { diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc index 9a90be34c24..e926685a4a5 100644 --- a/runtime/vm/service.cc +++ b/runtime/vm/service.cc @@ -132,7 +132,7 @@ StreamInfo Service::timeline_stream("Timeline"); const uint8_t* Service::dart_library_kernel_ = NULL; intptr_t Service::dart_library_kernel_len_ = 0; -static StreamInfo* streams_[] = { +static StreamInfo* const streams_[] = { &Service::vm_stream, &Service::isolate_stream, &Service::debug_stream, &Service::gc_stream, &Service::echo_stream, &Service::heapsnapshot_stream, @@ -1395,7 +1395,7 @@ void Service::ScheduleExtensionHandler(const Instance& handler, parameter_values, reply_port, id); } -static const MethodParameter* get_isolate_params[] = { +static const MethodParameter* const get_isolate_params[] = { ISOLATE_PARAMETER, NULL, }; @@ -1404,7 +1404,7 @@ static void GetIsolate(Thread* thread, JSONStream* js) { thread->isolate()->PrintJSON(js, false); } -static const MethodParameter* get_isolate_group_params[] = { +static const MethodParameter* const get_isolate_group_params[] = { ISOLATE_GROUP_PARAMETER, NULL, }; @@ -1462,7 +1462,7 @@ static void GetIsolateGroup(Thread* thread, JSONStream* js) { }); } -static const MethodParameter* get_memory_usage_params[] = { +static const MethodParameter* const get_memory_usage_params[] = { ISOLATE_PARAMETER, NULL, }; @@ -1471,7 +1471,7 @@ static void GetMemoryUsage(Thread* thread, JSONStream* js) { thread->isolate()->PrintMemoryUsageJSON(js); } -static const MethodParameter* get_isolate_group_memory_usage_params[] = { +static const MethodParameter* const get_isolate_group_memory_usage_params[] = { ISOLATE_GROUP_PARAMETER, NULL, }; @@ -1482,7 +1482,7 @@ static void GetIsolateGroupMemoryUsage(Thread* thread, JSONStream* js) { }); } -static const MethodParameter* get_scripts_params[] = { +static const MethodParameter* const get_scripts_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -1516,7 +1516,7 @@ static void GetScripts(Thread* thread, JSONStream* js) { } } -static const MethodParameter* get_stack_params[] = { +static const MethodParameter* const get_stack_params[] = { RUNNABLE_ISOLATE_PARAMETER, new UIntParameter("limit", false), NULL, @@ -2177,7 +2177,7 @@ static void PrintInboundReferences(Thread* thread, } } -static const MethodParameter* get_inbound_references_params[] = { +static const MethodParameter* const get_inbound_references_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -2310,7 +2310,7 @@ static void PrintRetainingPath(Thread* thread, } } -static const MethodParameter* get_retaining_path_params[] = { +static const MethodParameter* const get_retaining_path_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -2351,7 +2351,7 @@ static void GetRetainingPath(Thread* thread, JSONStream* js) { PrintRetainingPath(thread, &obj, limit, js); } -static const MethodParameter* get_retained_size_params[] = { +static const MethodParameter* const get_retained_size_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("targetId", true), NULL, @@ -2390,7 +2390,7 @@ static void GetRetainedSize(Thread* thread, JSONStream* js) { result.PrintJSON(js, true); } -static const MethodParameter* get_reachable_size_params[] = { +static const MethodParameter* const get_reachable_size_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("targetId", true), NULL, @@ -2429,7 +2429,7 @@ static void GetReachableSize(Thread* thread, JSONStream* js) { result.PrintJSON(js, true); } -static const MethodParameter* invoke_params[] = { +static const MethodParameter* const invoke_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -2562,7 +2562,7 @@ static void Invoke(Thread* thread, JSONStream* js) { js->method()); } -static const MethodParameter* evaluate_params[] = { +static const MethodParameter* const evaluate_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -2686,11 +2686,12 @@ static void Evaluate(Thread* thread, JSONStream* js) { js->method()); } -static const MethodParameter* build_expression_evaluation_scope_params[] = { - RUNNABLE_ISOLATE_PARAMETER, - new IdParameter("frameIndex", false), - new IdParameter("targetId", false), - NULL, +static const MethodParameter* const build_expression_evaluation_scope_params[] = + { + RUNNABLE_ISOLATE_PARAMETER, + new IdParameter("frameIndex", false), + new IdParameter("targetId", false), + NULL, }; static void BuildExpressionEvaluationScope(Thread* thread, JSONStream* js) { @@ -2862,7 +2863,7 @@ static bool ParseCSVList(const char* csv_list, } #endif -static const MethodParameter* compile_expression_params[] = { +static const MethodParameter* const compile_expression_params[] = { RUNNABLE_ISOLATE_PARAMETER, new StringParameter("expression", true), new StringParameter("definitions", false), @@ -2932,7 +2933,7 @@ static void CompileExpression(Thread* thread, JSONStream* js) { #endif } -static const MethodParameter* evaluate_compiled_expression_params[] = { +static const MethodParameter* const evaluate_compiled_expression_params[] = { RUNNABLE_ISOLATE_PARAMETER, new UIntParameter("frameIndex", false), new IdParameter("targetId", false), @@ -3066,7 +3067,7 @@ static void EvaluateCompiledExpression(Thread* thread, JSONStream* js) { } } -static const MethodParameter* evaluate_in_frame_params[] = { +static const MethodParameter* const evaluate_in_frame_params[] = { RUNNABLE_ISOLATE_PARAMETER, new UIntParameter("frameIndex", true), new MethodParameter("expression", true), @@ -3165,7 +3166,7 @@ class GetInstancesVisitor : public ObjectGraph::Visitor { intptr_t count_; }; -static const MethodParameter* get_instances_params[] = { +static const MethodParameter* const get_instances_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -3219,7 +3220,7 @@ static void GetInstances(Thread* thread, JSONStream* js) { } } -static const MethodParameter* get_instances_as_array_params[] = { +static const MethodParameter* const get_instances_as_array_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -3267,7 +3268,7 @@ static void GetInstancesAsArray(Thread* thread, JSONStream* js) { instances.PrintJSON(js, /* as_ref */ true); } -static const MethodParameter* get_ports_params[] = { +static const MethodParameter* const get_ports_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -3303,7 +3304,7 @@ static const char* const report_enum_names[] = { }; #endif -static const MethodParameter* get_source_report_params[] = { +static const MethodParameter* const get_source_report_params[] = { #if !defined(DART_PRECOMPILED_RUNTIME) RUNNABLE_ISOLATE_PARAMETER, new EnumListParameter("reports", true, report_enum_names), @@ -3382,7 +3383,7 @@ static void GetSourceReport(Thread* thread, JSONStream* js) { #endif // !DART_PRECOMPILED_RUNTIME } -static const MethodParameter* reload_sources_params[] = { +static const MethodParameter* const reload_sources_params[] = { RUNNABLE_ISOLATE_PARAMETER, new BoolParameter("force", false), new BoolParameter("pause", false), @@ -3489,7 +3490,7 @@ static void AddBreakpointCommon(Thread* thread, bpt->PrintJSON(js); } -static const MethodParameter* add_breakpoint_params[] = { +static const MethodParameter* const add_breakpoint_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("scriptId", true), new UIntParameter("line", true), @@ -3514,7 +3515,7 @@ static void AddBreakpoint(Thread* thread, JSONStream* js) { AddBreakpointCommon(thread, js, script_uri); } -static const MethodParameter* add_breakpoint_with_script_uri_params[] = { +static const MethodParameter* const add_breakpoint_with_script_uri_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("scriptUri", true), new UIntParameter("line", true), @@ -3532,7 +3533,7 @@ static void AddBreakpointWithScriptUri(Thread* thread, JSONStream* js) { AddBreakpointCommon(thread, js, script_uri); } -static const MethodParameter* add_breakpoint_at_entry_params[] = { +static const MethodParameter* const add_breakpoint_at_entry_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("functionId", true), NULL, @@ -3561,7 +3562,7 @@ static void AddBreakpointAtEntry(Thread* thread, JSONStream* js) { bpt->PrintJSON(js); } -static const MethodParameter* add_breakpoint_at_activation_params[] = { +static const MethodParameter* const add_breakpoint_at_activation_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("objectId", true), NULL, @@ -3589,7 +3590,7 @@ static void AddBreakpointAtActivation(Thread* thread, JSONStream* js) { bpt->PrintJSON(js); } -static const MethodParameter* remove_breakpoint_params[] = { +static const MethodParameter* const remove_breakpoint_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -3715,7 +3716,7 @@ static void HandleDartMetric(Thread* thread, JSONStream* js, const char* id) { PrintInvalidParamError(js, "metricId"); } -static const MethodParameter* get_isolate_metric_list_params[] = { +static const MethodParameter* const get_isolate_metric_list_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -3742,7 +3743,7 @@ static void GetIsolateMetricList(Thread* thread, JSONStream* js) { } } -static const MethodParameter* get_isolate_metric_params[] = { +static const MethodParameter* const get_isolate_metric_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -3781,7 +3782,7 @@ static const char* const timeline_streams_enum_names[] = { #undef DEFINE_NAME NULL}; -static const MethodParameter* set_vm_timeline_flags_params[] = { +static const MethodParameter* const set_vm_timeline_flags_params[] = { NO_ISOLATE_PARAMETER, new EnumListParameter("recordedStreams", false, @@ -3832,7 +3833,7 @@ static void SetVMTimelineFlags(Thread* thread, JSONStream* js) { #endif } -static const MethodParameter* get_vm_timeline_flags_params[] = { +static const MethodParameter* const get_vm_timeline_flags_params[] = { NO_ISOLATE_PARAMETER, NULL, }; @@ -3849,7 +3850,7 @@ static void GetVMTimelineFlags(Thread* thread, JSONStream* js) { #endif } -static const MethodParameter* get_vm_timeline_micros_params[] = { +static const MethodParameter* const get_vm_timeline_micros_params[] = { NO_ISOLATE_PARAMETER, NULL, }; @@ -3860,7 +3861,7 @@ static void GetVMTimelineMicros(Thread* thread, JSONStream* js) { obj.AddPropertyTimeMicros("timestamp", OS::GetCurrentMonotonicMicros()); } -static const MethodParameter* clear_vm_timeline_params[] = { +static const MethodParameter* const clear_vm_timeline_params[] = { NO_ISOLATE_PARAMETER, NULL, }; @@ -3875,7 +3876,7 @@ static void ClearVMTimeline(Thread* thread, JSONStream* js) { PrintSuccess(js); } -static const MethodParameter* get_vm_timeline_params[] = { +static const MethodParameter* const get_vm_timeline_params[] = { NO_ISOLATE_PARAMETER, new Int64Parameter("timeOriginMicros", false), new Int64Parameter("timeExtentMicros", false), @@ -3921,7 +3922,7 @@ static const Debugger::ResumeAction step_enum_values[] = { Debugger::kContinue, // Default value }; -static const MethodParameter* resume_params[] = { +static const MethodParameter* const resume_params[] = { RUNNABLE_ISOLATE_PARAMETER, new EnumParameter("step", false, step_enum_names), new UIntParameter("frameIndex", false), @@ -3994,7 +3995,7 @@ static void Resume(Thread* thread, JSONStream* js) { PrintSuccess(js); } -static const MethodParameter* kill_params[] = { +static const MethodParameter* const kill_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -4008,7 +4009,7 @@ static void Kill(Thread* thread, JSONStream* js) { PrintSuccess(js); } -static const MethodParameter* pause_params[] = { +static const MethodParameter* const pause_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -4024,7 +4025,7 @@ static void Pause(Thread* thread, JSONStream* js) { PrintSuccess(js); } -static const MethodParameter* enable_profiler_params[] = { +static const MethodParameter* const enable_profiler_params[] = { NULL, }; @@ -4036,7 +4037,7 @@ static void EnableProfiler(Thread* thread, JSONStream* js) { PrintSuccess(js); } -static const MethodParameter* get_tag_profile_params[] = { +static const MethodParameter* const get_tag_profile_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -4047,7 +4048,7 @@ static void GetTagProfile(Thread* thread, JSONStream* js) { thread->isolate()->vm_tag_counters()->PrintToJSONObject(&miniProfile); } -static const MethodParameter* get_cpu_samples_params[] = { +static const MethodParameter* const get_cpu_samples_params[] = { RUNNABLE_ISOLATE_PARAMETER, new Int64Parameter("timeOriginMicros", false), new Int64Parameter("timeExtentMicros", false), @@ -4068,7 +4069,7 @@ static void GetCpuSamples(Thread* thread, JSONStream* js) { include_code_samples); } -static const MethodParameter* get_allocation_traces_params[] = { +static const MethodParameter* const get_allocation_traces_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("classId", false), new Int64Parameter("timeOriginMicros", false), @@ -4108,7 +4109,7 @@ static void GetAllocationTraces(Thread* thread, JSONStream* js) { } } -static const MethodParameter* get_native_allocation_samples_params[] = { +static const MethodParameter* const get_native_allocation_samples_params[] = { NO_ISOLATE_PARAMETER, new Int64Parameter("timeOriginMicros", false), new Int64Parameter("timeExtentMicros", false), @@ -4132,7 +4133,7 @@ static void GetNativeAllocationSamples(Thread* thread, JSONStream* js) { js, time_origin_micros, time_extent_micros, include_code_samples); } -static const MethodParameter* clear_cpu_samples_params[] = { +static const MethodParameter* const clear_cpu_samples_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -4174,7 +4175,7 @@ static void GetAllocationProfileImpl(Thread* thread, isolate_group->class_table()->AllocationProfilePrintJSON(js, internal); } -static const MethodParameter* get_allocation_profile_params[] = { +static const MethodParameter* const get_allocation_profile_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -4187,7 +4188,7 @@ static void GetAllocationProfile(Thread* thread, JSONStream* js) { GetAllocationProfileImpl(thread, js, true); } -static const MethodParameter* collect_all_garbage_params[] = { +static const MethodParameter* const collect_all_garbage_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -4198,7 +4199,7 @@ static void CollectAllGarbage(Thread* thread, JSONStream* js) { PrintSuccess(js); } -static const MethodParameter* get_heap_map_params[] = { +static const MethodParameter* const get_heap_map_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -4221,7 +4222,7 @@ static void GetHeapMap(Thread* thread, JSONStream* js) { isolate_group->heap()->PrintHeapMapToJSONStream(isolate_group, js); } -static const MethodParameter* request_heap_snapshot_params[] = { +static const MethodParameter* const request_heap_snapshot_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -4437,7 +4438,7 @@ static intptr_t GetProcessMemoryUsageHelper(JSONStream* js) { return vm_size; } -static const MethodParameter* get_process_memory_usage_params[] = { +static const MethodParameter* const get_process_memory_usage_params[] = { NULL, }; @@ -4506,7 +4507,7 @@ void Service::SendExtensionEvent(Isolate* isolate, Service::HandleEvent(&event); } -static const MethodParameter* get_persistent_handles_params[] = { +static const MethodParameter* const get_persistent_handles_params[] = { ISOLATE_PARAMETER, NULL, }; @@ -4594,7 +4595,7 @@ static void GetPersistentHandles(Thread* thread, JSONStream* js) { } } -static const MethodParameter* get_ports_private_params[] = { +static const MethodParameter* const get_ports_private_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -4620,7 +4621,7 @@ static void RespondWithMalformedObject(Thread* thread, JSONStream* js) { jsobj.AddProperty("bart", "simpson"); } -static const MethodParameter* get_object_params[] = { +static const MethodParameter* const get_object_params[] = { RUNNABLE_ISOLATE_PARAMETER, new UIntParameter("offset", false), new UIntParameter("count", false), @@ -4693,7 +4694,7 @@ static void GetObject(Thread* thread, JSONStream* js) { PrintInvalidParamError(js, "objectId"); } -static const MethodParameter* get_object_store_params[] = { +static const MethodParameter* const get_object_store_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -4703,7 +4704,7 @@ static void GetObjectStore(Thread* thread, JSONStream* js) { thread->isolate_group()->object_store()->PrintToJSONObject(&jsobj); } -static const MethodParameter* get_isolate_object_store_params[] = { +static const MethodParameter* const get_isolate_object_store_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -4713,7 +4714,7 @@ static void GetIsolateObjectStore(Thread* thread, JSONStream* js) { thread->isolate()->isolate_object_store()->PrintToJSONObject(&jsobj); } -static const MethodParameter* get_class_list_params[] = { +static const MethodParameter* const get_class_list_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -4724,7 +4725,7 @@ static void GetClassList(Thread* thread, JSONStream* js) { table->PrintToJSONObject(&jsobj); } -static const MethodParameter* get_type_arguments_list_params[] = { +static const MethodParameter* const get_type_arguments_list_params[] = { RUNNABLE_ISOLATE_PARAMETER, NULL, }; @@ -4760,7 +4761,7 @@ static void GetTypeArgumentsList(Thread* thread, JSONStream* js) { typeargs_table.Release(); } -static const MethodParameter* get_version_params[] = { +static const MethodParameter* const get_version_params[] = { NO_ISOLATE_PARAMETER, NULL, }; @@ -4807,7 +4808,7 @@ class SystemServiceIsolateVisitor : public IsolateVisitor { JSONArray* jsarr_; }; -static const MethodParameter* get_vm_params[] = { +static const MethodParameter* const get_vm_params[] = { NO_ISOLATE_PARAMETER, NULL, }; @@ -4904,7 +4905,7 @@ static void GetVM(Thread* thread, JSONStream* js) { Service::PrintJSONForVM(js, false); } -static const char* exception_pause_mode_names[] = { +static const char* const exception_pause_mode_names[] = { "All", "None", "Unhandled", @@ -4918,7 +4919,7 @@ static Dart_ExceptionPauseInfo exception_pause_mode_values[] = { kInvalidExceptionPauseInfo, }; -static const MethodParameter* set_exception_pause_mode_params[] = { +static const MethodParameter* const set_exception_pause_mode_params[] = { ISOLATE_PARAMETER, new EnumParameter("mode", true, exception_pause_mode_names), NULL, @@ -4945,7 +4946,7 @@ static void SetExceptionPauseMode(Thread* thread, JSONStream* js) { PrintSuccess(js); } -static const MethodParameter* set_breakpoint_state_params[] = { +static const MethodParameter* const set_breakpoint_state_params[] = { ISOLATE_PARAMETER, new IdParameter("breakpointId", true), new BoolParameter("enable", true), @@ -4974,7 +4975,7 @@ static void SetBreakpointState(Thread* thread, JSONStream* js) { bpt->PrintJSON(js); } -static const MethodParameter* get_flag_list_params[] = { +static const MethodParameter* const get_flag_list_params[] = { NO_ISOLATE_PARAMETER, NULL, }; @@ -4983,7 +4984,7 @@ static void GetFlagList(Thread* thread, JSONStream* js) { Flags::PrintJSON(js); } -static const MethodParameter* set_flags_params[] = { +static const MethodParameter* const set_flags_params[] = { NO_ISOLATE_PARAMETER, NULL, }; @@ -5062,7 +5063,7 @@ static void SetFlag(Thread* thread, JSONStream* js) { } } -static const MethodParameter* set_library_debuggable_params[] = { +static const MethodParameter* const set_library_debuggable_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("libraryId", true), new BoolParameter("isDebuggable", true), @@ -5085,7 +5086,7 @@ static void SetLibraryDebuggable(Thread* thread, JSONStream* js) { PrintInvalidParamError(js, "libraryId"); } -static const MethodParameter* set_name_params[] = { +static const MethodParameter* const set_name_params[] = { ISOLATE_PARAMETER, new MethodParameter("name", true), NULL, @@ -5102,7 +5103,7 @@ static void SetName(Thread* thread, JSONStream* js) { return; } -static const MethodParameter* set_vm_name_params[] = { +static const MethodParameter* const set_vm_name_params[] = { NO_ISOLATE_PARAMETER, new MethodParameter("name", true), NULL, @@ -5120,7 +5121,7 @@ static void SetVMName(Thread* thread, JSONStream* js) { return; } -static const MethodParameter* set_trace_class_allocation_params[] = { +static const MethodParameter* const set_trace_class_allocation_params[] = { RUNNABLE_ISOLATE_PARAMETER, new IdParameter("classId", true), new BoolParameter("enable", true), @@ -5147,7 +5148,7 @@ static void SetTraceClassAllocation(Thread* thread, JSONStream* js) { PrintSuccess(js); } -static const MethodParameter* get_default_classes_aliases_params[] = { +static const MethodParameter* const get_default_classes_aliases_params[] = { NO_ISOLATE_PARAMETER, NULL, }; diff --git a/runtime/vm/simulator_arm.cc b/runtime/vm/simulator_arm.cc index 8b6fec75fbc..78612fb3fc7 100644 --- a/runtime/vm/simulator_arm.cc +++ b/runtime/vm/simulator_arm.cc @@ -134,7 +134,7 @@ void SimulatorDebugger::Stop(Instr* instr, const char* message) { } static Register LookupCpuRegisterByName(const char* name) { - static const char* kNames[] = { + static const char* const kNames[] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "pc", "lr", "sp", "ip", "fp", "pp"}; static const Register kRegisters[] = {R0, R1, R2, R3, R4, R5, R6, R7, diff --git a/runtime/vm/simulator_arm64.cc b/runtime/vm/simulator_arm64.cc index 3b5182dc2ce..83f65d7dc03 100644 --- a/runtime/vm/simulator_arm64.cc +++ b/runtime/vm/simulator_arm64.cc @@ -139,7 +139,7 @@ void SimulatorDebugger::Stop(Instr* instr, const char* message) { } static Register LookupCpuRegisterByName(const char* name) { - static const char* kNames[] = { + static const char* const kNames[] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", diff --git a/runtime/vm/symbols.cc b/runtime/vm/symbols.cc index 23dd38117c8..fdddf3797b9 100644 --- a/runtime/vm/symbols.cc +++ b/runtime/vm/symbols.cc @@ -22,7 +22,7 @@ namespace dart { StringPtr Symbols::predefined_[Symbols::kNumberOfOneCharCodeSymbols]; String* Symbols::symbol_handles_[Symbols::kMaxPredefinedId]; -static const char* names[] = { +static const char* const names[] = { // clang-format off NULL, #define DEFINE_SYMBOL_LITERAL(symbol, literal) literal, diff --git a/runtime/vm/tags.cc b/runtime/vm/tags.cc index 8c48f2238b3..ba981ee1b51 100644 --- a/runtime/vm/tags.cc +++ b/runtime/vm/tags.cc @@ -66,9 +66,10 @@ const char* VMTag::RuntimeEntryTagName(uword id) { return nullptr; } -VMTag::TagEntry VMTag::entries_[] = { +const VMTag::TagEntry VMTag::entries_[] = { { - "InvalidTag", kInvalidTagId, + "InvalidTag", + kInvalidTagId, }, #define DEFINE_VM_TAG_ENTRY(tag) {"" #tag, k##tag##TagId}, VM_TAG_LIST(DEFINE_VM_TAG_ENTRY) diff --git a/runtime/vm/tags.h b/runtime/vm/tags.h index e8d5919c902..8e270ab3be5 100644 --- a/runtime/vm/tags.h +++ b/runtime/vm/tags.h @@ -71,7 +71,7 @@ class VMTag : public AllStatic { const char* name; uword id; }; - static TagEntry entries_[]; + static const TagEntry entries_[]; }; class VMTagScope : ThreadStackResource { diff --git a/runtime/vm/token.cc b/runtime/vm/token.cc index 52083842562..ba33707a27a 100644 --- a/runtime/vm/token.cc +++ b/runtime/vm/token.cc @@ -9,13 +9,13 @@ namespace dart { #define TOKEN_NAME(t, s, p, a) #t, -const char* Token::name_[] = {DART_TOKEN_LIST(TOKEN_NAME) - DART_KEYWORD_LIST(TOKEN_NAME)}; +const char* const Token::name_[] = {DART_TOKEN_LIST(TOKEN_NAME) + DART_KEYWORD_LIST(TOKEN_NAME)}; #undef TOKEN_NAME #define TOKEN_STRING(t, s, p, a) s, -const char* Token::tok_str_[] = {DART_TOKEN_LIST(TOKEN_STRING) - DART_KEYWORD_LIST(TOKEN_STRING)}; +const char* const Token::tok_str_[] = {DART_TOKEN_LIST(TOKEN_STRING) + DART_KEYWORD_LIST(TOKEN_STRING)}; #undef TOKEN_STRING #define TOKEN_PRECEDENCE(t, s, p, a) p, diff --git a/runtime/vm/token.h b/runtime/vm/token.h index bae07435a78..e2fc07442c7 100644 --- a/runtime/vm/token.h +++ b/runtime/vm/token.h @@ -364,8 +364,8 @@ class Token { } private: - static const char* name_[]; - static const char* tok_str_[]; + static const char* const name_[]; + static const char* const tok_str_[]; static const uint8_t precedence_[]; static const Attribute attributes_[]; };