Constify more arrays
authorAlan Modra <amodra@gmail.com>
Wed, 16 Dec 2020 22:03:39 +0000 (08:33 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 18 Dec 2020 00:04:16 +0000 (10:34 +1030)
bfd/
* coff-z80.c (bfd_howto_type): Make typedef const.
* elf32-z80.c (bfd_howto_type): Likewise.
* elf32-m32c.c (EncodingTable): Likewise.
* elf32-csky.c (csky_arch_for_merge): Likewise.
(csky_archs): Use typedef.
* elf32-m68hc11.c (m68hc11_direct_relax_table): Make const.
(find_relaxable_insn, m68hc11_elf_relax_section): Adjust to suit.
* elf32-ppc.c (ppc_alt_plt): Make const.
* elf32-rl78.c (relax_addr16): Likewise.
* targets.c (_bfd_associated_vector): Likewise.
(bfd_target_vector, bfd_associated_vector): Likewise.
* libbfd-in.h (bfd_target_vector, bfd_associated_vector): Likewise.
* libbfd.h: Regenerate.
include/
* opcode/arc-attrs.h (CONFLICT_LIST): Make const.

13 files changed:
bfd/ChangeLog
bfd/coff-z80.c
bfd/elf32-csky.c
bfd/elf32-m32c.c
bfd/elf32-m68hc11.c
bfd/elf32-ppc.c
bfd/elf32-rl78.c
bfd/elf32-z80.c
bfd/libbfd-in.h
bfd/libbfd.h
bfd/targets.c
include/ChangeLog
include/opcode/arc-attrs.h

index 40d96a86a7627be2d3d07d90aac45585fb282dce..c49faa318aeed9a0fb10226f33e189df5f45eb8a 100644 (file)
@@ -1,3 +1,19 @@
+2020-12-18  Alan Modra  <amodra@gmail.com>
+
+       * coff-z80.c (bfd_howto_type): Make typedef const.
+       * elf32-z80.c (bfd_howto_type): Likewise.
+       * elf32-m32c.c (EncodingTable): Likewise.
+       * elf32-csky.c (csky_arch_for_merge): Likewise.
+       (csky_archs): Use typedef.
+       * elf32-m68hc11.c (m68hc11_direct_relax_table): Make const.
+       (find_relaxable_insn, m68hc11_elf_relax_section): Adjust to suit.
+       * elf32-ppc.c (ppc_alt_plt): Make const.
+       * elf32-rl78.c (relax_addr16): Likewise.
+       * targets.c (_bfd_associated_vector): Likewise.
+       (bfd_target_vector, bfd_associated_vector): Likewise.
+       * libbfd-in.h (bfd_target_vector, bfd_associated_vector): Likewise.
+       * libbfd.h: Regenerate.
+
 2020-12-18  Alan Modra  <amodra@gmail.com>
 
        * ecoff.c (bfd_debug_section): Init using BFD_FAKE_SECTION.
index 16f83cfeef7370aa110676eb9b41534090fb665c..ced9074b6cb97314381a97e265ec6543a5deda14 100644 (file)
@@ -30,7 +30,7 @@
 
 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 0
 
-typedef struct {
+typedef const struct {
   bfd_reloc_code_real_type r_type;
   reloc_howto_type howto;
 } bfd_howto_type;
index 8d48a03aadff15afa60031e04618bbcc343ed8b1..9ad78cfa00f6b282057461285441d4796796d989 100644 (file)
@@ -40,7 +40,7 @@ enum merge_class
   CSKY_V2
 };
 
-typedef struct csky_arch_for_merge
+typedef const struct csky_arch_for_merge
 {
   const char *name;
   const unsigned long arch_eflag;
@@ -53,7 +53,7 @@ typedef struct csky_arch_for_merge
   unsigned int do_warning;
 } csky_arch_for_merge;
 
-static struct csky_arch_for_merge csky_archs[] =
+static csky_arch_for_merge csky_archs[] =
 {
   /* 510 and 610 merge to 610 without warning.  */
   { "ck510",  CSKY_ARCH_510,  CSKY_V1,  0, 0},
index a0452d763baf0e675511167ad0dc15775690e73e..6de8c4c76da76483bf344b28f226f638f4264122 100644 (file)
@@ -1347,7 +1347,7 @@ static int bytes_to_reloc[] = {
 /* If the displacement is within the given range and the new encoding
    differs from the old encoding (the index), then the insn can be
    relaxed to the new encoding.  */
-typedef struct {
+typedef const struct {
   int bytes;
   unsigned int max_disp;
   unsigned char new_encoding;
index 7bbb48962d2e86f3df36624d342cd6032541140b..7e6680807ee54a330b7b52cbb06d2c7f5b2883e5 100644 (file)
@@ -505,7 +505,7 @@ m68hc11_elf_bfd_link_hash_table_create (bfd *abfd)
 \f
 /* 68HC11 Linker Relaxation.  */
 
-struct m68hc11_direct_relax
+const struct m68hc11_direct_relax
 {
   const char *name;
   unsigned char code;
@@ -548,7 +548,7 @@ struct m68hc11_direct_relax
   { 0, 0, 0 }
 };
 
-static struct m68hc11_direct_relax *
+static const struct m68hc11_direct_relax *
 find_relaxable_insn (unsigned char code)
 {
   int i;
@@ -962,7 +962,7 @@ m68hc11_elf_relax_section (bfd *abfd, asection *sec,
        {
          unsigned char code;
          unsigned short offset;
-         struct m68hc11_direct_relax *rinfo;
+         const struct m68hc11_direct_relax *rinfo;
 
          prev_insn_branch = 0;
          offset = bfd_get_16 (abfd, contents + irel->r_offset);
index 66265ef6009ef69d2450449ea1b9ac861baa58b7..9d8fa66f90847e0530088837f88dfa4db62e13c3 100644 (file)
@@ -1491,7 +1491,7 @@ static const struct bfd_elf_special_section ppc_elf_special_sections[] =
 };
 
 /* This is what we want for new plt/got.  */
-static struct bfd_elf_special_section ppc_alt_plt =
+static const struct bfd_elf_special_section ppc_alt_plt =
   { STRING_COMMA_LEN (".plt"),            0, SHT_PROGBITS, SHF_ALLOC };
 
 static const struct bfd_elf_special_section *
index 3929776287fe69b79e11ab7626088a5d9f2fb9d4..dc0414e0a0d60f7fb6af5e6469a016b924e05b45 100644 (file)
@@ -1982,7 +1982,7 @@ rl78_offset_for_reloc (bfd *                      abfd,
     }
 }
 
-struct {
+const struct {
   int prefix;          /* or -1 for "no prefix" */
   int insn;            /* or -1 for "end of list" */
   int insn_for_saddr;  /* or -1 for "no alternative" */
index 89089f5eaab69da7128417ba84efba5f3e607959..b27f7afafcff103904ab51cccdf74b4602dbd891 100644 (file)
@@ -30,7 +30,7 @@
 /* All users of this file have bfd_octets_per_byte (abfd, sec) == 1.  */
 #define OCTETS_PER_BYTE(ABFD, SEC) 1
 
-typedef struct {
+typedef const struct {
   bfd_reloc_code_real_type r_type;
   reloc_howto_type howto;
 } bfd_howto_type;
index 84dba221e1b54c3e6edfdac861ccad4a7c997e46..f38304ad7debecd25321e3326e326c00161e514d 100644 (file)
@@ -825,11 +825,11 @@ extern FILE *_bfd_real_fopen
 
 /* List of supported target vectors, and the default vector (if
    bfd_default_vector[0] is NULL, there is no default).  */
-extern const bfd_target * const *bfd_target_vector ATTRIBUTE_HIDDEN;
+extern const bfd_target *const *const bfd_target_vector ATTRIBUTE_HIDDEN;
 extern const bfd_target *bfd_default_vector[] ATTRIBUTE_HIDDEN;
 
 /* List of associated target vectors.  */
-extern const bfd_target * const *bfd_associated_vector ATTRIBUTE_HIDDEN;
+extern const bfd_target *const *const bfd_associated_vector ATTRIBUTE_HIDDEN;
 
 /* Functions shared by the ECOFF and MIPS ELF backends, which have no
    other common header files.  */
index 74d7e4111d3143e6690a65b6d5fb58bb6fd85498..6384922b986b8f74c6bc2b3800ce1d67d89a95ab 100644 (file)
@@ -830,11 +830,11 @@ extern FILE *_bfd_real_fopen
 
 /* List of supported target vectors, and the default vector (if
    bfd_default_vector[0] is NULL, there is no default).  */
-extern const bfd_target * const *bfd_target_vector ATTRIBUTE_HIDDEN;
+extern const bfd_target *const *const bfd_target_vector ATTRIBUTE_HIDDEN;
 extern const bfd_target *bfd_default_vector[] ATTRIBUTE_HIDDEN;
 
 /* List of associated target vectors.  */
-extern const bfd_target * const *bfd_associated_vector ATTRIBUTE_HIDDEN;
+extern const bfd_target *const *const bfd_associated_vector ATTRIBUTE_HIDDEN;
 
 /* Functions shared by the ECOFF and MIPS ELF backends, which have no
    other common header files.  */
index b18800928c44684a2eb6a0c7babaaa3ecb7a451a..8ae5c489fc4056628962d9385cd7544af4f9174b 100644 (file)
@@ -1405,7 +1405,7 @@ static const bfd_target * const _bfd_target_vector[] =
 
        NULL /* end of list marker */
 };
-const bfd_target * const *bfd_target_vector = _bfd_target_vector;
+const bfd_target *const *const bfd_target_vector = _bfd_target_vector;
 
 /* bfd_default_vector[0] contains either the address of the default vector,
    if there is one, or zero if there isn't.  */
@@ -1420,13 +1420,13 @@ const bfd_target *bfd_default_vector[] = {
 /* bfd_associated_vector[] contains the associated target vectors used
    to reduce the ambiguity in bfd_check_format_matches.  */
 
-static const bfd_target *_bfd_associated_vector[] = {
+static const bfd_target *const _bfd_associated_vector[] = {
 #ifdef ASSOCIATED_VECS
        ASSOCIATED_VECS,
 #endif
        NULL
 };
-const bfd_target * const *bfd_associated_vector = _bfd_associated_vector;
+const bfd_target *const *const bfd_associated_vector = _bfd_associated_vector;
 
 /* When there is an ambiguous match, bfd_check_format_matches puts the
    names of the matching targets in an array.  This variable is the maximum
index 9c19b8765c9b4a749394d2f96b32975473cedf2e..24f16888a450fe02c5ce4a233ec778713f1ae92f 100644 (file)
@@ -1,3 +1,7 @@
+2020-12-18  Alan Modra  <amodra@gmail.com>
+
+       * opcode/arc-attrs.h (CONFLICT_LIST): Make const.
+
 2020-12-16  Alan Modra  <amodra@gmail.com>
 
        * bfdlink.h (struct bfd_link_info): Add maxpagesize and
index 5162db01113d7d72cd11b3e6265019fb169f6440..c12470fd8258090c1d05d3b905de582318a5f2c7 100644 (file)
@@ -58,7 +58,7 @@ const struct feature_type
 #endif
 
 /* A table with conflicting features.  */
-unsigned CONFLICT_LIST [] = {
+const unsigned CONFLICT_LIST [] = {
   NPS400 | SPX,
   NPS400 | DPX,
   DPX | DPA,
This page took 0.03397 seconds and 4 git commands to generate.