diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-06-27 01:26:30 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-06-29 20:08:10 -0400 |
commit | ba9666525f68ab75a7176bd02b7e8d0dc8c644b7 (patch) | |
tree | 603fa4516138f61109686c9c35d73d4b6dbeb563 /sim | |
parent | aa2e84dee612c8fe1d8249891a9f8fea1e4be492 (diff) | |
download | gdb-ba9666525f68ab75a7176bd02b7e8d0dc8c644b7.zip gdb-ba9666525f68ab75a7176bd02b7e8d0dc8c644b7.tar.gz gdb-ba9666525f68ab75a7176bd02b7e8d0dc8c644b7.tar.bz2 |
sim: model: constify sim_machs storage
The array of pointers is never modified, so mark it const so it ends
up in the read-only data section.
Diffstat (limited to 'sim')
-rw-r--r-- | sim/bfin/ChangeLog | 4 | ||||
-rw-r--r-- | sim/bfin/machs.c | 2 | ||||
-rw-r--r-- | sim/bpf/ChangeLog | 4 | ||||
-rw-r--r-- | sim/bpf/arch.c | 2 | ||||
-rw-r--r-- | sim/common/ChangeLog | 9 | ||||
-rw-r--r-- | sim/common/sim-model.c | 10 | ||||
-rw-r--r-- | sim/common/sim-model.h | 2 | ||||
-rw-r--r-- | sim/cris/ChangeLog | 4 | ||||
-rw-r--r-- | sim/cris/arch.c | 2 | ||||
-rw-r--r-- | sim/frv/ChangeLog | 4 | ||||
-rw-r--r-- | sim/frv/arch.c | 2 | ||||
-rw-r--r-- | sim/iq2000/ChangeLog | 4 | ||||
-rw-r--r-- | sim/iq2000/arch.c | 2 | ||||
-rw-r--r-- | sim/lm32/ChangeLog | 4 | ||||
-rw-r--r-- | sim/lm32/arch.c | 2 | ||||
-rw-r--r-- | sim/m32r/ChangeLog | 4 | ||||
-rw-r--r-- | sim/m32r/arch.c | 2 | ||||
-rw-r--r-- | sim/or1k/ChangeLog | 4 | ||||
-rw-r--r-- | sim/or1k/arch.c | 2 | ||||
-rw-r--r-- | sim/riscv/ChangeLog | 4 | ||||
-rw-r--r-- | sim/riscv/machs.c | 2 |
21 files changed, 60 insertions, 15 deletions
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog index d84d44f..a26a35a 100644 --- a/sim/bfin/ChangeLog +++ b/sim/bfin/ChangeLog @@ -1,3 +1,7 @@ +2021-06-29 Mike Frysinger <vapier@gentoo.org> + + * machs.c (sim_machs): Mark const. + 2021-06-27 Mike Frysinger <vapier@gentoo.org> * Makefile.in: Change to $(SDL_CFLAGS) & $(SDL_LIBS). diff --git a/sim/bfin/machs.c b/sim/bfin/machs.c index e94af5d..ff49bb7 100644 --- a/sim/bfin/machs.c +++ b/sim/bfin/machs.c @@ -1962,7 +1962,7 @@ static const SIM_MACH bfin_mach = bfin_prepare_run }; -const SIM_MACH *sim_machs[] = +const SIM_MACH * const sim_machs[] = { & bfin_mach, NULL diff --git a/sim/bpf/ChangeLog b/sim/bpf/ChangeLog index 046c450..2d847bb 100644 --- a/sim/bpf/ChangeLog +++ b/sim/bpf/ChangeLog @@ -1,3 +1,7 @@ +2021-06-29 Mike Frysinger <vapier@gentoo.org> + + * arch.c (sim_machs): Mark const. + 2021-06-28 Mike Frysinger <vapier@gentoo.org> * Makefile.in (SIM_WERROR_CFLAGS): Delete. diff --git a/sim/bpf/arch.c b/sim/bpf/arch.c index cb3a206..8ceaa34 100644 --- a/sim/bpf/arch.c +++ b/sim/bpf/arch.c @@ -25,7 +25,7 @@ This file is part of the GNU simulators. #include "sim-main.h" #include "bfd.h" -const SIM_MACH *sim_machs[] = +const SIM_MACH * const sim_machs[] = { #ifdef HAVE_CPU_BPFBF & bpf_mach, diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 6926fd3..7b21b00 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,5 +1,14 @@ 2021-06-29 Mike Frysinger <vapier@gentoo.org> + * sim-model.c (model_option_handler): Make machp const. + (sim_model_lookup): Likewise. + (sim_mach_lookup): Likewise. + (sim_mach_lookup_bfd_name): Likewise. + (sim_machs): Add const. + * sim-model.h (sim_machs): Likewise. + +2021-06-29 Mike Frysinger <vapier@gentoo.org> + * sim-io.h (sim_io_vprintf): Add ATTRIBUTE_PRINTF. (sim_io_evprintf): Likewise. diff --git a/sim/common/sim-model.c b/sim/common/sim-model.c index e1af9d4..bfdb3c2 100644 --- a/sim/common/sim-model.c +++ b/sim/common/sim-model.c @@ -74,7 +74,7 @@ model_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, case OPTION_MODEL_INFO : { - const SIM_MACH **machp; + const SIM_MACH * const *machp; const SIM_MODEL *model; for (machp = & sim_machs[0]; *machp != NULL; ++machp) { @@ -140,7 +140,7 @@ sim_model_set (SIM_DESC sd, sim_cpu *cpu, const SIM_MODEL *model) const SIM_MODEL * sim_model_lookup (const char *name) { - const SIM_MACH **machp; + const SIM_MACH * const *machp; const SIM_MODEL *model; for (machp = & sim_machs[0]; *machp != NULL; ++machp) @@ -160,7 +160,7 @@ sim_model_lookup (const char *name) const SIM_MACH * sim_mach_lookup (const char *name) { - const SIM_MACH **machp; + const SIM_MACH * const *machp; for (machp = & sim_machs[0]; *machp != NULL; ++machp) { @@ -176,7 +176,7 @@ sim_mach_lookup (const char *name) const SIM_MACH * sim_mach_lookup_bfd_name (const char *name) { - const SIM_MACH **machp; + const SIM_MACH * const *machp; for (machp = & sim_machs[0]; *machp != NULL; ++machp) { @@ -251,7 +251,7 @@ sim_model_init (SIM_DESC sd) #if !WITH_MODEL_P /* Set up basic model support. This is a stub for ports that do not define models. See sim-model.h for more details. */ -const SIM_MACH *sim_machs[] = +const SIM_MACH * const sim_machs[] = { NULL }; diff --git a/sim/common/sim-model.h b/sim/common/sim-model.h index 3a028d5..d6edf64 100644 --- a/sim/common/sim-model.h +++ b/sim/common/sim-model.h @@ -140,7 +140,7 @@ typedef struct model { /* ??? In a simulator of multiple architectures, will need multiple copies of this. Have an `archs' array that contains a pointer to the machs array for each (which in turn has a pointer to the models array for each). */ -extern const SIM_MACH *sim_machs[]; +extern const SIM_MACH * const sim_machs[]; /* Model module handlers. */ extern MODULE_INSTALL_FN sim_model_install; diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog index f369739..8c36ffe 100644 --- a/sim/cris/ChangeLog +++ b/sim/cris/ChangeLog @@ -1,3 +1,7 @@ +2021-06-29 Mike Frysinger <vapier@gentoo.org> + + * arch.c (sim_machs): Mark const. + 2021-06-28 Mike Frysinger <vapier@gentoo.org> * cpuv10.c (crisv10f_record_trace_results): Delete function. diff --git a/sim/cris/arch.c b/sim/cris/arch.c index 1395cc7..1635ef6 100644 --- a/sim/cris/arch.c +++ b/sim/cris/arch.c @@ -24,7 +24,7 @@ This file is part of the GNU simulators. #include "sim-main.h" #include "bfd.h" -const SIM_MACH *sim_machs[] = +const SIM_MACH * const sim_machs[] = { #ifdef HAVE_CPU_CRISV10F & crisv10_mach, diff --git a/sim/frv/ChangeLog b/sim/frv/ChangeLog index 36ea3ef..78208fb 100644 --- a/sim/frv/ChangeLog +++ b/sim/frv/ChangeLog @@ -1,3 +1,7 @@ +2021-06-29 Mike Frysinger <vapier@gentoo.org> + + * arch.c (sim_machs): Mark const. + 2021-06-28 Mike Frysinger <vapier@gentoo.org> * cpu.c (frvbf_record_trace_results): Delete function. diff --git a/sim/frv/arch.c b/sim/frv/arch.c index 80b620f..f58ed11 100644 --- a/sim/frv/arch.c +++ b/sim/frv/arch.c @@ -24,7 +24,7 @@ This file is part of the GNU simulators. #include "sim-main.h" #include "bfd.h" -const SIM_MACH *sim_machs[] = +const SIM_MACH * const sim_machs[] = { #ifdef HAVE_CPU_FRVBF & frv_mach, diff --git a/sim/iq2000/ChangeLog b/sim/iq2000/ChangeLog index a8cea4d..cc5d594 100644 --- a/sim/iq2000/ChangeLog +++ b/sim/iq2000/ChangeLog @@ -1,3 +1,7 @@ +2021-06-29 Mike Frysinger <vapier@gentoo.org> + + * arch.c (sim_machs): Mark const. + 2021-06-28 Mike Frysinger <vapier@gentoo.org> * cpu.c (iq2000bf_record_trace_results): Delete function. diff --git a/sim/iq2000/arch.c b/sim/iq2000/arch.c index 30ce2f5..22dc565 100644 --- a/sim/iq2000/arch.c +++ b/sim/iq2000/arch.c @@ -24,7 +24,7 @@ This file is part of the GNU simulators. #include "sim-main.h" #include "bfd.h" -const SIM_MACH *sim_machs[] = +const SIM_MACH * const sim_machs[] = { #ifdef HAVE_CPU_IQ2000BF & iq2000_mach, diff --git a/sim/lm32/ChangeLog b/sim/lm32/ChangeLog index bc3c5fe..689eb64 100644 --- a/sim/lm32/ChangeLog +++ b/sim/lm32/ChangeLog @@ -1,3 +1,7 @@ +2021-06-29 Mike Frysinger <vapier@gentoo.org> + + * arch.c (sim_machs): Mark const. + 2021-06-28 Mike Frysinger <vapier@gentoo.org> * cpu.c (lm32bf_record_trace_results): Delete function. diff --git a/sim/lm32/arch.c b/sim/lm32/arch.c index e8a826a..72fe4b4 100644 --- a/sim/lm32/arch.c +++ b/sim/lm32/arch.c @@ -24,7 +24,7 @@ This file is part of the GNU simulators. #include "sim-main.h" #include "bfd.h" -const SIM_MACH *sim_machs[] = +const SIM_MACH * const sim_machs[] = { #ifdef HAVE_CPU_LM32BF & lm32_mach, diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog index 00b0a7a..d8171c6 100644 --- a/sim/m32r/ChangeLog +++ b/sim/m32r/ChangeLog @@ -1,3 +1,7 @@ +2021-06-29 Mike Frysinger <vapier@gentoo.org> + + * arch.c (sim_machs): Mark const. + 2021-06-28 Mike Frysinger <vapier@gentoo.org> * cpu.c (m32rbf_record_trace_results): Delete function. diff --git a/sim/m32r/arch.c b/sim/m32r/arch.c index eb4bc06..4b78975 100644 --- a/sim/m32r/arch.c +++ b/sim/m32r/arch.c @@ -24,7 +24,7 @@ This file is part of the GNU simulators. #include "sim-main.h" #include "bfd.h" -const SIM_MACH *sim_machs[] = +const SIM_MACH * const sim_machs[] = { #ifdef HAVE_CPU_M32RBF & m32r_mach, diff --git a/sim/or1k/ChangeLog b/sim/or1k/ChangeLog index eb14a13..89a89ac 100644 --- a/sim/or1k/ChangeLog +++ b/sim/or1k/ChangeLog @@ -1,3 +1,7 @@ +2021-06-29 Mike Frysinger <vapier@gentoo.org> + + * arch.c (sim_machs): Mark const. + 2021-06-28 Mike Frysinger <vapier@gentoo.org> * cpu.c (or1k32bf_record_trace_results): Delete function. diff --git a/sim/or1k/arch.c b/sim/or1k/arch.c index 97a7a38..ef3c403 100644 --- a/sim/or1k/arch.c +++ b/sim/or1k/arch.c @@ -25,7 +25,7 @@ This file is part of the GNU simulators. #include "sim-main.h" #include "bfd.h" -const SIM_MACH *sim_machs[] = +const SIM_MACH * const sim_machs[] = { #ifdef HAVE_CPU_OR1K32BF & or32_mach, diff --git a/sim/riscv/ChangeLog b/sim/riscv/ChangeLog index bcb630a..69c0808 100644 --- a/sim/riscv/ChangeLog +++ b/sim/riscv/ChangeLog @@ -1,3 +1,7 @@ +2021-06-29 Mike Frysinger <vapier@gentoo.org> + + * machs.c (sim_machs): Mark const. + 2021-06-22 Mike Frysinger <vapier@gentoo.org> * configure: Regenerate. diff --git a/sim/riscv/machs.c b/sim/riscv/machs.c index 9ff2303..eb75a1d 100644 --- a/sim/riscv/machs.c +++ b/sim/riscv/machs.c @@ -111,7 +111,7 @@ static const SIM_MACH rv128i_mach = #endif /* Order matters here. */ -const SIM_MACH *sim_machs[] = +const SIM_MACH * const sim_machs[] = { #if WITH_TARGET_WORD_BITSIZE >= 128 &rv128i_mach, |