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] make md_parse_option () take a const char *


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

Hi,

This is mostly just adding const in many places, however there are a couple
interesting things.  We need to add casts in tc-s390.c and tc-cris.c because
they have functions that assign to input_line_pointer an argument that
sometimes comes from md_parse_option.  Presumably this is safe because those
targets never pass literals to md_parse_option (), but this code should
probably be improved in the future.  Also xtensa passes the argument to strtoll
which is a rather odd function, it takes a const char * as argument and returns
a pointer into that string as a char * through an out argument, but we can work
around that by adding more variables.

I built one target for each tc-*.c, and regtested x86_64-linux-gnu, ok?

Trev

gas/ChangeLog:

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

	* config/tc-aarch64.c (struct aarch64_long_option_table): Ad const
	qualifier.
	* config/tc-alpha.c (md_parse_option): Likewise.
	* config/tc-arc.c (md_parse_option): Likewise.
	* config/tc-arm.c (struct arm_long_option_table): Likewise.
	(md_parse_option): Likewise.
	* config/tc-avr.c (md_parse_option): Likewise.
	* config/tc-bfin.c (md_parse_option): Likewise.
	* config/tc-cr16.c (md_parse_option): Likewise.
	* config/tc-cris.c (s_cris_arch): Likewise.
	(md_parse_option): Likewise.
	* config/tc-crx.c (md_parse_option): Likewise.
	* config/tc-d10v.c (md_parse_option): Likewise.
	* config/tc-d30v.c (md_parse_option): Likewise.
	* config/tc-dlx.c (md_parse_option): Likewise.
	* config/tc-epiphany.c (md_parse_option): Likewise.
	* config/tc-fr30.c (md_parse_option): Likewise.
	* config/tc-frv.c (md_parse_option): Likewise.
	* config/tc-ft32.c (md_parse_option): Likewise.
	* config/tc-h8300.c (md_parse_option): Likewise.
	* config/tc-hppa.c (md_parse_option): Likewise.
	* config/tc-i370.c (md_parse_option): Likewise.
	* config/tc-i386.c (md_parse_option): Likewise.
	* config/tc-i860.c (md_parse_option): Likewise.
	* config/tc-i960.c (md_parse_option): Likewise.
	* config/tc-ia64.c (md_parse_option): Likewise.
	* config/tc-ip2k.c (md_parse_option): Likewise.
	* config/tc-iq2000.c (md_parse_option): Likewise.
	* config/tc-lm32.c (md_parse_option): Likewise.
	* config/tc-m32c.c (md_parse_option): Likewise.
	* config/tc-m32r.c (md_parse_option): Likewise.
	* config/tc-m68hc11.c (md_parse_option): Likewise.
	* config/tc-m68k.c (md_parse_option): Likewise.
	* config/tc-mcore.c (md_parse_option): Likewise.
	* config/tc-mep.c (md_parse_option): Likewise.
	* config/tc-metag.c (struct metag_long_option): Likewise.
	(md_parse_option): Likewise.
	* config/tc-microblaze.c (md_parse_option): Likewise.
	* config/tc-microblaze.h (md_parse_option): Remove prototype.
	* config/tc-mips.c (md_parse_option): Adjust.
	* config/tc-mmix.c (md_parse_option): Likewise.
	* config/tc-mn10200.c (md_parse_option): Likewise.
	* config/tc-mn10300.c (md_parse_option): Likewise.
	* config/tc-moxie.c (md_parse_option): Likewise.
	* config/tc-msp430.c (md_parse_option): Likewise.
	* config/tc-mt.c (md_parse_option): Likewise.
		* config/tc-nds32.c (md_parse_option): Likewise.
		* config/tc-nds32.h (nds32_parse_option): Likewise.
	* config/tc-nios2.c (md_parse_option): Likewise.
	* config/tc-ns32k.c (md_parse_option): Likewise.
	* config/tc-or1k.c (md_parse_option): Likewise.
	* config/tc-pdp11.c (md_parse_option): Likewise.
	* config/tc-pj.c (md_parse_option): Likewise.
	* config/tc-ppc.c (md_parse_option): Likewise.
	* config/tc-rl78.c (md_parse_option): Likewise.
	* config/tc-rx.c (md_parse_option): Likewise.
	* config/tc-s390.c (s390_parse_cpu): Likewise.
	* config/tc-score.c (md_parse_option): Likewise.
	* config/tc-sh.c (md_parse_option): Likewise.
	* config/tc-sparc.c (md_parse_option): Likewise.
	* config/tc-spu.c (md_parse_option): Likewise.
	* config/tc-tic30.c (md_parse_option): Likewise.
	* config/tc-tic4x.c (md_parse_option): Likewise.
	* config/tc-tic54x.c (md_parse_option): Likewise.
	* config/tc-tic6x.c (md_parse_option): Likewise.
	* config/tc-tilegx.c (md_parse_option): Likewise.
	* config/tc-tilepro.c (md_parse_option): Likewise.
	* config/tc-v850.c (md_parse_option): Likewise.
	* config/tc-vax.c (md_parse_option): Likewise.
	* config/tc-visium.c (struct visium_long_option_table): Likewise.
	* config/tc-xc16x.c (md_parse_option): Likewise.
	* config/tc-xgate.c (md_parse_option): Likewise.
	* config/tc-xstormy16.c (md_parse_option): Likewise.
	* config/tc-xtensa.c (md_parse_option): Likewise.
	* config/tc-z80.c (md_parse_option): Likewise.
	* config/tc-z8k.c (md_parse_option): Likewise.
	* tc.h (md_parse_option): Likewise.
---
 gas/config/tc-aarch64.c    | 10 +++++-----
 gas/config/tc-alpha.c      |  2 +-
 gas/config/tc-arc.c        |  2 +-
 gas/config/tc-arm.c        | 18 +++++++++---------
 gas/config/tc-avr.c        |  4 ++--
 gas/config/tc-bfin.c       |  2 +-
 gas/config/tc-cr16.c       |  2 +-
 gas/config/tc-cris.c       | 12 ++++++------
 gas/config/tc-crx.c        |  2 +-
 gas/config/tc-d10v.c       |  2 +-
 gas/config/tc-d30v.c       |  2 +-
 gas/config/tc-dlx.c        |  2 +-
 gas/config/tc-epiphany.c   |  2 +-
 gas/config/tc-fr30.c       |  2 +-
 gas/config/tc-frv.c        |  4 ++--
 gas/config/tc-ft32.c       |  2 +-
 gas/config/tc-h8300.c      |  2 +-
 gas/config/tc-hppa.c       |  2 +-
 gas/config/tc-i370.c       |  2 +-
 gas/config/tc-i386.c       |  2 +-
 gas/config/tc-i860.c       |  2 +-
 gas/config/tc-i960.c       |  4 ++--
 gas/config/tc-ia64.c       |  2 +-
 gas/config/tc-ip2k.c       |  2 +-
 gas/config/tc-iq2000.c     |  2 +-
 gas/config/tc-lm32.c       |  2 +-
 gas/config/tc-m32c.c       |  2 +-
 gas/config/tc-m32r.c       |  2 +-
 gas/config/tc-m68hc11.c    |  2 +-
 gas/config/tc-m68k.c       |  2 +-
 gas/config/tc-mcore.c      |  2 +-
 gas/config/tc-mep.c        |  2 +-
 gas/config/tc-metag.c      | 10 +++++-----
 gas/config/tc-microblaze.c |  2 +-
 gas/config/tc-microblaze.h |  1 -
 gas/config/tc-mips.c       |  2 +-
 gas/config/tc-mmix.c       |  2 +-
 gas/config/tc-mn10200.c    |  2 +-
 gas/config/tc-mn10300.c    |  2 +-
 gas/config/tc-moxie.c      |  2 +-
 gas/config/tc-msp430.c     |  2 +-
 gas/config/tc-mt.c         |  2 +-
 gas/config/tc-nds32.c      |  2 +-
 gas/config/tc-nds32.h      |  2 +-
 gas/config/tc-nios2.c      |  2 +-
 gas/config/tc-ns32k.c      |  2 +-
 gas/config/tc-or1k.c       |  2 +-
 gas/config/tc-pdp11.c      |  8 ++++----
 gas/config/tc-pj.c         |  2 +-
 gas/config/tc-ppc.c        |  2 +-
 gas/config/tc-rl78.c       |  2 +-
 gas/config/tc-rx.c         |  2 +-
 gas/config/tc-s390.c       |  6 +++---
 gas/config/tc-score.c      |  2 +-
 gas/config/tc-sh.c         |  2 +-
 gas/config/tc-sparc.c      |  2 +-
 gas/config/tc-spu.c        |  2 +-
 gas/config/tc-tic30.c      |  2 +-
 gas/config/tc-tic4x.c      |  2 +-
 gas/config/tc-tic54x.c     |  4 ++--
 gas/config/tc-tic6x.c      |  2 +-
 gas/config/tc-tilegx.c     |  2 +-
 gas/config/tc-tilepro.c    |  2 +-
 gas/config/tc-v850.c       |  2 +-
 gas/config/tc-vax.c        |  2 +-
 gas/config/tc-visium.c     |  6 +++---
 gas/config/tc-xc16x.c      |  2 +-
 gas/config/tc-xgate.c      |  2 +-
 gas/config/tc-xstormy16.c  |  2 +-
 gas/config/tc-xtensa.c     | 20 +++++++++++---------
 gas/config/tc-z80.c        |  2 +-
 gas/config/tc-z8k.c        |  2 +-
 gas/tc.h                   |  2 +-
 73 files changed, 114 insertions(+), 113 deletions(-)

diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 64a732b..bf67894 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -7825,7 +7825,7 @@ struct aarch64_long_option_table
 {
   const char *option;			/* Substring to match.  */
   const char *help;			/* Help information.  */
-  int (*func) (char *subopt);	/* Function to decode sub-option.  */
+  int (*func) (const char *subopt);	/* Function to decode sub-option.  */
   char *deprecated;		/* If non-null, print this message.  */
 };
 
@@ -7917,7 +7917,7 @@ aarch64_parse_features (char *str, const aarch64_feature_set **opt_p,
 }
 
 static int
-aarch64_parse_cpu (char *str)
+aarch64_parse_cpu (const char *str)
 {
   const struct aarch64_cpu_option_table *opt;
   char *ext = strchr (str, '+');
@@ -7949,7 +7949,7 @@ aarch64_parse_cpu (char *str)
 }
 
 static int
-aarch64_parse_arch (char *str)
+aarch64_parse_arch (const char *str)
 {
   const struct aarch64_arch_option_table *opt;
   char *ext = strchr (str, '+');
@@ -7994,7 +7994,7 @@ static const struct aarch64_option_abi_value_table aarch64_abis[] = {
 };
 
 static int
-aarch64_parse_abi (char *str)
+aarch64_parse_abi (const char *str)
 {
   const struct aarch64_option_abi_value_table *opt;
   size_t optlen = strlen (str);
@@ -8029,7 +8029,7 @@ static struct aarch64_long_option_table aarch64_long_opts[] = {
 };
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   struct aarch64_option_table *opt;
   struct aarch64_long_option_table *lopt;
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index 4b86d4b..19d4bd2 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -5602,7 +5602,7 @@ md_atof (int type, char *litP, int *sizeP)
 /* Take care of the target-specific command-line options.  */
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index 736143e..3f4e2d3 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -2913,7 +2913,7 @@ arc_parse_name (const char *name,
    arc700, av2em, av2hs.  */
 
 int
-md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 4cc808d..6bdfec0 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -25581,7 +25581,7 @@ struct arm_long_option_table
 {
   const char * option;		/* Substring to match.	*/
   const char * help;			/* Help information.  */
-  int (* func) (char * subopt);	/* Function to decode sub-option.  */
+  int (* func) (const char * subopt);	/* Function to decode sub-option.  */
   const char * deprecated;		/* If non-null, print this message.  */
 };
 
@@ -25709,7 +25709,7 @@ arm_parse_extension (char *str, const arm_feature_set **opt_p)
 }
 
 static bfd_boolean
-arm_parse_cpu (char *str)
+arm_parse_cpu (const char *str)
 {
   const struct arm_cpu_option_table *opt;
   char *ext = strchr (str, '+');
@@ -25759,7 +25759,7 @@ arm_parse_cpu (char *str)
 }
 
 static bfd_boolean
-arm_parse_arch (char *str)
+arm_parse_arch (const char *str)
 {
   const struct arm_arch_option_table *opt;
   char *ext = strchr (str, '+');
@@ -25794,7 +25794,7 @@ arm_parse_arch (char *str)
 }
 
 static bfd_boolean
-arm_parse_fpu (char * str)
+arm_parse_fpu (const char * str)
 {
   const struct arm_option_fpu_value_table * opt;
 
@@ -25810,7 +25810,7 @@ arm_parse_fpu (char * str)
 }
 
 static bfd_boolean
-arm_parse_float_abi (char * str)
+arm_parse_float_abi (const char * str)
 {
   const struct arm_option_value_table * opt;
 
@@ -25827,7 +25827,7 @@ arm_parse_float_abi (char * str)
 
 #ifdef OBJ_ELF
 static bfd_boolean
-arm_parse_eabi (char * str)
+arm_parse_eabi (const char * str)
 {
   const struct arm_option_value_table *opt;
 
@@ -25843,7 +25843,7 @@ arm_parse_eabi (char * str)
 #endif
 
 static bfd_boolean
-arm_parse_it_mode (char * str)
+arm_parse_it_mode (const char * str)
 {
   bfd_boolean ret = TRUE;
 
@@ -25866,7 +25866,7 @@ arm_parse_it_mode (char * str)
 }
 
 static bfd_boolean
-arm_ccs_mode (char * unused ATTRIBUTE_UNUSED)
+arm_ccs_mode (const char * unused ATTRIBUTE_UNUSED)
 {
   codecomposer_syntax = TRUE;
   arm_comment_chars[0] = ';';
@@ -25896,7 +25896,7 @@ struct arm_long_option_table arm_long_opts[] =
 };
 
 int
-md_parse_option (int c, char * arg)
+md_parse_option (int c, const char * arg)
 {
   struct arm_option_table *opt;
   const struct arm_legacy_option_table *fopt;
diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c
index 9bd164e..b35061e 100644
--- a/gas/config/tc-avr.c
+++ b/gas/config/tc-avr.c
@@ -555,7 +555,7 @@ avr_set_arch (int dummy ATTRIBUTE_UNUSED)
 }
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
@@ -566,7 +566,7 @@ md_parse_option (int c, char *arg)
 
 	{
 	  char *t = s;
-	  char *arg1 = arg;
+	  const char *arg1 = arg;
 
 	  do
 	    *t = TOLOWER (*arg1++);
diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c
index e14fbe1..a89c984 100644
--- a/gas/config/tc-bfin.c
+++ b/gas/config/tc-bfin.c
@@ -348,7 +348,7 @@ size_t md_longopts_size = sizeof (md_longopts);
 
 
 int
-md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c ATTRIBUTE_UNUSED, const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c
index b3e0924..f843af9 100644
--- a/gas/config/tc-cr16.c
+++ b/gas/config/tc-cr16.c
@@ -702,7 +702,7 @@ md_undefined_symbol (char *name)
    GAS does not understand.  */
 
 int
-md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c ATTRIBUTE_UNUSED, const char *arg ATTRIBUTE_UNUSED)
 {
   return 0;
 }
diff --git a/gas/config/tc-cris.c b/gas/config/tc-cris.c
index a187603..89343f0 100644
--- a/gas/config/tc-cris.c
+++ b/gas/config/tc-cris.c
@@ -119,7 +119,7 @@ enum cris_archs
   arch_cris_any_v0_v10, arch_crisv32, arch_cris_common_v10_v32
 };
 
-static enum cris_archs cris_arch_from_string (char **);
+static enum cris_archs cris_arch_from_string (const char **);
 static int cris_insn_ver_valid_for_arch (enum cris_insn_version_usage,
 					 enum cris_archs);
 
@@ -3802,7 +3802,7 @@ cris_number_to_imm (char *bufp, long val, int n, fixS *fixP, segT seg)
    GAS does not understand.  */
 
 int
-md_parse_option (int arg, char *argp ATTRIBUTE_UNUSED)
+md_parse_option (int arg, const char *argp ATTRIBUTE_UNUSED)
 {
   switch (arg)
     {
@@ -3842,7 +3842,7 @@ md_parse_option (int arg, char *argp ATTRIBUTE_UNUSED)
 
     case OPTION_ARCH:
       {
-	char *str = argp;
+	const char *str = argp;
 	enum cris_archs argarch = cris_arch_from_string (&str);
 
 	if (argarch == arch_cris_unknown)
@@ -4271,7 +4271,7 @@ s_cris_dtpoff (int bytes)
    arch_cris_unknown is returned.  */
 
 static enum cris_archs
-cris_arch_from_string (char **str)
+cris_arch_from_string (const char **str)
 {
   static const struct cris_arch_struct
   {
@@ -4398,7 +4398,7 @@ s_cris_arch (int dummy ATTRIBUTE_UNUSED)
      would be more useful than confusing, implementation-wise and
      user-wise.  */
 
-  char *str = input_line_pointer;
+  const char *str = input_line_pointer;
   enum cris_archs arch = cris_arch_from_string (&str);
 
   if (arch == arch_cris_unknown)
@@ -4414,7 +4414,7 @@ s_cris_arch (int dummy ATTRIBUTE_UNUSED)
   else if (arch != cris_arch)
     as_bad (_(".arch <arch> requires a matching --march=... option"));
 
-  input_line_pointer = str;
+  input_line_pointer = (char *) str;
   demand_empty_rest_of_line ();
   return;
 }
diff --git a/gas/config/tc-crx.c b/gas/config/tc-crx.c
index 449da49..40a2806 100644
--- a/gas/config/tc-crx.c
+++ b/gas/config/tc-crx.c
@@ -451,7 +451,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, fragS *fragP)
    GAS does not understand.  */
 
 int
-md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c ATTRIBUTE_UNUSED, const char *arg ATTRIBUTE_UNUSED)
 {
   return 0;
 }
diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c
index f2855fc..f7f213a 100644
--- a/gas/config/tc-d10v.c
+++ b/gas/config/tc-d10v.c
@@ -222,7 +222,7 @@ md_show_usage (FILE *stream)
 }
 
 int
-md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c
index 1ac1605..81051f0 100644
--- a/gas/config/tc-d30v.c
+++ b/gas/config/tc-d30v.c
@@ -245,7 +245,7 @@ md_show_usage (FILE *stream)
 }
 
 int
-md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-dlx.c b/gas/config/tc-dlx.c
index 39b1903..970e297 100644
--- a/gas/config/tc-dlx.c
+++ b/gas/config/tc-dlx.c
@@ -1076,7 +1076,7 @@ size_t md_longopts_size = sizeof (md_longopts);
 
 int
 md_parse_option (int c     ATTRIBUTE_UNUSED,
-		 char *arg ATTRIBUTE_UNUSED)
+		 const char *arg ATTRIBUTE_UNUSED)
 {
   return 0;
 }
diff --git a/gas/config/tc-epiphany.c b/gas/config/tc-epiphany.c
index 4edd560..132a78f 100644
--- a/gas/config/tc-epiphany.c
+++ b/gas/config/tc-epiphany.c
@@ -116,7 +116,7 @@ size_t md_longopts_size = sizeof (md_longopts);
 const char * md_shortopts = "";
 
 int
-md_parse_option (int c ATTRIBUTE_UNUSED, char * arg ATTRIBUTE_UNUSED)
+md_parse_option (int c ATTRIBUTE_UNUSED, const char * arg ATTRIBUTE_UNUSED)
 {
   return 0;	/* No target-specific options.  */
 }
diff --git a/gas/config/tc-fr30.c b/gas/config/tc-fr30.c
index 683da32..ad3ffd0 100644
--- a/gas/config/tc-fr30.c
+++ b/gas/config/tc-fr30.c
@@ -65,7 +65,7 @@ size_t md_longopts_size = sizeof (md_longopts);
 
 int
 md_parse_option (int c ATTRIBUTE_UNUSED,
-		 char *arg ATTRIBUTE_UNUSED)
+		 const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-frv.c b/gas/config/tc-frv.c
index c9aacf8..24baa96 100644
--- a/gas/config/tc-frv.c
+++ b/gas/config/tc-frv.c
@@ -262,7 +262,7 @@ size_t md_longopts_size = sizeof (md_longopts);
 static int g_switch_value = 8;
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
@@ -337,7 +337,7 @@ md_parse_option (int c, char *arg)
 
     case OPTION_CPU:
       {
-	char *p;
+	const char *p;
 	int cpu_flags = EF_FRV_CPU_GENERIC;
 
 	/* Identify the processor type */
diff --git a/gas/config/tc-ft32.c b/gas/config/tc-ft32.c
index 88ea4f7..327b393 100644
--- a/gas/config/tc-ft32.c
+++ b/gas/config/tc-ft32.c
@@ -457,7 +457,7 @@ size_t md_longopts_size = sizeof (md_longopts);
 /* We have no target specific options yet, so these next
    two functions are empty.  */
 int
-md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c ATTRIBUTE_UNUSED, const char *arg ATTRIBUTE_UNUSED)
 {
   return 0;
 }
diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c
index a620e6d..f50f497 100644
--- a/gas/config/tc-h8300.c
+++ b/gas/config/tc-h8300.c
@@ -2197,7 +2197,7 @@ const struct mach_func mach_table[] =
 };
 
 int
-md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c ATTRIBUTE_UNUSED, const char *arg ATTRIBUTE_UNUSED)
 {
   unsigned int i;
   switch (c)
diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c
index c3e1d75..644bbaf 100644
--- a/gas/config/tc-hppa.c
+++ b/gas/config/tc-hppa.c
@@ -1653,7 +1653,7 @@ struct option md_longopts[] =
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-i370.c b/gas/config/tc-i370.c
index a20c10c..1b419e8 100644
--- a/gas/config/tc-i370.c
+++ b/gas/config/tc-i370.c
@@ -358,7 +358,7 @@ struct option md_longopts[] =
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 610bc2b..55ca5c3 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -9698,7 +9698,7 @@ struct option md_longopts[] =
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   unsigned int j;
   char *arch, *next;
diff --git a/gas/config/tc-i860.c b/gas/config/tc-i860.c
index a37da16..ea21669 100644
--- a/gas/config/tc-i860.c
+++ b/gas/config/tc-i860.c
@@ -1084,7 +1084,7 @@ struct option md_longopts[] = {
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-i960.c b/gas/config/tc-i960.c
index d09e3cf..8a8f31c 100644
--- a/gas/config/tc-i960.c
+++ b/gas/config/tc-i960.c
@@ -1827,7 +1827,7 @@ static const struct tabentry arch_tab[] =
 };
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
@@ -1847,7 +1847,7 @@ md_parse_option (int c, char *arg)
     case 'A':
       {
 	const struct tabentry *tp;
-	char *p = arg;
+	const char *p = arg;
 
 	for (tp = arch_tab; tp->flag != NULL; tp++)
 	  if (!strcmp (p, tp->flag))
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index ee91ef9..85f6095 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -6981,7 +6981,7 @@ emit_one_bundle (void)
 }
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
 
   switch (c)
diff --git a/gas/config/tc-ip2k.c b/gas/config/tc-ip2k.c
index 1baac58..7e4d351 100644
--- a/gas/config/tc-ip2k.c
+++ b/gas/config/tc-ip2k.c
@@ -113,7 +113,7 @@ size_t md_longopts_size = sizeof (md_longopts);
 const char * md_shortopts = "";
 
 int
-md_parse_option (int c ATTRIBUTE_UNUSED, char * arg ATTRIBUTE_UNUSED)
+md_parse_option (int c ATTRIBUTE_UNUSED, const char * arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-iq2000.c b/gas/config/tc-iq2000.c
index 3ae6392..c5ccfca 100644
--- a/gas/config/tc-iq2000.c
+++ b/gas/config/tc-iq2000.c
@@ -118,7 +118,7 @@ size_t md_longopts_size = sizeof (md_longopts);
 
 int
 md_parse_option (int c ATTRIBUTE_UNUSED,
-		 char * arg ATTRIBUTE_UNUSED)
+		 const char * arg ATTRIBUTE_UNUSED)
 {
   return 0;
 }
diff --git a/gas/config/tc-lm32.c b/gas/config/tc-lm32.c
index 008fd31..a20b9a0 100644
--- a/gas/config/tc-lm32.c
+++ b/gas/config/tc-lm32.c
@@ -132,7 +132,7 @@ md_show_usage (FILE * fp)
 /* Parse command line options.  */
 
 int
-md_parse_option (int c, char * arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-m32c.c b/gas/config/tc-m32c.c
index f4fd1f1..4b6e353 100644
--- a/gas/config/tc-m32c.c
+++ b/gas/config/tc-m32c.c
@@ -105,7 +105,7 @@ set_isa (enum isa_attr isa_num)
 static void s_bss (int);
 
 int
-md_parse_option (int c, char * arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c
index 18553bb..7621832 100644
--- a/gas/config/tc-m32r.c
+++ b/gas/config/tc-m32r.c
@@ -266,7 +266,7 @@ parallel (void)
 }
 
 int
-md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c
index 54ece5f..71fdb26 100644
--- a/gas/config/tc-m68hc11.c
+++ b/gas/config/tc-m68hc11.c
@@ -490,7 +490,7 @@ m68hc11_print_statistics (FILE *file)
 }
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   get_default_target ();
   switch (c)
diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c
index bd6eac6..b09a799 100644
--- a/gas/config/tc-m68k.c
+++ b/gas/config/tc-m68k.c
@@ -7540,7 +7540,7 @@ struct option md_longopts[] = {
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
diff --git a/gas/config/tc-mcore.c b/gas/config/tc-mcore.c
index 6e57316..dc5c95d 100644
--- a/gas/config/tc-mcore.c
+++ b/gas/config/tc-mcore.c
@@ -1650,7 +1650,7 @@ struct option md_longopts[] =
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char * arg)
+md_parse_option (int c, const char * arg)
 {
   switch (c)
     {
diff --git a/gas/config/tc-mep.c b/gas/config/tc-mep.c
index a4ebfcf..6b659d4 100644
--- a/gas/config/tc-mep.c
+++ b/gas/config/tc-mep.c
@@ -195,7 +195,7 @@ static int optbits = 0;
 static int optbitset = 0;
 
 int
-md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
 {
   int i, idx;
   switch (c)
diff --git a/gas/config/tc-metag.c b/gas/config/tc-metag.c
index b0b2604..d287387 100644
--- a/gas/config/tc-metag.c
+++ b/gas/config/tc-metag.c
@@ -5821,7 +5821,7 @@ static const struct metag_core_option metag_dsps[] =
 
 /* Parse a CPU command line option.  */
 static int
-metag_parse_cpu (char * str)
+metag_parse_cpu (const char * str)
 {
   const struct metag_core_option * opt;
   int optlen;
@@ -5847,7 +5847,7 @@ metag_parse_cpu (char * str)
 
 /* Parse an FPU command line option.  */
 static int
-metag_parse_fpu (char * str)
+metag_parse_fpu (const char * str)
 {
   const struct metag_core_option * opt;
   int optlen;
@@ -5873,7 +5873,7 @@ metag_parse_fpu (char * str)
 
 /* Parse a DSP command line option.  */
 static int
-metag_parse_dsp (char * str)
+metag_parse_dsp (const char * str)
 {
   const struct metag_core_option * opt;
   int optlen;
@@ -5901,7 +5901,7 @@ struct metag_long_option
 {
   const char * option;                /* Substring to match.  */
   const char * help;                  /* Help information.  */
-  int (* func) (char * subopt); /* Function to decode sub-option.  */
+  int (* func) (const char * subopt); /* Function to decode sub-option.  */
   const char * deprecated;            /* If non-null, print this message.  */
 };
 
@@ -5917,7 +5917,7 @@ struct metag_long_option metag_long_opts[] =
   };
 
 int
-md_parse_option (int c, char * arg)
+md_parse_option (int c, const char * arg)
 {
   struct metag_long_option *lopt;
 
diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
index 0895ae9..a92e0eb 100644
--- a/gas/config/tc-microblaze.c
+++ b/gas/config/tc-microblaze.c
@@ -2458,7 +2458,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
 }
 
 int
-md_parse_option (int c, char * arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h
index a468433..0fde831 100644
--- a/gas/config/tc-microblaze.h
+++ b/gas/config/tc-microblaze.h
@@ -101,7 +101,6 @@ extern void      md_begin            (void);
 extern void      md_assemble         (char *);
 extern symbolS * md_undefined_symbol (char *);
 extern char *    md_atof             (int, char *, int *);
-extern int       md_parse_option     (int, char *);
 extern void      md_show_usage       (FILE *);
 extern void      md_convert_frag               (bfd *, segT, fragS *);
 extern void      md_operand                    (expressionS *);
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index d089362..9679a5e 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -14046,7 +14046,7 @@ mips_set_option_string (const char **string_ptr, const char *new_value)
 }
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   unsigned int i;
 
diff --git a/gas/config/tc-mmix.c b/gas/config/tc-mmix.c
index b7bfe14..00543f4 100644
--- a/gas/config/tc-mmix.c
+++ b/gas/config/tc-mmix.c
@@ -640,7 +640,7 @@ get_putget_operands (struct mmix_opcode *insn, char *operands,
 /* Handle MMIX-specific option.  */
 
 int
-md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c
index a7fd980..ea2fa8f 100644
--- a/gas/config/tc-mn10200.c
+++ b/gas/config/tc-mn10200.c
@@ -303,7 +303,7 @@ none yet\n"));
 
 int
 md_parse_option (int c ATTRIBUTE_UNUSED,
-		 char *arg ATTRIBUTE_UNUSED)
+		 const char *arg ATTRIBUTE_UNUSED)
 {
   return 0;
 }
diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c
index 63d790a..4f76677 100644
--- a/gas/config/tc-mn10300.c
+++ b/gas/config/tc-mn10300.c
@@ -444,7 +444,7 @@ none yet\n"));
 }
 
 int
-md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c ATTRIBUTE_UNUSED, const char *arg ATTRIBUTE_UNUSED)
 {
   return 0;
 }
diff --git a/gas/config/tc-moxie.c b/gas/config/tc-moxie.c
index ae17bb3..aa48c99 100644
--- a/gas/config/tc-moxie.c
+++ b/gas/config/tc-moxie.c
@@ -612,7 +612,7 @@ size_t md_longopts_size = sizeof (md_longopts);
 const char *md_shortopts = "";
 
 int
-md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c ATTRIBUTE_UNUSED, const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c
index 6b762c2..ae28984 100644
--- a/gas/config/tc-msp430.c
+++ b/gas/config/tc-msp430.c
@@ -1329,7 +1329,7 @@ msp430_mcu_data [] =
 };  
 
 int
-md_parse_option (int c, char * arg)
+md_parse_option (int c, const char * arg)
 {
   switch (c)
     {
diff --git a/gas/config/tc-mt.c b/gas/config/tc-mt.c
index 49edb91..c9aa18c 100644
--- a/gas/config/tc-mt.c
+++ b/gas/config/tc-mt.c
@@ -101,7 +101,7 @@ enum mt_architectures
 static enum mt_architectures mt_arch = ms1_16_002;
 
 int
-md_parse_option (int c ATTRIBUTE_UNUSED, char * arg)
+md_parse_option (int c ATTRIBUTE_UNUSED, const char * arg)
 {
   switch (c)
     {
diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c
index 66b8136..62668fc 100644
--- a/gas/config/tc-nds32.c
+++ b/gas/config/tc-nds32.c
@@ -3189,7 +3189,7 @@ nds32_all_ext (void)
    recognized.  This will be handled by the generic code.  */
 
 int
-nds32_parse_option (int c, char *arg)
+nds32_parse_option (int c, const char *arg)
 {
   struct nds32_parse_option_table *coarse_tune;
   struct nds32_set_option_table *fine_tune;
diff --git a/gas/config/tc-nds32.h b/gas/config/tc-nds32.h
index 5075ec2..81ff40f 100644
--- a/gas/config/tc-nds32.h
+++ b/gas/config/tc-nds32.h
@@ -44,7 +44,7 @@
 
 /* as.c.  */
 /* Extend GAS command line option handling capability.  */
-extern int nds32_parse_option (int, char *);
+extern int nds32_parse_option (int, const char *);
 extern void nds32_after_parse_args (void);
 /* The endianness of the target format may change based on command
    line arguments.  */
diff --git a/gas/config/tc-nios2.c b/gas/config/tc-nios2.c
index db31059..399fcf0 100644
--- a/gas/config/tc-nios2.c
+++ b/gas/config/tc-nios2.c
@@ -3540,7 +3540,7 @@ nios2_use_arch (const char *arch)
 /* The following functions are called by machine-independent parts of
    the assembler. */
 int
-md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-ns32k.c b/gas/config/tc-ns32k.c
index 2b88bf4..1f5dbd9 100644
--- a/gas/config/tc-ns32k.c
+++ b/gas/config/tc-ns32k.c
@@ -2123,7 +2123,7 @@ struct option md_longopts[] =
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
diff --git a/gas/config/tc-or1k.c b/gas/config/tc-or1k.c
index e7c877f..0abbd82 100644
--- a/gas/config/tc-or1k.c
+++ b/gas/config/tc-or1k.c
@@ -67,7 +67,7 @@ size_t md_longopts_size = sizeof (md_longopts);
 unsigned long or1k_machine = 0; /* default */
 
 int
-md_parse_option (int c ATTRIBUTE_UNUSED, char * arg ATTRIBUTE_UNUSED)
+md_parse_option (int c ATTRIBUTE_UNUSED, const char * arg ATTRIBUTE_UNUSED)
 {
   return 0;
 }
diff --git a/gas/config/tc-pdp11.c b/gas/config/tc-pdp11.c
index f144754..3d160cf 100644
--- a/gas/config/tc-pdp11.c
+++ b/gas/config/tc-pdp11.c
@@ -85,7 +85,7 @@ const pseudo_typeS md_pseudo_table[] =
 static struct hash_control *insn_hash = NULL;
 
 static int
-set_option (char *arg)
+set_option (const char *arg)
 {
   int yes = 1;
 
@@ -1043,7 +1043,7 @@ md_create_long_jump (char *ptr ATTRIBUTE_UNUSED,
 }
 
 static int
-set_cpu_model (char *arg)
+set_cpu_model (const char *arg)
 {
   char buf[4];
   char *model = buf;
@@ -1159,7 +1159,7 @@ set_cpu_model (char *arg)
 }
 
 static int
-set_machine_model (char *arg)
+set_machine_model (const char *arg)
 {
   if (strncmp (arg, "pdp-11/", 7) != 0
       && strncmp (arg, "pdp11/", 6) != 0
@@ -1246,7 +1246,7 @@ size_t md_longopts_size = sizeof (md_longopts);
    See if it's a processor-specific option.  */
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   init_defaults ();
 
diff --git a/gas/config/tc-pj.c b/gas/config/tc-pj.c
index b86fa89..8f6266f 100644
--- a/gas/config/tc-pj.c
+++ b/gas/config/tc-pj.c
@@ -333,7 +333,7 @@ struct option md_longopts[] =
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 64a35a0..89c7bfe 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -1078,7 +1078,7 @@ const struct option md_longopts[] = {
 const size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   ppc_cpu_t new_cpu;
 
diff --git a/gas/config/tc-rl78.c b/gas/config/tc-rl78.c
index bd05039..d9f723a 100644
--- a/gas/config/tc-rl78.c
+++ b/gas/config/tc-rl78.c
@@ -308,7 +308,7 @@ struct option md_longopts[] =
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char * arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c
index b74ee72..22b5e9b 100644
--- a/gas/config/tc-rx.c
+++ b/gas/config/tc-rx.c
@@ -122,7 +122,7 @@ struct cpu_type  cpu_type_list[] =
 };
 
 int
-md_parse_option (int c ATTRIBUTE_UNUSED, char * arg ATTRIBUTE_UNUSED)
+md_parse_option (int c ATTRIBUTE_UNUSED, const char * arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index 8fcbb14..9bcc642 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -262,7 +262,7 @@ s390_target_format (void)
    In case of an error, S390_OPCODE_MAXCPU is returned.  */
 
 static unsigned int
-s390_parse_cpu (char *         arg,
+s390_parse_cpu (const char *         arg,
 		unsigned int * ret_flags,
 		bfd_boolean    allow_extensions)
 {
@@ -324,7 +324,7 @@ s390_parse_cpu (char *         arg,
   ilp_bak = input_line_pointer;
   if (icpu != S390_OPCODE_MAXCPU)
     {
-      input_line_pointer = arg;
+      input_line_pointer = (char *) arg;
       *ret_flags = (cpu_table[icpu].flags & S390_INSTR_FLAG_FACILITY_MASK);
 
       while (*input_line_pointer == '+' && allow_extensions)
@@ -368,7 +368,7 @@ s390_parse_cpu (char *         arg,
 }
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c
index ee195e2..536016f 100644
--- a/gas/config/tc-score.c
+++ b/gas/config/tc-score.c
@@ -7716,7 +7716,7 @@ score_set_mach (const char *arg)
 }
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c
index 1bb6d71..ef07f10 100644
--- a/gas/config/tc-sh.c
+++ b/gas/config/tc-sh.c
@@ -3180,7 +3180,7 @@ struct option md_longopts[] =
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index 5d4e0d6..61a16a4 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -490,7 +490,7 @@ struct option md_longopts[] = {
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   /* We don't get a chance to initialize anything before we're called,
      so handle that now.  */
diff --git a/gas/config/tc-spu.c b/gas/config/tc-spu.c
index 69264c1..b658bea 100644
--- a/gas/config/tc-spu.c
+++ b/gas/config/tc-spu.c
@@ -156,7 +156,7 @@ static int emulate_apuasm;
 static int use_dd2 = 1;
 
 int
-md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-tic30.c b/gas/config/tc-tic30.c
index 1853d8d..4ccb820 100644
--- a/gas/config/tc-tic30.c
+++ b/gas/config/tc-tic30.c
@@ -1163,7 +1163,7 @@ md_apply_fix (fixS *fixP,
 
 int
 md_parse_option (int c ATTRIBUTE_UNUSED,
-		 char *arg ATTRIBUTE_UNUSED)
+		 const char *arg ATTRIBUTE_UNUSED)
 {
   debug ("In md_parse_option()\n");
   return 0;
diff --git a/gas/config/tc-tic4x.c b/gas/config/tc-tic4x.c
index 21e6e36..956ea5d 100644
--- a/gas/config/tc-tic4x.c
+++ b/gas/config/tc-tic4x.c
@@ -2710,7 +2710,7 @@ md_estimate_size_before_relax (fragS *fragP ATTRIBUTE_UNUSED,
 
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c
index d718a33..b889704 100644
--- a/gas/config/tc-tic54x.c
+++ b/gas/config/tc-tic54x.c
@@ -2461,7 +2461,7 @@ const pseudo_typeS md_pseudo_table[] =
 };
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
@@ -2490,7 +2490,7 @@ md_parse_option (int c, char *arg)
       break;
     case OPTION_STDERR_TO_FILE:
       {
-	char *filename = arg;
+	const char *filename = arg;
 	FILE *fp = fopen (filename, "w+");
 
 	if (fp == NULL)
diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c
index 72d1bcc..84fd368 100644
--- a/gas/config/tc-tic6x.c
+++ b/gas/config/tc-tic6x.c
@@ -265,7 +265,7 @@ tic6x_use_pid (const char *arg)
 /* Parse a target-specific option.  */
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
diff --git a/gas/config/tc-tilegx.c b/gas/config/tc-tilegx.c
index 7897aca..4cebfcf 100644
--- a/gas/config/tc-tilegx.c
+++ b/gas/config/tc-tilegx.c
@@ -99,7 +99,7 @@ struct option md_longopts[] =
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-tilepro.c b/gas/config/tc-tilepro.c
index 90ce09a..1f5890d 100644
--- a/gas/config/tc-tilepro.c
+++ b/gas/config/tc-tilepro.c
@@ -72,7 +72,7 @@ struct option md_longopts[] =
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char *arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index 00ff00d..bd762fb 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -1562,7 +1562,7 @@ md_show_usage (FILE *stream)
 }
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   if (c != 'm')
     {
diff --git a/gas/config/tc-vax.c b/gas/config/tc-vax.c
index b2e4926..89fc6fc 100644
--- a/gas/config/tc-vax.c
+++ b/gas/config/tc-vax.c
@@ -2210,7 +2210,7 @@ struct option md_longopts[] =
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
diff --git a/gas/config/tc-visium.c b/gas/config/tc-visium.c
index f4e7c14..4ab5fca 100644
--- a/gas/config/tc-visium.c
+++ b/gas/config/tc-visium.c
@@ -282,12 +282,12 @@ struct visium_long_option_table
 {
   const char *option;			/* Substring to match.  */
   const char *help;			/* Help information.  */
-  int (*func) (char *subopt);	/* Function to decode sub-option.  */
+  int (*func) (const char *subopt);	/* Function to decode sub-option.  */
   const char *deprecated;		/* If non-null, print this message.  */
 };
 
 static int
-visium_parse_arch (char *str)
+visium_parse_arch (const char *str)
 {
   struct visium_arch_option_table *opt;
 
@@ -317,7 +317,7 @@ static struct visium_long_option_table visium_long_opts[] =
 };
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   struct visium_option_table *opt;
   struct visium_long_option_table *lopt;
diff --git a/gas/config/tc-xc16x.c b/gas/config/tc-xc16x.c
index bebdbd3..5e34e09 100644
--- a/gas/config/tc-xc16x.c
+++ b/gas/config/tc-xc16x.c
@@ -220,7 +220,7 @@ md_show_usage (FILE * stream)
 
 int
 md_parse_option (int c ATTRIBUTE_UNUSED,
-		 char *arg ATTRIBUTE_UNUSED)
+		 const char *arg ATTRIBUTE_UNUSED)
 {
   return 0;
 }
diff --git a/gas/config/tc-xgate.c b/gas/config/tc-xgate.c
index 70554fe..5b94158 100644
--- a/gas/config/tc-xgate.c
+++ b/gas/config/tc-xgate.c
@@ -200,7 +200,7 @@ md_atof (int type, char *litP, int *sizeP)
 }
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
diff --git a/gas/config/tc-xstormy16.c b/gas/config/tc-xstormy16.c
index 6ee5be3..7ad3ea8 100644
--- a/gas/config/tc-xstormy16.c
+++ b/gas/config/tc-xstormy16.c
@@ -66,7 +66,7 @@ size_t md_longopts_size = sizeof (md_longopts);
 
 int
 md_parse_option (int    c ATTRIBUTE_UNUSED,
-		 char * arg ATTRIBUTE_UNUSED)
+		 const char * arg ATTRIBUTE_UNUSED)
 {
   return 0;
 }
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index 180181c..3025d29 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -814,7 +814,7 @@ size_t md_longopts_size = sizeof md_longopts;
 
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
@@ -952,20 +952,21 @@ md_parse_option (int c, char *arg)
     case option_target_hardware:
       {
 	int earliest, latest = 0;
+	char *end;
 	if (*arg == 0 || *arg == '-')
 	  as_fatal (_("invalid target hardware version"));
 
-	earliest = strtol (arg, &arg, 0);
+	earliest = strtol (arg, &end, 0);
 
-	if (*arg == 0)
+	if (*end == 0)
 	  latest = earliest;
-	else if (*arg == '-')
+	else if (*end == '-')
 	  {
-	    if (*++arg == 0)
+	    if (*++end == 0)
 	      as_fatal (_("invalid target hardware version"));
-	    latest = strtol (arg, &arg, 0);
+	    latest = strtol (end, &end, 0);
 	  }
-	if (*arg != 0)
+	if (*end != 0)
 	  as_fatal (_("invalid target hardware version"));
 
 	xtensa_setup_hw_workarounds (earliest, latest);
@@ -1008,12 +1009,13 @@ md_parse_option (int c, char *arg)
     case option_auto_litpool_limit:
       {
 	int value = 0;
+	char *end;
 	if (auto_litpool_limit < 0)
 	  as_fatal (_("no-auto-litpools is incompatible with auto-litpool-limit"));
 	if (*arg == 0 || *arg == '-')
 	  as_fatal (_("invalid auto-litpool-limit argument"));
-	value = strtol (arg, &arg, 10);
-	if (*arg != 0)
+	value = strtol (arg, &end, 10);
+	if (*end != 0)
 	  as_fatal (_("invalid auto-litpool-limit argument"));
 	if (value < 100 || value > 10000)
 	  as_fatal (_("invalid auto-litpool-limit argument (range is 100-10000)"));
diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c
index 281cc71..094b8e6 100644
--- a/gas/config/tc-z80.c
+++ b/gas/config/tc-z80.c
@@ -81,7 +81,7 @@ static int ins_err = INS_R800;
 static int ins_used = INS_Z80;
 
 int
-md_parse_option (int c, char* arg ATTRIBUTE_UNUSED)
+md_parse_option (int c, const char* arg ATTRIBUTE_UNUSED)
 {
   switch (c)
     {
diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c
index c09d826..64fca74 100644
--- a/gas/config/tc-z8k.c
+++ b/gas/config/tc-z8k.c
@@ -1303,7 +1303,7 @@ struct option md_longopts[] =
 size_t md_longopts_size = sizeof (md_longopts);
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   switch (c)
     {
diff --git a/gas/tc.h b/gas/tc.h
index dd1831d..3683466 100644
--- a/gas/tc.h
+++ b/gas/tc.h
@@ -25,7 +25,7 @@
 extern const pseudo_typeS md_pseudo_table[];
 
 char * md_atof (int, char *, int *);
-int    md_parse_option (int, char *);
+int    md_parse_option (int, const char *);
 void   md_show_usage (FILE *);
 void   md_assemble (char *);
 void   md_begin (void);
-- 
2.1.4


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