make md_parse_option () take a const char *

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.

gas/ChangeLog:

2016-03-29  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.
This commit is contained in:
Trevor Saunders 2016-02-27 09:35:32 -05:00
parent 30bd735cb0
commit 17b9d67d4e
74 changed files with 194 additions and 113 deletions

View File

@ -1,3 +1,83 @@
2016-03-29 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.
2016-03-29 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-bfin.c (gencode): Use XOBNEW obstack_alloc () wrapper.

View File

@ -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 (const 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;
const 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;
const 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;

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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 (const 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;
const 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;
const 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;

View File

@ -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++);

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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. */
}

View File

@ -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)
{

View File

@ -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 */

View File

@ -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;
}

View File

@ -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)

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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;

View File

@ -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)
{

View File

@ -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))

View File

@ -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)

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)

View File

@ -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;

View File

@ -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)
{

View File

@ -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 *);

View File

@ -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;

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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;

View File

@ -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. */

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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 ();

View File

@ -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)
{

View File

@ -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;

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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. */

View File

@ -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)
{

View File

@ -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;

View File

@ -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)
{

View File

@ -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)

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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')
{

View File

@ -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)
{

View File

@ -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;

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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)"));

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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);