Apply 'const' in more places
authorTom Tromey <tromey@adacore.com>
Mon, 14 Sep 2020 18:09:59 +0000 (12:09 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 14 Sep 2020 19:31:01 +0000 (13:31 -0600)
Many global arrays in gdb could be marked "const" but are not.  This
patch changes some of them.  (There may be other arrays that could
benefit from this treatment.  I only examined arrays of strings.)

This lets the linker move some symbols to the readonly data section.
For example, previously:

0000000000000000 d _ZL18can_use_agent_enum

is now:

0000000000000030 r _ZL18can_use_agent_enum

2020-09-14  Tom Tromey  <tromey@adacore.com>

* x86-tdep.h (x86_in_indirect_branch_thunk): Update.
* x86-tdep.c (x86_is_thunk_register_name)
(x86_in_indirect_branch_thunk): Update.
* sparc64-tdep.c (sparc64_fpu_register_names)
(sparc64_cp0_register_names, sparc64_register_names)
(sparc64_pseudo_register_names): Now const.
* sparc-tdep.h (struct gdbarch_tdep) <fpu_register_names,
cp0_registers_num>: Now const.
* sparc-tdep.c (sparc_core_register_names)
(sparc32_fpu_register_names, sparc32_cp0_register_names)
(sparc32_pseudo_register_names): Now const.
(validate_tdesc_registers): Update.
* rust-lang.c (rust_extensions): Now const.
* p-lang.c (p_extensions): Now const.
* objc-lang.c (objc_extensions): Now const.
* nto-tdep.c (nto_thread_state_str): Now const.
* moxie-tdep.c (moxie_register_names): Now const.
* mips-tdep.h (struct gdbarch_tdep) <mips_processor_reg_names>:
Now const.
* mips-tdep.c (mips_generic_reg_names, mips_tx39_reg_names)
(mips_linux_reg_names): Now const.
(mips_gdbarch_init): Update.
* microblaze-tdep.c (microblaze_register_names): Now const.
* m68k-tdep.c (m68k_register_names): Now const.
* m32r-tdep.c (m32r_register_names): Now const.
* ia64-tdep.c (ia64_register_names): Now const.
* i386-tdep.h (struct gdbarch_tdep) <register_names,
ymmh_register_names, ymm16h_regnum, mpx_register_names,
k_register_names, zmmh_register_names, xmm_avx512_register_names,
ymm_avx512_register_names, pkeys_register_names>: Now const.
* i386-tdep.c (i386_register_names, i386_zmm_names)
(i386_zmmh_names, i386_k_names, i386_ymm_names, i386_ymmh_names)
(i386_mpx_names, i386_pkeys_names, i386_bnd_names)
(i386_mmx_names, i386_byte_names, i386_word_names): Now const.
* f-lang.c (f_extensions): Now const.
* d-lang.c (d_extensions): Now const.
* csky-tdep.c (csky_register_names): Now const.
* charset.c (default_charset_names, charset_enum): Now const.
(_initialize_charset): Update.
* c-lang.c (c_extensions, cplus_extensions, asm_extensions): Now
const.
* bsd-uthread.c (bsd_uthread_solib_names): Now const.
(bsd_uthread_solib_loaded): Update.
(bsd_uthread_state): Now const.
* amd64-tdep.c (amd64_register_names, amd64_ymm_names)
(amd64_ymm_avx512_names, amd64_ymmh_names)
(amd64_ymmh_avx512_names, amd64_mpx_names, amd64_k_names)
(amd64_zmmh_names, amd64_zmm_names, amd64_xmm_avx512_names)
(amd64_pkeys_names, amd64_byte_names, amd64_word_names)
(amd64_dword_names): Now const.
* agent.c (can_use_agent_enum): Now const.
* ada-tasks.c (task_states, long_task_states): Now const.
* ada-lang.c (known_runtime_file_name_patterns)
(known_auxiliary_function_name_patterns, attribute_names)
(standard_exc, ada_extensions): Now const.

gdbserver/ChangeLog
2020-09-14  Tom Tromey  <tromey@adacore.com>

* tracepoint.cc (eval_result_names): Now const.
* ax.cc (gdb_agent_op_names): Now const.

32 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/ada-tasks.c
gdb/agent.c
gdb/amd64-tdep.c
gdb/bsd-uthread.c
gdb/c-lang.c
gdb/charset.c
gdb/csky-tdep.c
gdb/d-lang.c
gdb/f-lang.c
gdb/i386-tdep.c
gdb/i386-tdep.h
gdb/ia64-tdep.c
gdb/m32r-tdep.c
gdb/m68k-tdep.c
gdb/microblaze-tdep.c
gdb/mips-tdep.c
gdb/mips-tdep.h
gdb/moxie-tdep.c
gdb/nto-tdep.c
gdb/objc-lang.c
gdb/p-lang.c
gdb/rust-lang.c
gdb/sparc-tdep.c
gdb/sparc-tdep.h
gdb/sparc64-tdep.c
gdb/x86-tdep.c
gdb/x86-tdep.h
gdbserver/ChangeLog
gdbserver/ax.cc
gdbserver/tracepoint.cc

index 0ca89098a0449cf7e69ed76051e4d4128feaadc9..771a9d520109cdb869cb24b64b47004b2bf2c509 100644 (file)
@@ -1,3 +1,61 @@
+2020-09-14  Tom Tromey  <tromey@adacore.com>
+
+       * x86-tdep.h (x86_in_indirect_branch_thunk): Update.
+       * x86-tdep.c (x86_is_thunk_register_name)
+       (x86_in_indirect_branch_thunk): Update.
+       * sparc64-tdep.c (sparc64_fpu_register_names)
+       (sparc64_cp0_register_names, sparc64_register_names)
+       (sparc64_pseudo_register_names): Now const.
+       * sparc-tdep.h (struct gdbarch_tdep) <fpu_register_names,
+       cp0_registers_num>: Now const.
+       * sparc-tdep.c (sparc_core_register_names)
+       (sparc32_fpu_register_names, sparc32_cp0_register_names)
+       (sparc32_pseudo_register_names): Now const.
+       (validate_tdesc_registers): Update.
+       * rust-lang.c (rust_extensions): Now const.
+       * p-lang.c (p_extensions): Now const.
+       * objc-lang.c (objc_extensions): Now const.
+       * nto-tdep.c (nto_thread_state_str): Now const.
+       * moxie-tdep.c (moxie_register_names): Now const.
+       * mips-tdep.h (struct gdbarch_tdep) <mips_processor_reg_names>:
+       Now const.
+       * mips-tdep.c (mips_generic_reg_names, mips_tx39_reg_names)
+       (mips_linux_reg_names): Now const.
+       (mips_gdbarch_init): Update.
+       * microblaze-tdep.c (microblaze_register_names): Now const.
+       * m68k-tdep.c (m68k_register_names): Now const.
+       * m32r-tdep.c (m32r_register_names): Now const.
+       * ia64-tdep.c (ia64_register_names): Now const.
+       * i386-tdep.h (struct gdbarch_tdep) <register_names,
+       ymmh_register_names, ymm16h_regnum, mpx_register_names,
+       k_register_names, zmmh_register_names, xmm_avx512_register_names,
+       ymm_avx512_register_names, pkeys_register_names>: Now const.
+       * i386-tdep.c (i386_register_names, i386_zmm_names)
+       (i386_zmmh_names, i386_k_names, i386_ymm_names, i386_ymmh_names)
+       (i386_mpx_names, i386_pkeys_names, i386_bnd_names)
+       (i386_mmx_names, i386_byte_names, i386_word_names): Now const.
+       * f-lang.c (f_extensions): Now const.
+       * d-lang.c (d_extensions): Now const.
+       * csky-tdep.c (csky_register_names): Now const.
+       * charset.c (default_charset_names, charset_enum): Now const.
+       (_initialize_charset): Update.
+       * c-lang.c (c_extensions, cplus_extensions, asm_extensions): Now
+       const.
+       * bsd-uthread.c (bsd_uthread_solib_names): Now const.
+       (bsd_uthread_solib_loaded): Update.
+       (bsd_uthread_state): Now const.
+       * amd64-tdep.c (amd64_register_names, amd64_ymm_names)
+       (amd64_ymm_avx512_names, amd64_ymmh_names)
+       (amd64_ymmh_avx512_names, amd64_mpx_names, amd64_k_names)
+       (amd64_zmmh_names, amd64_zmm_names, amd64_xmm_avx512_names)
+       (amd64_pkeys_names, amd64_byte_names, amd64_word_names)
+       (amd64_dword_names): Now const.
+       * agent.c (can_use_agent_enum): Now const.
+       * ada-tasks.c (task_states, long_task_states): Now const.
+       * ada-lang.c (known_runtime_file_name_patterns)
+       (known_auxiliary_function_name_patterns, attribute_names)
+       (standard_exc, ada_extensions): Now const.
+
 2020-09-14  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * bcache.h (struct bcache) <bcache>: Remove constructor.
index a2280d6b32288b5001f8471f2a5fd4f82d8a27fd..5f0e68ea892cc3e0b0ea88c62c87ae46b81c57fb 100644 (file)
@@ -315,11 +315,11 @@ static int warning_limit = 2;
    expression evaluation.  */
 static int warnings_issued = 0;
 
-static const char *known_runtime_file_name_patterns[] = {
+static const char * const known_runtime_file_name_patterns[] = {
   ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS NULL
 };
 
-static const char *known_auxiliary_function_name_patterns[] = {
+static const char * const known_auxiliary_function_name_patterns[] = {
   ADA_KNOWN_AUXILIARY_FUNCTION_NAME_PATTERNS NULL
 };
 
@@ -8828,7 +8828,7 @@ ada_to_fixed_value (struct value *val)
 /* Table mapping attribute numbers to names.
    NOTE: Keep up to date with enum ada_attribute definition in ada-lang.h.  */
 
-static const char *attribute_names[] = {
+static const char * const attribute_names[] = {
   "<?>",
 
   "first",
@@ -11503,7 +11503,7 @@ ada_modulus (struct type *type)
    an Ada83 compiler). As such, we do not include Numeric_Error from
    this list of standard exceptions.  */
 
-static const char *standard_exc[] = {
+static const char * const standard_exc[] = {
   "constraint_error",
   "program_error",
   "storage_error",
@@ -13704,7 +13704,7 @@ ada_get_symbol_name_matcher (const lookup_name_info &lookup_name)
     }
 }
 
-static const char *ada_extensions[] =
+static const char * const ada_extensions[] =
 {
   ".adb", ".ads", ".a", ".ada", ".dg", NULL
 };
index d54c8b320a40e121d504b5994945c88254ad9e4e..734b25034f46e763467d6293e337e031ab5c72d6 100644 (file)
@@ -64,7 +64,7 @@ enum task_states
 };
 
 /* A short description corresponding to each possible task state.  */
-static const char *task_states[] = {
+static const char * const task_states[] = {
   N_("Unactivated"),
   N_("Runnable"),
   N_("Terminated"),
@@ -86,7 +86,7 @@ static const char *task_states[] = {
 };
 
 /* A longer description corresponding to each possible task state.  */
-static const char *long_task_states[] = {
+static const char * const long_task_states[] = {
   N_("Unactivated"),
   N_("Runnable"),
   N_("Terminated"),
index 77ece234996e84061e888d76389bfe163956aacc..895e75efb7d895ade72b92e23872573bb4a8b444 100644 (file)
@@ -27,7 +27,7 @@
 
 static const char can_use_agent_on[] = "on";
 static const char can_use_agent_off[] = "off";
-static const char *can_use_agent_enum[] =
+static const char * const can_use_agent_enum[] =
 {
   can_use_agent_on,
   can_use_agent_off,
index 59f7c9f885f446cbc5ae6cec427bfcd5b524df36..e801f83ddbc7d3b787aec621db8c28079c9a4846 100644 (file)
@@ -59,7 +59,7 @@
 
 /* Register information.  */
 
-static const char *amd64_register_names[] = 
+static const char * const amd64_register_names[] = 
 {
   "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "rbp", "rsp",
 
@@ -77,7 +77,7 @@ static const char *amd64_register_names[] =
   "mxcsr",
 };
 
-static const char *amd64_ymm_names[] = 
+static const char * const amd64_ymm_names[] = 
 {
   "ymm0", "ymm1", "ymm2", "ymm3",
   "ymm4", "ymm5", "ymm6", "ymm7",
@@ -85,7 +85,7 @@ static const char *amd64_ymm_names[] =
   "ymm12", "ymm13", "ymm14", "ymm15"
 };
 
-static const char *amd64_ymm_avx512_names[] =
+static const char * const amd64_ymm_avx512_names[] =
 {
   "ymm16", "ymm17", "ymm18", "ymm19",
   "ymm20", "ymm21", "ymm22", "ymm23",
@@ -93,7 +93,7 @@ static const char *amd64_ymm_avx512_names[] =
   "ymm28", "ymm29", "ymm30", "ymm31"
 };
 
-static const char *amd64_ymmh_names[] = 
+static const char * const amd64_ymmh_names[] = 
 {
   "ymm0h", "ymm1h", "ymm2h", "ymm3h",
   "ymm4h", "ymm5h", "ymm6h", "ymm7h",
@@ -101,7 +101,7 @@ static const char *amd64_ymmh_names[] =
   "ymm12h", "ymm13h", "ymm14h", "ymm15h"
 };
 
-static const char *amd64_ymmh_avx512_names[] =
+static const char * const amd64_ymmh_avx512_names[] =
 {
   "ymm16h", "ymm17h", "ymm18h", "ymm19h",
   "ymm20h", "ymm21h", "ymm22h", "ymm23h",
@@ -109,18 +109,18 @@ static const char *amd64_ymmh_avx512_names[] =
   "ymm28h", "ymm29h", "ymm30h", "ymm31h"
 };
 
-static const char *amd64_mpx_names[] =
+static const char * const amd64_mpx_names[] =
 {
   "bnd0raw", "bnd1raw", "bnd2raw", "bnd3raw", "bndcfgu", "bndstatus"
 };
 
-static const char *amd64_k_names[] =
+static const char * const amd64_k_names[] =
 {
   "k0", "k1", "k2", "k3",
   "k4", "k5", "k6", "k7"
 };
 
-static const char *amd64_zmmh_names[] =
+static const char * const amd64_zmmh_names[] =
 {
   "zmm0h", "zmm1h", "zmm2h", "zmm3h",
   "zmm4h", "zmm5h", "zmm6h", "zmm7h",
@@ -132,7 +132,7 @@ static const char *amd64_zmmh_names[] =
   "zmm28h", "zmm29h", "zmm30h", "zmm31h"
 };
 
-static const char *amd64_zmm_names[] =
+static const char * const amd64_zmm_names[] =
 {
   "zmm0", "zmm1", "zmm2", "zmm3",
   "zmm4", "zmm5", "zmm6", "zmm7",
@@ -144,14 +144,14 @@ static const char *amd64_zmm_names[] =
   "zmm28", "zmm29", "zmm30", "zmm31"
 };
 
-static const char *amd64_xmm_avx512_names[] = {
+static const char * const amd64_xmm_avx512_names[] = {
     "xmm16",  "xmm17",  "xmm18",  "xmm19",
     "xmm20",  "xmm21",  "xmm22",  "xmm23",
     "xmm24",  "xmm25",  "xmm26",  "xmm27",
     "xmm28",  "xmm29",  "xmm30",  "xmm31"
 };
 
-static const char *amd64_pkeys_names[] = {
+static const char * const amd64_pkeys_names[] = {
     "pkru"
 };
 
@@ -298,7 +298,7 @@ amd64_arch_reg_to_regnum (int reg)
 
 /* Register names for byte pseudo-registers.  */
 
-static const char *amd64_byte_names[] =
+static const char * const amd64_byte_names[] =
 {
   "al", "bl", "cl", "dl", "sil", "dil", "bpl", "spl",
   "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l",
@@ -310,7 +310,7 @@ static const char *amd64_byte_names[] =
 
 /* Register names for word pseudo-registers.  */
 
-static const char *amd64_word_names[] =
+static const char * const amd64_word_names[] =
 {
   "ax", "bx", "cx", "dx", "si", "di", "bp", "", 
   "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
@@ -318,7 +318,7 @@ static const char *amd64_word_names[] =
 
 /* Register names for dword pseudo-registers.  */
 
-static const char *amd64_dword_names[] =
+static const char * const amd64_dword_names[] =
 {
   "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp", 
   "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d",
index 15d538c16db5f470a4213b565f293c1cd3ba3b7f..11ce0f439bfe2458d2b513780227103ac1525dec 100644 (file)
@@ -269,7 +269,7 @@ bsd_uthread_inferior_created (struct target_ops *ops, int from_tty)
 }
 
 /* Likely candidates for the threads library.  */
-static const char *bsd_uthread_solib_names[] =
+static const char * const bsd_uthread_solib_names[] =
 {
   "/usr/lib/libc_r.so",                /* FreeBSD */
   "/usr/lib/libpthread.so",    /* OpenBSD */
@@ -279,7 +279,7 @@ static const char *bsd_uthread_solib_names[] =
 static void
 bsd_uthread_solib_loaded (struct so_list *so)
 {
-  const char **names = bsd_uthread_solib_names;
+  const char * const *names = bsd_uthread_solib_names;
 
   for (names = bsd_uthread_solib_names; *names; names++)
     {
@@ -488,7 +488,7 @@ bsd_uthread_target::update_thread_list ()
 }
 
 /* Possible states a thread can be in.  */
-static const char *bsd_uthread_state[] =
+static const char * const bsd_uthread_state[] =
 {
   "RUNNING",
   "SIGTHREAD",
index f29f2cef610458974ccc5f83342d6efaaf8ce624..03628704349428438af2e1d653aff953637ffe3a 100644 (file)
@@ -871,7 +871,7 @@ const struct exp_descriptor exp_descriptor_c =
   evaluate_subexp_c
 };
 
-static const char *c_extensions[] =
+static const char * const c_extensions[] =
 {
   ".c", NULL
 };
@@ -972,7 +972,7 @@ enum cplus_primitive_types {
   nr_cplus_primitive_types
 };
 
-static const char *cplus_extensions[] =
+static const char * const cplus_extensions[] =
 {
   ".C", ".cc", ".cp", ".cpp", ".cxx", ".c++", NULL
 };
@@ -1170,7 +1170,7 @@ protected:
 
 static cplus_language cplus_language_defn;
 
-static const char *asm_extensions[] =
+static const char * const asm_extensions[] =
 {
   ".s", ".sx", ".S", NULL
 };
index 4e459c2b45d8a85144e9320f14c688524acc8a5b..a72eb03bc0083eb8e3e2e67e4e8540d4c873d936 100644 (file)
@@ -271,13 +271,13 @@ show_target_wide_charset_name (struct ui_file *file,
                      value);
 }
 
-static const char *default_charset_names[] =
+static const char * const default_charset_names[] =
 {
   DEFAULT_CHARSET_NAMES
   0
 };
 
-static const char **charset_enum;
+static const char * const *charset_enum;
 
 \f
 /* If the target wide character set has big- or little-endian
@@ -1004,7 +1004,7 @@ _initialize_charset ()
   find_charset_names ();
 
   if (charsets.charsets.size () > 1)
-    charset_enum = (const char **) charsets.charsets.data ();
+    charset_enum = (const char * const *) charsets.charsets.data ();
   else
     charset_enum = default_charset_names;
 
index c9245fc4ac7763a16cce05789aed65664fd652a4..f2015a40ac3245fba03281df21dae0200e887278 100644 (file)
@@ -162,7 +162,7 @@ csky_write_pc (regcache *regcache, CORE_ADDR val)
 
 /* C-Sky ABI register names.  */
 
-static const char *csky_register_names[] =
+static const char * const csky_register_names[] =
 {
   /* General registers 0 - 31.  */
   "r0",  "r1",  "r2",  "r3",  "r4",  "r5",  "r6",  "r7",
index 4ebb011ee9b0374251209123a646939a554bc209..837a064600362d9a89bbb076a54b0f93df5f976d 100644 (file)
@@ -124,7 +124,7 @@ enum d_primitive_types {
   nr_d_primitive_types
 };
 
-static const char *d_extensions[] =
+static const char * const d_extensions[] =
 {
   ".d", NULL
 };
index 54d56f0d78170e7c2eefbdf9e168944846a77582..49f7b0368e2a55346bf1d70a96ab38e320d68429 100644 (file)
@@ -471,7 +471,7 @@ operator_check_f (struct expression *exp, int pos,
   return 0;
 }
 
-static const char *f_extensions[] =
+static const char * const f_extensions[] =
 {
   ".f", ".F", ".for", ".FOR", ".ftn", ".FTN", ".fpp", ".FPP",
   ".f90", ".F90", ".f95", ".F95", ".f03", ".F03", ".f08", ".F08",
index 64e42dcbfe62b80c2929de1b788317c232c29e8f..14e5b310a2a9faafdd118272510bb63761ace2b6 100644 (file)
@@ -69,7 +69,7 @@
 
 /* Register names.  */
 
-static const char *i386_register_names[] =
+static const char * const i386_register_names[] =
 {
   "eax",   "ecx",    "edx",   "ebx",
   "esp",   "ebp",    "esi",   "edi",
@@ -84,56 +84,56 @@ static const char *i386_register_names[] =
   "mxcsr"
 };
 
-static const char *i386_zmm_names[] =
+static const char * const i386_zmm_names[] =
 {
   "zmm0",  "zmm1",   "zmm2",  "zmm3",
   "zmm4",  "zmm5",   "zmm6",  "zmm7"
 };
 
-static const char *i386_zmmh_names[] =
+static const char * const i386_zmmh_names[] =
 {
   "zmm0h",  "zmm1h",   "zmm2h",  "zmm3h",
   "zmm4h",  "zmm5h",   "zmm6h",  "zmm7h"
 };
 
-static const char *i386_k_names[] =
+static const char * const i386_k_names[] =
 {
   "k0",  "k1",   "k2",  "k3",
   "k4",  "k5",   "k6",  "k7"
 };
 
-static const char *i386_ymm_names[] =
+static const char * const i386_ymm_names[] =
 {
   "ymm0",  "ymm1",   "ymm2",  "ymm3",
   "ymm4",  "ymm5",   "ymm6",  "ymm7",
 };
 
-static const char *i386_ymmh_names[] =
+static const char * const i386_ymmh_names[] =
 {
   "ymm0h",  "ymm1h",   "ymm2h",  "ymm3h",
   "ymm4h",  "ymm5h",   "ymm6h",  "ymm7h",
 };
 
-static const char *i386_mpx_names[] =
+static const char * const i386_mpx_names[] =
 {
   "bnd0raw", "bnd1raw", "bnd2raw", "bnd3raw", "bndcfgu", "bndstatus"
 };
 
-static const char* i386_pkeys_names[] =
+static const char * const i386_pkeys_names[] =
 {
   "pkru"
 };
 
 /* Register names for MPX pseudo-registers.  */
 
-static const char *i386_bnd_names[] =
+static const char * const i386_bnd_names[] =
 {
   "bnd0", "bnd1", "bnd2", "bnd3"
 };
 
 /* Register names for MMX pseudo-registers.  */
 
-static const char *i386_mmx_names[] =
+static const char * const i386_mmx_names[] =
 {
   "mm0", "mm1", "mm2", "mm3",
   "mm4", "mm5", "mm6", "mm7"
@@ -141,7 +141,7 @@ static const char *i386_mmx_names[] =
 
 /* Register names for byte pseudo-registers.  */
 
-static const char *i386_byte_names[] =
+static const char * const i386_byte_names[] =
 {
   "al", "cl", "dl", "bl", 
   "ah", "ch", "dh", "bh"
@@ -149,7 +149,7 @@ static const char *i386_byte_names[] =
 
 /* Register names for word pseudo-registers.  */
 
-static const char *i386_word_names[] =
+static const char * const i386_word_names[] =
 {
   "ax", "cx", "dx", "bx",
   "", "bp", "si", "di"
index 79b3b1f942898eb9b67b405294100ce0ff4ce3da..c61ffcfb76ecaa011b30ef9d717efc56d4030767 100644 (file)
@@ -145,21 +145,21 @@ struct gdbarch_tdep
   int xsave_xcr0_offset;
 
   /* Register names.  */
-  const char **register_names;
+  const char * const *register_names;
 
   /* Register number for %ymm0h.  Set this to -1 to indicate the absence
      of upper YMM register support.  */
   int ymm0h_regnum;
 
   /* Upper YMM register names.  Only used for tdesc_numbered_register.  */
-  const char **ymmh_register_names;
+  const char * const *ymmh_register_names;
 
   /* Register number for %ymm16h.  Set this to -1 to indicate the absence
   of support for YMM16-31.  */
   int ymm16h_regnum;
 
   /* YMM16-31 register names.  Only used for tdesc_numbered_register.  */
-  const char **ymm16h_register_names;
+  const char * const *ymm16h_register_names;
 
   /* Register number for %bnd0r.  Set this to -1 to indicate the absence
      bound registers.  */
@@ -174,23 +174,23 @@ struct gdbarch_tdep
   int bndcfgu_regnum;
 
   /* MPX register names.  Only used for tdesc_numbered_register.  */
-  const char **mpx_register_names;
+  const char * const *mpx_register_names;
 
   /* Register number for %zmm0h.  Set this to -1 to indicate the absence
      of ZMM_HI256 register support.  */
   int zmm0h_regnum;
 
   /* OpMask register names.  */
-  const char **k_register_names;
+  const char * const *k_register_names;
 
   /* ZMM register names.  Only used for tdesc_numbered_register.  */
-  const char **zmmh_register_names;
+  const char * const *zmmh_register_names;
 
   /* XMM16-31 register names.  Only used for tdesc_numbered_register.  */
-  const char **xmm_avx512_register_names;
+  const char * const *xmm_avx512_register_names;
 
   /* YMM16-31 register names.  Only used for tdesc_numbered_register.  */
-  const char **ymm_avx512_register_names;
+  const char * const *ymm_avx512_register_names;
 
   /* Number of PKEYS registers.  */
   int num_pkeys_regs;
@@ -199,7 +199,7 @@ struct gdbarch_tdep
   int pkru_regnum;
 
   /* PKEYS register names.  */
-  const char **pkeys_register_names;
+  const char * const *pkeys_register_names;
 
   /* Register number for %fsbase.  Set this to -1 to indicate the
      absence of segment base registers.  */
index 6abf8336954c115499b9e985d29574a49adba736..72093b643eacd9f0721f2cfad7f752b97767c0f4 100644 (file)
@@ -144,7 +144,7 @@ enum pseudo_regs { FIRST_PSEUDO_REGNUM = NUM_IA64_RAW_REGS,
 /* Array of register names; There should be ia64_num_regs strings in
    the initializer.  */
 
-static const char *ia64_register_names[] =
+static const char * const ia64_register_names[] =
 { "r0",   "r1",   "r2",   "r3",   "r4",   "r5",   "r6",   "r7",
   "r8",   "r9",   "r10",  "r11",  "r12",  "r13",  "r14",  "r15",
   "r16",  "r17",  "r18",  "r19",  "r20",  "r21",  "r22",  "r23",
index 011a0d2a9c347b659850314c9b83180ac65806aa..e8bf33dda173810a34dc1b8c8ac25a6f637cc36e 100644 (file)
@@ -202,7 +202,7 @@ m32r_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
     }
 }
 
-static const char *m32r_register_names[] = {
+static const char * const m32r_register_names[] = {
   "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
   "r8", "r9", "r10", "r11", "r12", "fp", "lr", "sp",
   "psw", "cbr", "spi", "spu", "bpc", "pc", "accl", "acch",
index 7685c5da1bb8bc89ab16750f4b97c9fd36855441..76046c0b1dd583e7740a6e22d51c09684b3ddad7 100644 (file)
@@ -157,7 +157,7 @@ m68k_register_type (struct gdbarch *gdbarch, int regnum)
   return builtin_type (gdbarch)->builtin_int32;
 }
 
-static const char *m68k_register_names[] = {
+static const char * const m68k_register_names[] = {
     "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
     "a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp",
     "ps", "pc",
index 5c804133040df7ab0e9f03fecaffc0f4c3912279..edabe9eb5431c6474f340b3c65c8f66b3c7071fa 100644 (file)
@@ -65,7 +65,7 @@
 
 /* The registers of the Xilinx microblaze processor.  */
 
-static const char *microblaze_register_names[] =
+static const char * const microblaze_register_names[] =
 {
   "r0",   "r1",  "r2",    "r3",   "r4",   "r5",   "r6",   "r7",
   "r8",   "r9",  "r10",   "r11",  "r12",  "r13",  "r14",  "r15",
index 9e2a9cba529c9d8ec18fed0bb67f363af94fb701..48ee82228d94d8288cd2acaee7d2a6e159002997 100644 (file)
@@ -578,7 +578,7 @@ enum
 
 /* Generic MIPS.  */
 
-static const char *mips_generic_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
+static const char * const mips_generic_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
   "sr", "lo", "hi", "bad", "cause", "pc",
   "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
   "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
@@ -589,7 +589,7 @@ static const char *mips_generic_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
 
 /* Names of tx39 registers.  */
 
-static const char *mips_tx39_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
+static const char * const mips_tx39_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
   "sr", "lo", "hi", "bad", "cause", "pc",
   "", "", "", "", "", "", "", "",
   "", "", "", "", "", "", "", "",
@@ -601,7 +601,7 @@ static const char *mips_tx39_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
 };
 
 /* Names of registers with Linux kernels.  */
-static const char *mips_linux_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
+static const char * const mips_linux_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
   "sr", "lo", "hi", "bad", "cause", "pc",
   "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
   "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
@@ -8049,7 +8049,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   enum mips_fpu_type fpu_type;
   struct tdesc_arch_data *tdesc_data = NULL;
   int elf_fpu_type = Val_GNU_MIPS_ABI_FP_ANY;
-  const char **reg_names;
+  const char * const *reg_names;
   struct mips_regnum mips_regnum, *regnum;
   enum mips_isa mips_isa;
   int dspacc;
index 99546201395c65b35f9c6a519640b27f5d9cd545..513466820aac2afef55f0c83968acc362569b9d8 100644 (file)
@@ -104,7 +104,7 @@ struct gdbarch_tdep
      add any that do not need to be public.  */
   const struct mips_regnum *regnum;
   /* Register names table for the current register set.  */
-  const char **mips_processor_reg_names;
+  const char * const *mips_processor_reg_names;
 
   /* The size of register data available from the target, if known.
      This doesn't quite obsolete the manual
index 1f552481662c4c422ed35550d7ad268eeb8a66aa..e5d3c52190ba4a2e0d82084817e55f3f6a5739a2 100644 (file)
@@ -70,7 +70,7 @@ typedef BP_MANIPULATION (moxie_break_insn) moxie_breakpoint;
 
 /* Moxie register names.  */
 
-static const char *moxie_register_names[] = {
+static const char * const moxie_register_names[] = {
   "$fp",  "$sp",  "$r0",  "$r1",  "$r2",
   "$r3",  "$r4",  "$r5", "$r6", "$r7",
   "$r8", "$r9", "$r10", "$r11", "$r12",
index a16cc8df87aa83cea6db466453d97d51a736e764..e1b776415bbfe0994facd8171a6ec552ec6165b3 100644 (file)
@@ -355,7 +355,7 @@ nto_elf_osabi_sniffer (bfd *abfd)
   return osabi;
 }
 
-static const char *nto_thread_state_str[] =
+static const char * const nto_thread_state_str[] =
 {
   "DEAD",              /* 0  0x00 */
   "RUNNING",   /* 1  0x01 */
index 63cdac1b03568653e9a2c080e58717e579eb6f68..4e1d2cdcf2d8123dcd8409df7d34bfb9ef1d3d36 100644 (file)
@@ -319,7 +319,7 @@ static const struct op_print objc_op_print_tab[] =
     {NULL, OP_NULL, PREC_NULL, 0}
 };
 
-static const char *objc_extensions[] =
+static const char * const objc_extensions[] =
 {
   ".m", NULL
 };
index 07afbdda5bb4866e4026c6632dc98b5f3691152d..18490843a994b4912be94efcc2ddca71a4f9a47a 100644 (file)
@@ -248,7 +248,7 @@ enum pascal_primitive_types {
   nr_pascal_primitive_types
 };
 
-static const char *p_extensions[] =
+static const char * const p_extensions[] =
 {
   ".pas", ".p", ".pp", NULL
 };
index b8ab59bd207b32152722fa3356e11159a833d4ba..0bc65eb15bcf20697fa9cefdde3de653ce71d5e9 100644 (file)
@@ -1902,7 +1902,7 @@ static const struct exp_descriptor exp_descriptor_rust =
   rust_evaluate_subexp
 };
 
-static const char *rust_extensions[] =
+static const char * const rust_extensions[] =
 {
   ".rs", NULL
 };
index 681b8009008334ca95098fd1be11d51f845fa1a3..e3401fe33eea13ed0bf1c3ac1268b7548169cfb3 100644 (file)
@@ -363,11 +363,17 @@ sparc_arg_by_memory_p (const struct type *type)
 #define SPARC32_CP0_REGISTERS \
   "y", "psr", "wim", "tbr", "pc", "npc", "fsr", "csr"
 
-static const char *sparc_core_register_names[] = { SPARC_CORE_REGISTERS };
-static const char *sparc32_fpu_register_names[] = { SPARC32_FPU_REGISTERS };
-static const char *sparc32_cp0_register_names[] = { SPARC32_CP0_REGISTERS };
+static const char * const sparc_core_register_names[] = {
+  SPARC_CORE_REGISTERS
+};
+static const char * const sparc32_fpu_register_names[] = {
+  SPARC32_FPU_REGISTERS
+};
+static const char * const sparc32_cp0_register_names[] = {
+  SPARC32_CP0_REGISTERS
+};
 
-static const char *sparc32_register_names[] =
+static const char * const sparc32_register_names[] =
 {
   SPARC_CORE_REGISTERS,
   SPARC32_FPU_REGISTERS,
@@ -380,7 +386,7 @@ static const char *sparc32_register_names[] =
 /* We provide the aliases %d0..%d30 for the floating registers as
    "psuedo" registers.  */
 
-static const char *sparc32_pseudo_register_names[] =
+static const char * const sparc32_pseudo_register_names[] =
 {
   "d0", "d2", "d4", "d6", "d8", "d10", "d12", "d14",
   "d16", "d18", "d20", "d22", "d24", "d26", "d28", "d30"
@@ -1784,7 +1790,7 @@ static int
 validate_tdesc_registers (const struct target_desc *tdesc,
                           struct tdesc_arch_data *tdesc_data,
                           const char *feature_name,
-                          const char *register_names[],
+                          const char * const register_names[],
                           unsigned int registers_num,
                           unsigned int reg_start)
 {
index 625b3e8914a89300d678e61fe9bef45445e09b0e..594f47a40380ee0e6f7f4ad6a58fcd8c664215f2 100644 (file)
@@ -64,9 +64,9 @@ struct gdbarch_tdep
   int npc_regnum;
 
   /* Register names specific for architecture (sparc32 vs. sparc64) */
-  const char **fpu_register_names;
+  const char * const *fpu_register_names;
   size_t fpu_registers_num;
-  const char **cp0_register_names;
+  const char * const *cp0_register_names;
   size_t cp0_registers_num;
 
   /* Register sets.  */
index 95979ab76f507b207096eb2b3b2eba814be5fd39..372df041905cbfcb0d4c6f0b02cd055acdd22cfa 100644 (file)
@@ -764,10 +764,14 @@ sparc64_fprs_type (struct gdbarch *gdbarch)
   "fprs",                                                                 \
   "y"
 
-static const char *sparc64_fpu_register_names[] = { SPARC64_FPU_REGISTERS };
-static const char *sparc64_cp0_register_names[] = { SPARC64_CP0_REGISTERS };
+static const char * const sparc64_fpu_register_names[] = {
+  SPARC64_FPU_REGISTERS
+};
+static const char * const sparc64_cp0_register_names[] = {
+  SPARC64_CP0_REGISTERS
+};
 
-static const char *sparc64_register_names[] =
+static const char * const sparc64_register_names[] =
 {
   SPARC_CORE_REGISTERS,
   SPARC64_FPU_REGISTERS,
@@ -780,7 +784,7 @@ static const char *sparc64_register_names[] =
 /* We provide the aliases %d0..%d62 and %q0..%q60 for the floating
    registers as "psuedo" registers.  */
 
-static const char *sparc64_pseudo_register_names[] =
+static const char * const sparc64_pseudo_register_names[] =
 {
   "cwp", "pstate", "asi", "ccr",
 
index 5f03cfe910996b5eb90d935bc5b9157225c5febb..8b1ea34c89849000e66e81c6bb0e603865783cfa 100644 (file)
@@ -26,8 +26,8 @@
    (exclusive).  */
 
 static bool
-x86_is_thunk_register_name (const char *name, const char **names, int lo,
-                           int hi)
+x86_is_thunk_register_name (const char *name, const char * const *names,
+                           int lo, int hi)
 {
   int reg;
   for (reg = lo; reg < hi; ++reg)
@@ -40,7 +40,7 @@ x86_is_thunk_register_name (const char *name, const char **names, int lo,
 /* See x86-tdep.h.  */
 
 bool
-x86_in_indirect_branch_thunk (CORE_ADDR pc, const char **register_names,
+x86_in_indirect_branch_thunk (CORE_ADDR pc, const char * const *register_names,
                              int lo, int hi)
 {
   struct bound_minimal_symbol bmfun = lookup_minimal_symbol_by_pc (pc);
index 6ff62db3ff1fb39c73f756c1b06ab14645c3d4d7..0f3e4256bc5c62c395ae18cf6ec5138b4edc792f 100644 (file)
@@ -24,7 +24,7 @@
    REGISTER_NAMES[LO] (inclusive) to REGISTER_NAMES[HI] (exclusive).  */
 
 extern bool x86_in_indirect_branch_thunk (CORE_ADDR pc,
-                                         const char **register_names,
+                                         const char * const *register_names,
                                          int lo, int hi);
 
 #endif /* x86-tdep.h */
index 0c8af7c6c101dd286ff3aa6415708b71fac376ee..3b08ef393bc173c5ba6df39429e351014fca603f 100644 (file)
@@ -1,3 +1,8 @@
+2020-09-14  Tom Tromey  <tromey@adacore.com>
+
+       * tracepoint.cc (eval_result_names): Now const.
+       * ax.cc (gdb_agent_op_names): Now const.
+
 2020-09-10  Kamil Rytarowski  <n54@gmx.com>
 
        * netbsd-low.cc: Add.
index 42d28128fa6afe24c38ddacd1d783306d40e8a28..361e7a272f7e53d0ade3e7139e3052058f7f84a9 100644 (file)
@@ -65,7 +65,7 @@ enum gdb_agent_op
     gdb_agent_op_last
   };
 
-static const char *gdb_agent_op_names [gdb_agent_op_last] =
+static const char * const gdb_agent_op_names [gdb_agent_op_last] =
   {
     "?undef?"
 #define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE)  , # NAME
index e587d6561dccd124f490fbdf1cc8e8ae6e710261..6881f31c0cecf610a0c02d2242e090a536e7be1b 100644 (file)
@@ -863,7 +863,7 @@ EXTERN_C_POP
 
 static struct tracepoint *last_tracepoint;
 
-static const char *eval_result_names[] =
+static const char * const eval_result_names[] =
   {
     "terror:in the attic",  /* this should never be reported */
     "terror:empty expression",