This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] add more const qualifiers


From: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>

Hi,
more of the same, but I think its very close to the end.

built and regtested for x86_64-linux-gnu, aarch64-elf, arm-linux-gnueabi,
nds32be-elf, and xtensa-elf, ok?

Trev

gas/ChangeLog:

2016-03-28  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/obj-elf.c (obj_elf_section_name): Return const char *.
	* config/obj-elf.h (obj_elf_section_name): Adjust.
	* config/tc-aarch64.c (aarch64_parse_features): Likewise.
	(aarch64_parse_cpu): Likewise.
	(aarch64_parse_arch): Likewise.
	* config/tc-arm.c (arm_parse_extension): Likewise.
	(arm_parse_cpu): Likewise.
	(arm_parse_arch): Likewise.
	* config/tc-nds32.c: Likewise.
	* config/xtensa-relax.c (parse_special_fn): Likewise.
	* stabs.c (generate_asm_file): Likewise.
---
 gas/config/obj-elf.c      | 5 +++--
 gas/config/obj-elf.h      | 2 +-
 gas/config/tc-aarch64.c   | 8 ++++----
 gas/config/tc-arm.c       | 8 ++++----
 gas/config/tc-nds32.c     | 6 +++---
 gas/config/xtensa-relax.c | 2 +-
 gas/stabs.c               | 2 +-
 7 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index c7a4ee4..40c6e35 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -918,7 +918,7 @@ obj_elf_section_word (char *str, size_t len, int *type)
 }
 
 /* Get name of section.  */
-char *
+const char *
 obj_elf_section_name (void)
 {
   char *name;
@@ -984,7 +984,8 @@ obj_elf_section_name (void)
 void
 obj_elf_section (int push)
 {
-  char *name, *group_name, *beg;
+  const char *name, *group_name;
+  char *beg;
   int type, dummy;
   bfd_vma attr;
   int entsize;
diff --git a/gas/config/obj-elf.h b/gas/config/obj-elf.h
index 257d877..02b3f74 100644
--- a/gas/config/obj-elf.h
+++ b/gas/config/obj-elf.h
@@ -155,7 +155,7 @@ extern void elf_file_symbol (const char *, int);
 extern void obj_elf_section_change_hook (void);
 
 extern void obj_elf_section (int);
-extern char * obj_elf_section_name (void);
+extern const char * obj_elf_section_name (void);
 extern void obj_elf_previous (int);
 extern void obj_elf_version (int);
 extern void obj_elf_common (int);
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 64a732b..5c60dd8 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -7830,7 +7830,7 @@ struct aarch64_long_option_table
 };
 
 static int
-aarch64_parse_features (char *str, const aarch64_feature_set **opt_p,
+aarch64_parse_features (const char *str, const aarch64_feature_set **opt_p,
 			bfd_boolean ext_only)
 {
   /* We insist on extensions being added before being removed.  We achieve
@@ -7847,7 +7847,7 @@ aarch64_parse_features (char *str, const aarch64_feature_set **opt_p,
   while (str != NULL && *str != 0)
     {
       const struct aarch64_option_cpu_value_table *opt;
-      char *ext = NULL;
+      const char *ext = NULL;
       int optlen;
 
       if (!ext_only)
@@ -7920,7 +7920,7 @@ static int
 aarch64_parse_cpu (char *str)
 {
   const struct aarch64_cpu_option_table *opt;
-  char *ext = strchr (str, '+');
+  const char *ext = strchr (str, '+');
   size_t optlen;
 
   if (ext != NULL)
@@ -7952,7 +7952,7 @@ static int
 aarch64_parse_arch (char *str)
 {
   const struct aarch64_arch_option_table *opt;
-  char *ext = strchr (str, '+');
+  const char *ext = strchr (str, '+');
   size_t optlen;
 
   if (ext != NULL)
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 4cc808d..eb842d5 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -25586,7 +25586,7 @@ struct arm_long_option_table
 };
 
 static bfd_boolean
-arm_parse_extension (char *str, const arm_feature_set **opt_p)
+arm_parse_extension (const char *str, const arm_feature_set **opt_p)
 {
   arm_feature_set *ext_set = (arm_feature_set *)
       xmalloc (sizeof (arm_feature_set));
@@ -25606,7 +25606,7 @@ arm_parse_extension (char *str, const arm_feature_set **opt_p)
 
   while (str != NULL && *str != 0)
     {
-      char *ext;
+      const char *ext;
       size_t len;
 
       if (*str != '+')
@@ -25712,7 +25712,7 @@ static bfd_boolean
 arm_parse_cpu (char *str)
 {
   const struct arm_cpu_option_table *opt;
-  char *ext = strchr (str, '+');
+  const char *ext = strchr (str, '+');
   size_t len;
 
   if (ext != NULL)
@@ -25762,7 +25762,7 @@ static bfd_boolean
 arm_parse_arch (char *str)
 {
   const struct arm_arch_option_table *opt;
-  char *ext = strchr (str, '+');
+  const char *ext = strchr (str, '+');
   size_t len;
 
   if (ext != NULL)
diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c
index 66b8136..90b4d27 100644
--- a/gas/config/tc-nds32.c
+++ b/gas/config/tc-nds32.c
@@ -2986,7 +2986,7 @@ nds32_init_nds32_pseudo_opcodes (void)
 }
 
 static struct nds32_pseudo_opcode *
-nds32_lookup_pseudo_opcode (char *str)
+nds32_lookup_pseudo_opcode (const char *str)
 {
   int i = 0;
   /* Assume pseudo-opcode are less than 16-char in length.  */
@@ -4138,7 +4138,7 @@ nds32_elf_save_pseudo_pattern (fixS* fixP, struct nds32_opcode *opcode,
 /* Check X_md to transform relocation.  */
 
 static fixS*
-nds32_elf_record_fixup_exp (fragS *fragP, char *str,
+nds32_elf_record_fixup_exp (fragS *fragP, const char *str,
 			    const struct nds32_field *fld,
 			    expressionS *pexp, char* out,
 			    struct nds32_asm_insn *insn)
@@ -5102,7 +5102,7 @@ restore:
 /* Check instruction if it can be used for the baseline.  */
 
 static bfd_boolean
-nds32_check_insn_available (struct nds32_asm_insn insn, char *str)
+nds32_check_insn_available (struct nds32_asm_insn insn, const char *str)
 {
   int attr = insn.attr & ATTR_ALL;
   static int baseline_isa = 0;
diff --git a/gas/config/xtensa-relax.c b/gas/config/xtensa-relax.c
index a67fbe6..3adbf2a 100644
--- a/gas/config/xtensa-relax.c
+++ b/gas/config/xtensa-relax.c
@@ -1024,7 +1024,7 @@ parse_special_fn (const char *name,
 		  const char **fn_name_p,
 		  const char **arg_name_p)
 {
-  char *p_start;
+  const char *p_start;
   const char *p_end;
 
   p_start = strchr (name, '(');
diff --git a/gas/stabs.c b/gas/stabs.c
index c489af0..8d54f73 100644
--- a/gas/stabs.c
+++ b/gas/stabs.c
@@ -545,7 +545,7 @@ generate_asm_file (int type, const char *file)
 
   while (tmp < file_endp)
     {
-      char *bslash = strchr (tmp, '\\');
+      const char *bslash = strchr (tmp, '\\');
       size_t len = (bslash) ? (size_t) (bslash - tmp + 1) : strlen (tmp);
 
       /* Double all backslashes, since demand_copy_C_string (used by
-- 
2.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]