[PATCH] gas: constify md_{short,long}opts and md_longopts_size
Jan Beulich
jbeulich@suse.com
Mon Oct 14 12:20:51 GMT 2024
More information about the Binutils mailing list
Mon Oct 14 12:20:51 GMT 2024
- Previous message (by thread): [PATCH] x86: Refine instruction check in x86_check_tls_relocation
- Next message (by thread): [PATCH] ia64/ELF: fix HPUX testsuite fallout
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
First of all make the declarations globally visible, such that producer
and consumer actually share them.
For the latter two simply add const (as PPC already had it,), while for
the former achieve the effect by converting to an array: There's no need
for the extra level of indirection.
--- a/gas/as.c
+++ b/gas/as.c
@@ -438,7 +438,6 @@ parse_args (int * pargc, char *** pargv)
the ordering of the two. We describe each non-option ARGV-element
as if it were the argument of an option with character code 1. */
char *shortopts;
- extern const char *md_shortopts;
static const char std_shortopts[] =
{
'-', 'J',
@@ -455,8 +454,6 @@ parse_args (int * pargc, char *** pargv)
'\0'
};
struct option *longopts;
- extern struct option md_longopts[];
- extern size_t md_longopts_size;
/* Codes used for the long options with no short synonyms. */
enum option_values
{
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -10467,7 +10467,7 @@ md_begin (void)
/* Command line processing. */
-const char *md_shortopts = "m:";
+const char md_shortopts[] = "m:";
#ifdef AARCH64_BI_ENDIAN
#define OPTION_EB (OPTION_MD_BASE + 0)
@@ -10480,7 +10480,7 @@ const char *md_shortopts = "m:";
#endif
#endif
-struct option md_longopts[] = {
+const struct option md_longopts[] = {
#ifdef OPTION_EB
{"EB", no_argument, NULL, OPTION_EB},
#endif
@@ -10490,7 +10490,7 @@ struct option md_longopts[] = {
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
struct aarch64_option_table
{
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -243,12 +243,12 @@ const char EXP_CHARS[] = "eE";
const char FLT_CHARS[] = "rRsSfFdDxXpP";
#ifdef OBJ_EVAX
-const char *md_shortopts = "Fm:g+1h:HG:";
+const char md_shortopts[] = "Fm:g+1h:HG:";
#else
-const char *md_shortopts = "Fm:gG:";
+const char md_shortopts[] = "Fm:gG:";
#endif
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#define OPTION_32ADDR (OPTION_MD_BASE)
{ "32addr", no_argument, NULL, OPTION_32ADDR },
@@ -269,7 +269,7 @@ struct option md_longopts[] =
{ NULL, no_argument, NULL, 0 }
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
#ifdef OBJ_EVAX
#define AXP_REG_R0 0
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -183,7 +183,7 @@ const pseudo_typeS md_pseudo_table[] =
{ NULL, NULL, 0 }
};
-const char *md_shortopts = "";
+const char md_shortopts[] = "";
enum options
{
@@ -229,7 +229,7 @@ enum options
OPTION_RTSC
};
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{ "EB", no_argument, NULL, OPTION_EB },
{ "EL", no_argument, NULL, OPTION_EL },
@@ -292,7 +292,7 @@ struct option md_longopts[] =
{ NULL, no_argument, NULL, 0 }
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* Local data and data types. */
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -30341,7 +30341,7 @@ md_begin (void)
*/
-const char * md_shortopts = "m:k";
+const char md_shortopts[] = "m:k";
#ifdef ARM_BI_ENDIAN
#define OPTION_EB (OPTION_MD_BASE + 0)
@@ -30356,7 +30356,7 @@ const char * md_shortopts = "m:k";
#define OPTION_FIX_V4BX (OPTION_MD_BASE + 2)
#define OPTION_FDPIC (OPTION_MD_BASE + 3)
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#ifdef OPTION_EB
{"EB", no_argument, NULL, OPTION_EB},
@@ -30371,7 +30371,7 @@ struct option md_longopts[] =
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
struct arm_option_table
{
--- a/gas/config/tc-avr.c
+++ b/gas/config/tc-avr.c
@@ -161,7 +161,7 @@ const char line_comment_chars[] = "#";
const char *avr_line_separator_chars = "$";
static const char *avr_line_separator_chars_no_dollar = "";
-const char *md_shortopts = "m:";
+const char md_shortopts[] = "m:";
struct mcu_type_s
{
const char *name;
@@ -571,7 +571,7 @@ enum options
OPTION_NO_DOLLAR_LINE_SEPARATOR,
};
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{ "mmcu", required_argument, NULL, OPTION_MMCU },
{ "mall-opcodes", no_argument, NULL, OPTION_ALL_OPCODES },
@@ -585,7 +585,7 @@ struct option md_longopts[] =
{ NULL, no_argument, NULL, 0 }
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* Display nicely formatted list of known MCU names. */
--- a/gas/config/tc-bfin.c
+++ b/gas/config/tc-bfin.c
@@ -314,13 +314,13 @@ struct bfin_cpu bfin_cpus[] =
};
/* Define bfin-specific command-line options (there are none). */
-const char *md_shortopts = "";
+const char md_shortopts[] = "";
#define OPTION_FDPIC (OPTION_MD_BASE)
#define OPTION_NOPIC (OPTION_MD_BASE + 1)
#define OPTION_MCPU (OPTION_MD_BASE + 2)
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{ "mcpu", required_argument, NULL, OPTION_MCPU },
{ "mfdpic", no_argument, NULL, OPTION_FDPIC },
@@ -329,7 +329,7 @@ struct option md_longopts[] =
{ NULL, no_argument, NULL, 0 },
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
--- a/gas/config/tc-bpf.c
+++ b/gas/config/tc-bpf.c
@@ -126,7 +126,7 @@ enum options
OPTION_NO_RELAX,
};
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{ "EL", no_argument, NULL, OPTION_LITTLE_ENDIAN },
{ "EB", no_argument, NULL, OPTION_BIG_ENDIAN },
@@ -137,9 +137,9 @@ struct option md_longopts[] =
{ NULL, no_argument, NULL, 0 },
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
-const char * md_shortopts = "";
+const char md_shortopts[] = "";
/* BPF supports little-endian and big-endian variants. The following
global records what endianness to use. It can be configured using
--- a/gas/config/tc-cr16.c
+++ b/gas/config/tc-cr16.c
@@ -109,12 +109,12 @@ symbolS * GOT_symbol;
#endif
/* Target-specific multicharacter options, not const-declared at usage. */
-const char *md_shortopts = "";
-struct option md_longopts[] =
+const char md_shortopts[] = "";
+const struct option md_longopts[] =
{
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
static void
l_cons (int nbytes)
--- a/gas/config/tc-cris.c
+++ b/gas/config/tc-cris.c
@@ -414,7 +414,7 @@ const relax_typeS md_cris_relax_table[]
#undef BDAP_WB
/* Target-specific multicharacter options, not const-declared. */
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#define OPTION_NO_US (OPTION_MD_BASE + 0)
{"no-underscore", no_argument, NULL, OPTION_NO_US},
@@ -432,8 +432,8 @@ struct option md_longopts[] =
};
/* Not const-declared. */
-size_t md_longopts_size = sizeof (md_longopts);
-const char *md_shortopts = "hHN";
+const size_t md_longopts_size = sizeof (md_longopts);
+const char md_shortopts[] = "hHN";
/* At first glance, this may seems wrong and should be 4 (ba + nop); but
since a short_jump must skip a *number* of long jumps, it must also be
--- a/gas/config/tc-cris.h
+++ b/gas/config/tc-cris.h
@@ -44,10 +44,6 @@ extern unsigned int cris_mach (void);
#define TARGET_BYTES_BIG_ENDIAN 0
-extern const char *md_shortopts;
-extern struct option md_longopts[];
-extern size_t md_longopts_size;
-
extern const pseudo_typeS md_pseudo_table[];
/* This should be optional, since it is ignored as an escape (assumed to
--- a/gas/config/tc-crx.c
+++ b/gas/config/tc-crx.c
@@ -102,12 +102,12 @@ const char EXP_CHARS[] = "eE";
const char FLT_CHARS[] = "f'";
/* Target-specific multicharacter options, not const-declared at usage. */
-const char *md_shortopts = "";
-struct option md_longopts[] =
+const char md_shortopts[] = "";
+const struct option md_longopts[] =
{
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* This table describes all the machine specific pseudo-ops
the assembler has to support. The fields are:
--- a/gas/config/tc-csky.c
+++ b/gas/config/tc-csky.c
@@ -967,9 +967,9 @@ const char EXP_CHARS[] = "eE";
const char FLT_CHARS[] = "rRsSfFdDxXeEpP";
-const char *md_shortopts = "";
+const char md_shortopts[] = "";
-struct option md_longopts[] = {
+const struct option md_longopts[] = {
#define OPTION_MARCH (OPTION_MD_BASE + 0)
{"march", required_argument, NULL, OPTION_MARCH},
#define OPTION_MCPU (OPTION_MD_BASE + 1)
@@ -1023,7 +1023,7 @@ struct option md_longopts[] = {
{"mvdsp", no_argument, &do_opt_mvdsp, CSKY_ISA_VDSP},
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
static struct csky_insn_info csky_insn;
--- a/gas/config/tc-d10v.c
+++ b/gas/config/tc-d10v.c
@@ -28,7 +28,7 @@
const char comment_chars[] = ";";
const char line_comment_chars[] = "#";
const char line_separator_chars[] = "";
-const char *md_shortopts = "O";
+const char md_shortopts[] = "O";
const char EXP_CHARS[] = "eE";
const char FLT_CHARS[] = "dD";
@@ -88,7 +88,7 @@ enum options
OPTION_NOGSTABSPACKING
};
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{"nowarnswap", no_argument, NULL, OPTION_NOWARNSWAP},
{"gstabspacking", no_argument, NULL, OPTION_GSTABSPACKING},
@@ -98,7 +98,7 @@ struct option md_longopts[] =
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* Opcode hash table. */
static htab_t d10v_hash;
--- a/gas/config/tc-d30v.c
+++ b/gas/config/tc-d30v.c
@@ -27,7 +27,7 @@
const char comment_chars[] = ";";
const char line_comment_chars[] = "#";
const char line_separator_chars[] = "";
-const char *md_shortopts = "OnNcC";
+const char md_shortopts[] = "OnNcC";
const char EXP_CHARS[] = "eE";
const char FLT_CHARS[] = "dD";
@@ -107,12 +107,12 @@ static symbolS *d30v_last_label;
#define NOP_RIGHT ((long long) NOP)
#define NOP2 (FM00 | NOP_LEFT | NOP_RIGHT)
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* Opcode hash table. */
static htab_t d30v_hash;
--- a/gas/config/tc-dlx.c
+++ b/gas/config/tc-dlx.c
@@ -1047,14 +1047,14 @@ md_apply_fix (fixS *fixP, valueT *valP,
fixP->fx_no_overflow = 1;
}
-const char *md_shortopts = "";
+const char md_shortopts[] = "";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c ATTRIBUTE_UNUSED,
--- a/gas/config/tc-epiphany.c
+++ b/gas/config/tc-epiphany.c
@@ -103,16 +103,16 @@ enum options
OPTION_CPU_EPIPHANY16
};
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{ "mepiphany ", no_argument, NULL, OPTION_CPU_EPIPHANY },
{ "mepiphany16", no_argument, NULL, OPTION_CPU_EPIPHANY16 },
{ NULL, no_argument, NULL, 0 },
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
-const char * md_shortopts = "";
+const char md_shortopts[] = "";
int
md_parse_option (int c ATTRIBUTE_UNUSED, const char * arg ATTRIBUTE_UNUSED)
--- a/gas/config/tc-fr30.c
+++ b/gas/config/tc-fr30.c
@@ -55,13 +55,13 @@ const char EXP_CHARS[] = "eE"
const char FLT_CHARS[] = "dD";
#define FR30_SHORTOPTS ""
-const char * md_shortopts = FR30_SHORTOPTS;
+const char md_shortopts[] = FR30_SHORTOPTS;
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c ATTRIBUTE_UNUSED,
--- a/gas/config/tc-frv.c
+++ b/gas/config/tc-frv.c
@@ -200,7 +200,7 @@ const pseudo_typeS md_pseudo_table[] =
#define FRV_SHORTOPTS "G:"
-const char * md_shortopts = FRV_SHORTOPTS;
+const char md_shortopts[] = FRV_SHORTOPTS;
#define OPTION_GPR_32 (OPTION_MD_BASE)
#define OPTION_GPR_64 (OPTION_MD_BASE + 1)
@@ -226,7 +226,7 @@ const char * md_shortopts = FRV_SHORTOPT
#define OPTION_FDPIC (OPTION_MD_BASE + 21)
#define OPTION_NOPIC (OPTION_MD_BASE + 22)
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{ "mgpr-32", no_argument, NULL, OPTION_GPR_32 },
{ "mgpr-64", no_argument, NULL, OPTION_GPR_64 },
@@ -255,7 +255,7 @@ struct option md_longopts[] =
{ NULL, no_argument, NULL, 0 },
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* What value to give to bfd_set_gp_size. */
static int g_switch_value = 8;
--- a/gas/config/tc-ft32.c
+++ b/gas/config/tc-ft32.c
@@ -487,16 +487,16 @@ md_atof (int type, char *litP, int *size
return NULL;
}
-const char *md_shortopts = "";
+const char md_shortopts[] = "";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#define OPTION_NORELAX (OPTION_MD_BASE)
{"norelax", no_argument, NULL, OPTION_NORELAX},
{"no-relax", no_argument, NULL, OPTION_NORELAX},
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* We have no target specific options yet, so these next
two functions are empty. */
--- a/gas/config/tc-h8300.c
+++ b/gas/config/tc-h8300.c
@@ -2076,15 +2076,15 @@ md_atof (int type, char *litP, int *size
#define OPTION_H_TICK_HEX (OPTION_MD_BASE)
#define OPTION_MACH (OPTION_MD_BASE+1)
-const char *md_shortopts = "";
-struct option md_longopts[] =
+const char md_shortopts[] = "";
+const struct option md_longopts[] =
{
{ "h-tick-hex", no_argument, NULL, OPTION_H_TICK_HEX },
{ "mach", required_argument, NULL, OPTION_MACH },
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
struct mach_func
{
--- a/gas/config/tc-hppa.c
+++ b/gas/config/tc-hppa.c
@@ -1631,26 +1631,26 @@ md_estimate_size_before_relax (fragS *fr
#ifdef OBJ_ELF
# ifdef WARN_COMMENTS
-const char *md_shortopts = "Vc";
+const char md_shortopts[] = "Vc";
# else
-const char *md_shortopts = "V";
+const char md_shortopts[] = "V";
# endif
#else
# ifdef WARN_COMMENTS
-const char *md_shortopts = "c";
+const char md_shortopts[] = "c";
# else
-const char *md_shortopts = "";
+const char md_shortopts[] = "";
# endif
#endif
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#ifdef WARN_COMMENTS
{"warn-comment", no_argument, NULL, 'c'},
#endif
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -16781,9 +16781,9 @@ bool i386_record_operator (operatorT op,
#endif
#ifdef OBJ_ELF
-const char *md_shortopts = "kVQ:sqnO::";
+const char md_shortopts[] = "kVQ:sqnO::";
#else
-const char *md_shortopts = "qnO::";
+const char md_shortopts[] = "qnO::";
#endif
#define OPTION_32 (OPTION_MD_BASE + 0)
@@ -16823,7 +16823,7 @@ const char *md_shortopts = "qnO::";
#define OPTION_MUSE_UNALIGNED_VECTOR_MOVE (OPTION_MD_BASE + 34)
#define OPTION_MTLS_CHECK (OPTION_MD_BASE + 35)
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{"32", no_argument, NULL, OPTION_32},
#if (defined (OBJ_ELF) || defined (TE_PE) || defined (OBJ_MACH_O)) \
@@ -16873,7 +16873,7 @@ struct option md_longopts[] =
{"mtls-check", required_argument, NULL, OPTION_MTLS_CHECK},
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c, const char *arg)
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -210,9 +210,9 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
/* ia64-specific option processing: */
-const char *md_shortopts = "m:N:x::";
+const char md_shortopts[] = "m:N:x::";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#define OPTION_MCONSTANT_GP (OPTION_MD_BASE + 1)
{"mconstant-gp", no_argument, NULL, OPTION_MCONSTANT_GP},
@@ -220,7 +220,7 @@ struct option md_longopts[] =
{"mauto-pic", no_argument, NULL, OPTION_MAUTO_PIC}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
static struct
{
--- a/gas/config/tc-ip2k.c
+++ b/gas/config/tc-ip2k.c
@@ -101,15 +101,15 @@ enum options
OPTION_CPU_IP2022EXT
};
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{ "mip2022", no_argument, NULL, OPTION_CPU_IP2022 },
{ "mip2022ext", no_argument, NULL, OPTION_CPU_IP2022EXT },
{ NULL, no_argument, NULL, 0 },
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
-const char * md_shortopts = "";
+const char md_shortopts[] = "";
int
md_parse_option (int c ATTRIBUTE_UNUSED, const char * arg ATTRIBUTE_UNUSED)
--- a/gas/config/tc-iq2000.c
+++ b/gas/config/tc-iq2000.c
@@ -108,12 +108,12 @@ static struct iq2000_hi_fixup * iq2000_h
/* Macro hash table, which we will add to. */
extern struct htab *macro_hash;
-const char *md_shortopts = "";
-struct option md_longopts[] =
+const char md_shortopts[] = "";
+const struct option md_longopts[] =
{
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c ATTRIBUTE_UNUSED,
--- a/gas/config/tc-kvx.c
+++ b/gas/config/tc-kvx.c
@@ -233,7 +233,7 @@ struct label_fix
/* OPTIONS PROCESSING */
/*****************************************************/
-const char *md_shortopts = "hV"; /* catted to std short options */
+const char md_shortopts[] = "hV"; /* catted to std short options */
/* added to std long options */
@@ -254,7 +254,7 @@ const char *md_shortopts = "hV"; /* catt
#define OPTION_MORE (OPTION_MD_BASE + 19)
#define OPTION_NO_MORE (OPTION_MD_BASE + 20)
-struct option md_longopts[] = {
+const struct option md_longopts[] = {
{ "march", required_argument, NULL, OPTION_MARCH },
{ "check-resources", no_argument, NULL, OPTION_CHECK_RESOURCES },
{ "no-check-resources", no_argument, NULL, OPTION_NO_CHECK_RESOURCES },
@@ -273,7 +273,7 @@ struct option md_longopts[] = {
{ NULL, no_argument, NULL, 0 }
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
--- a/gas/config/tc-lm32.c
+++ b/gas/config/tc-lm32.c
@@ -85,9 +85,9 @@ const pseudo_typeS md_pseudo_table[] =
/* Target specific command line options. */
-const char * md_shortopts = "";
+const char md_shortopts[] = "";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#define OPTION_MULTIPLY_ENABLED (OPTION_MD_BASE + 1)
{ "mmultiply-enabled", no_argument, NULL, OPTION_MULTIPLY_ENABLED },
@@ -109,7 +109,7 @@ struct option md_longopts[] =
{ "mall-enabled", no_argument, NULL, OPTION_ALL_ENABLED },
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* Display architecture specific options. */
--- a/gas/config/tc-loongarch.c
+++ b/gas/config/tc-loongarch.c
@@ -112,7 +112,7 @@ const char EXP_CHARS[] = "eE";
/* or 0d1.2345e12. */
const char FLT_CHARS[] = "rRsSfFdDxXpP";
-const char *md_shortopts = "O::g::G:";
+const char md_shortopts[] = "O::g::G:";
static const char default_arch[] = DEFAULT_ARCH;
@@ -154,7 +154,7 @@ enum options
OPTION_END_OF_ENUM,
};
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{ "mabi", required_argument, NULL, OPTION_ABI },
@@ -172,7 +172,7 @@ struct option md_longopts[] =
{ NULL, no_argument, NULL, 0 }
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c, const char *arg)
--- a/gas/config/tc-m32c.c
+++ b/gas/config/tc-m32c.c
@@ -61,7 +61,7 @@ const char EXP_CHARS[] = "eE"
const char FLT_CHARS[] = "dD";
#define M32C_SHORTOPTS ""
-const char * md_shortopts = M32C_SHORTOPTS;
+const char md_shortopts[] = M32C_SHORTOPTS;
/* assembler options */
#define OPTION_CPU_M16C (OPTION_MD_BASE)
@@ -69,7 +69,7 @@ const char * md_shortopts = M32C_SHORTOP
#define OPTION_LINKRELAX (OPTION_MD_BASE + 2)
#define OPTION_H_TICK_HEX (OPTION_MD_BASE + 3)
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{ "m16c", no_argument, NULL, OPTION_CPU_M16C },
{ "m32c", no_argument, NULL, OPTION_CPU_M32C },
@@ -77,7 +77,7 @@ struct option md_longopts[] =
{ "h-tick-hex", no_argument, NULL, OPTION_H_TICK_HEX },
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* Default machine */
--- a/gas/config/tc-m32r.c
+++ b/gas/config/tc-m32r.c
@@ -189,7 +189,7 @@ allow_m32rx (int on)
#define M32R_SHORTOPTS "O::K:"
-const char *md_shortopts = M32R_SHORTOPTS;
+const char md_shortopts[] = M32R_SHORTOPTS;
enum md_option_enums
{
@@ -212,7 +212,7 @@ enum md_option_enums
OPTION_NO_WARN_UNMATCHED
};
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{"m32r", no_argument, NULL, OPTION_M32R},
{"m32rx", no_argument, NULL, OPTION_M32RX},
@@ -243,7 +243,7 @@ struct option md_longopts[] =
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
static void
little (int on)
--- a/gas/config/tc-m68hc11.c
+++ b/gas/config/tc-m68hc11.c
@@ -323,9 +323,9 @@ const pseudo_typeS md_pseudo_table[] =
/* Options and initialization. */
-const char *md_shortopts = "Sm:";
+const char md_shortopts[] = "Sm:";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#define OPTION_FORCE_LONG_BRANCH (OPTION_MD_BASE)
{"force-long-branches", no_argument, NULL, OPTION_FORCE_LONG_BRANCH},
@@ -364,7 +364,7 @@ struct option md_longopts[] =
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* Get the target cpu for the assembler. This is based on the configure
options and on the -m68hc11/-m68hc12 option. If no option is specified,
--- a/gas/config/tc-m68k.c
+++ b/gas/config/tc-m68k.c
@@ -7341,9 +7341,9 @@ m68k_set_extension (char const *name, in
Invocation line includes a switch not recognized by the base assembler.
*/
-const char *md_shortopts = "lSA:m:kQ:V";
+const char md_shortopts[] = "lSA:m:kQ:V";
-struct option md_longopts[] = {
+const struct option md_longopts[] = {
#define OPTION_PIC (OPTION_MD_BASE)
{"pic", no_argument, NULL, OPTION_PIC},
#define OPTION_REGISTER_PREFIX_OPTIONAL (OPTION_MD_BASE + 1)
@@ -7363,7 +7363,7 @@ struct option md_longopts[] = {
{"pcrel", no_argument, NULL, OPTION_PCREL},
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c, const char *arg)
--- a/gas/config/tc-mcore.c
+++ b/gas/config/tc-mcore.c
@@ -1629,7 +1629,7 @@ md_atof (int type, char * litP, int * si
return ieee_md_atof (type, litP, sizeP, target_big_endian);
}
-const char * md_shortopts = "";
+const char md_shortopts[] = "";
enum options
{
@@ -1642,7 +1642,7 @@ enum options
OPTION_EL,
};
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{ "no-jsri2bsr", no_argument, NULL, OPTION_JSRI2BSR_OFF},
{ "jsri2bsr", no_argument, NULL, OPTION_JSRI2BSR_ON},
@@ -1654,7 +1654,7 @@ struct option md_longopts[] =
{ NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c, const char * arg)
--- a/gas/config/tc-mep.c
+++ b/gas/config/tc-mep.c
@@ -139,7 +139,7 @@ static struct mep_hi_fixup * mep_hi_fixu
#define OPTION_NODSP (OPTION_MD_BASE + 32)
#define OPTION_LIBRARY (OPTION_MD_BASE + 33)
-struct option md_longopts[] = {
+const struct option md_longopts[] = {
{ "EB", no_argument, NULL, OPTION_EB},
{ "EL", no_argument, NULL, OPTION_EL},
{ "mconfig", required_argument, NULL, OPTION_CONFIG},
@@ -170,7 +170,7 @@ struct option md_longopts[] = {
{ "mno-dsp", no_argument, NULL, OPTION_NODSP},
{ "mlibrary", no_argument, NULL, OPTION_LIBRARY},
{ NULL, 0, NULL, 0 } };
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* Options which default to on/off together. See the comment where
this is used for details. Note that CP and CP64 are not in this
@@ -189,7 +189,7 @@ size_t md_longopts_size = sizeof (md_lon
| (1 << CGEN_INSN_OPTIONAL_UCI_INSN) \
| (1 << CGEN_INSN_OPTIONAL_DSP_INSN) )
-const char * md_shortopts = "";
+const char md_shortopts[] = "";
static int optbits = 0;
static int optbitset = 0;
--- a/gas/config/tc-metag.c
+++ b/gas/config/tc-metag.c
@@ -81,13 +81,13 @@ static unsigned int mcpu_opt = CoreMeta1
static unsigned int mfpu_opt = 0;
static unsigned int mdsp_opt = 0;
-const char * md_shortopts = "m:";
+const char md_shortopts[] = "m:";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* Parser hash tables. */
static htab_t mnemonic_htab;
--- a/gas/config/tc-microblaze.c
+++ b/gas/config/tc-microblaze.c
@@ -1901,9 +1901,9 @@ md_atof (int type, char * litP, int * si
return NULL;
}
-const char * md_shortopts = "";
+const char md_shortopts[] = "";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{"EB", no_argument, NULL, OPTION_EB},
{"EL", no_argument, NULL, OPTION_EL},
@@ -1912,7 +1912,7 @@ struct option md_longopts[] =
{ NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int md_short_jump_size;
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -1450,7 +1450,7 @@ static const struct mips_cpu_info *mips_
static const struct mips_cpu_info *mips_cpu_info_from_arch (int);
/* Command-line options. */
-const char *md_shortopts = "O::g::G:";
+const char md_shortopts[] = "O::g::G:";
enum options
{
@@ -1585,7 +1585,7 @@ enum options
OPTION_END_OF_ENUM
};
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
/* Options which specify architecture. */
{"march", required_argument, NULL, OPTION_MARCH},
@@ -1738,7 +1738,7 @@ struct option md_longopts[] =
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* Information about either an Application Specific Extension or an
optional architecture feature that, for simplicity, we treat in the
--- a/gas/config/tc-mmix.c
+++ b/gas/config/tc-mmix.c
@@ -80,7 +80,7 @@ static void mmix_cons (int);
} \
while (0)
-const char *md_shortopts = "x";
+const char md_shortopts[] = "x";
static int current_fb_label = -1;
static char *pending_label = NULL;
@@ -189,7 +189,7 @@ static int doing_bspec = 0;
static const char *bspec_file;
static unsigned int bspec_line;
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#define OPTION_RELAX (OPTION_MD_BASE)
#define OPTION_NOEXPAND (OPTION_RELAX + 1)
@@ -215,7 +215,7 @@ struct option md_longopts[] =
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
static htab_t mmix_opcode_hash;
--- a/gas/config/tc-mn10200.c
+++ b/gas/config/tc-mn10200.c
@@ -85,14 +85,14 @@ struct mn10200_fixup
struct mn10200_fixup fixups[MAX_INSN_FIXUPS];
static int fc;
-const char *md_shortopts = "";
+const char md_shortopts[] = "";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* The target specific pseudo-ops which we support. */
const pseudo_typeS md_pseudo_table[] =
--- a/gas/config/tc-mn10300.c
+++ b/gas/config/tc-mn10300.c
@@ -107,14 +107,14 @@ static int fc;
verify that certain registers do not match. */
int mn10300_reg_operands[MN10300_MAX_OPERANDS];
-const char *md_shortopts = "";
+const char md_shortopts[] = "";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
#define HAVE_AM33_2 (current_machine == AM33_2)
#define HAVE_AM33 (current_machine == AM33 || HAVE_AM33_2)
--- a/gas/config/tc-moxie.c
+++ b/gas/config/tc-moxie.c
@@ -606,16 +606,16 @@ enum options
OPTION_EL,
};
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{ "EB", no_argument, NULL, OPTION_EB},
{ "EL", no_argument, NULL, OPTION_EL},
{ NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
-const char *md_shortopts = "";
+const char md_shortopts[] = "";
int
md_parse_option (int c ATTRIBUTE_UNUSED, const char *arg ATTRIBUTE_UNUSED)
--- a/gas/config/tc-msp430.c
+++ b/gas/config/tc-msp430.c
@@ -1742,9 +1742,9 @@ const pseudo_typeS md_pseudo_table[] =
{NULL, NULL, 0}
};
-const char *md_shortopts = "mm:,mP,mQ,ml,mN,mn,my,mY,mu,mU";
+const char md_shortopts[] = "mm:,mP,mQ,ml,mN,mn,my,mY,mu,mU";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{"msilicon-errata", required_argument, NULL, OPTION_SILICON_ERRATA},
{"msilicon-errata-warn", required_argument, NULL, OPTION_SILICON_ERRATA_WARN},
@@ -1764,7 +1764,7 @@ struct option md_longopts[] =
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
void
md_show_usage (FILE * stream)
--- a/gas/config/tc-mt.c
+++ b/gas/config/tc-mt.c
@@ -68,7 +68,7 @@ const pseudo_typeS md_pseudo_table[] =
static int no_scheduling_restrictions = 0;
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#define OPTION_NO_SCHED_REST (OPTION_MD_BASE)
{ "nosched", no_argument, NULL, OPTION_NO_SCHED_REST },
@@ -76,9 +76,9 @@ struct option md_longopts[] =
{ "march", required_argument, NULL, OPTION_MARCH},
{ NULL, no_argument, NULL, 0 },
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
-const char * md_shortopts = "";
+const char md_shortopts[] = "";
/* Mach selected from command line. */
static int mt_mach = bfd_mach_ms1;
--- a/gas/config/tc-nds32.c
+++ b/gas/config/tc-nds32.c
@@ -2313,8 +2313,8 @@ enum options
OPTION_OPTIMIZE_SPACE
};
-const char *md_shortopts = "m:O:";
-struct option md_longopts[] =
+const char md_shortopts[] = "m:O:";
+const struct option md_longopts[] =
{
{"O1", no_argument, NULL, OPTION_OPTIMIZE},
{"Os", no_argument, NULL, OPTION_OPTIMIZE_SPACE},
@@ -2334,7 +2334,7 @@ struct option md_longopts[] =
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
struct nds32_parse_option_table
{
--- a/gas/config/tc-nios2.c
+++ b/gas/config/tc-nios2.c
@@ -68,9 +68,9 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
/* Machine-dependent command-line options. */
-const char *md_shortopts = "r";
+const char md_shortopts[] = "r";
-struct option md_longopts[] = {
+const struct option md_longopts[] = {
#define OPTION_RELAX_ALL (OPTION_MD_BASE + 0)
{"relax-all", no_argument, NULL, OPTION_RELAX_ALL},
#define OPTION_NORELAX (OPTION_MD_BASE + 1)
@@ -85,7 +85,7 @@ struct option md_longopts[] = {
{"march", required_argument, NULL, OPTION_MARCH}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* The assembler supports three different relaxation modes, controlled by
command-line options. */
--- a/gas/config/tc-ns32k.c
+++ b/gas/config/tc-ns32k.c
@@ -2109,16 +2109,16 @@ md_create_long_jump (char *ptr,
md_number_to_disp (ptr + 1, (valueT) offset, 4);
}
-const char *md_shortopts = "m:";
+const char md_shortopts[] = "m:";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#define OPTION_DISP_SIZE (OPTION_MD_BASE)
{"disp-size-default", required_argument , NULL, OPTION_DISP_SIZE},
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c, const char *arg)
--- a/gas/config/tc-or1k.c
+++ b/gas/config/tc-or1k.c
@@ -56,13 +56,13 @@ const char EXP_CHARS[] = "eE"
const char FLT_CHARS[] = "dD";
#define OR1K_SHORTOPTS "m:"
-const char * md_shortopts = OR1K_SHORTOPTS;
+const char md_shortopts[] = OR1K_SHORTOPTS;
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
unsigned long or1k_machine = 0; /* default */
--- a/gas/config/tc-pdp11.c
+++ b/gas/config/tc-pdp11.c
@@ -1271,9 +1271,9 @@ set_machine_model (const char *arg)
return 0;
}
-const char *md_shortopts = "m:";
+const char md_shortopts[] = "m:";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#define OPTION_CPU 257
{ "cpu", required_argument, NULL, OPTION_CPU },
@@ -1284,7 +1284,7 @@ struct option md_longopts[] =
{ NULL, no_argument, NULL, 0 }
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* Invocation line includes a switch not recognized by the base assembler.
See if it's a processor-specific option. */
--- a/gas/config/tc-pj.c
+++ b/gas/config/tc-pj.c
@@ -319,9 +319,9 @@ md_atof (int type, char *litP, int *size
return ieee_md_atof (type, litP, sizeP, target_big_endian);
}
-const char *md_shortopts = "";
+const char md_shortopts[] = "";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#define OPTION_LITTLE (OPTION_MD_BASE)
#define OPTION_BIG (OPTION_LITTLE + 1)
@@ -330,7 +330,7 @@ struct option md_longopts[] =
{"big", no_argument, NULL, OPTION_BIG},
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -1098,9 +1098,9 @@ unsigned int ppc_apuinfo_num_alloc;
#endif /* OBJ_ELF */
#ifdef OBJ_ELF
-const char *const md_shortopts = "b:l:usm:K:VQ:";
+const char md_shortopts[] = "b:l:usm:K:VQ:";
#else
-const char *const md_shortopts = "um:";
+const char md_shortopts[] = "um:";
#endif
#define OPTION_NOPS (OPTION_MD_BASE + 0)
const struct option md_longopts[] = {
--- a/gas/config/tc-pru.c
+++ b/gas/config/tc-pru.c
@@ -75,7 +75,7 @@ struct pru_opt_s
static struct pru_opt_s pru_opt = { true, true };
-const char *md_shortopts = "r";
+const char md_shortopts[] = "r";
enum options
{
@@ -84,7 +84,7 @@ enum options
OPTION_NO_WARN_REGNAME_LABEL,
};
-struct option md_longopts[] = {
+const struct option md_longopts[] = {
{ "mlink-relax", no_argument, NULL, OPTION_LINK_RELAX },
{ "mno-link-relax", no_argument, NULL, OPTION_NO_LINK_RELAX },
{ "mno-warn-regname-label", no_argument, NULL,
@@ -92,7 +92,7 @@ struct option md_longopts[] = {
{ NULL, no_argument, NULL, 0 }
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
typedef struct pru_insn_reloc
{
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -4310,7 +4310,7 @@ md_number_to_chars (char *buf, valueT va
number_to_chars_littleendian (buf, val, n);
}
-const char *md_shortopts = "O::g::G:";
+const char md_shortopts[] = "O::g::G:";
enum options
{
@@ -4331,7 +4331,7 @@ enum options
OPTION_END_OF_ENUM
};
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{"march", required_argument, NULL, OPTION_MARCH},
{"fPIC", no_argument, NULL, OPTION_PIC},
@@ -4351,7 +4351,7 @@ struct option md_longopts[] =
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c, const char *arg)
--- a/gas/config/tc-rl78.c
+++ b/gas/config/tc-rl78.c
@@ -288,10 +288,10 @@ enum options
};
#define RL78_SHORTOPTS ""
-const char * md_shortopts = RL78_SHORTOPTS;
+const char md_shortopts[] = RL78_SHORTOPTS;
/* Assembler options. */
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{"relax", no_argument, NULL, OPTION_RELAX},
{"norelax", no_argument, NULL, OPTION_NORELAX},
@@ -303,7 +303,7 @@ struct option md_longopts[] =
{"m64bit-doubles", no_argument, NULL, OPTION_64BIT_DOUBLES},
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
--- a/gas/config/tc-rx.c
+++ b/gas/config/tc-rx.c
@@ -78,10 +78,10 @@ enum options
};
#define RX_SHORTOPTS ""
-const char * md_shortopts = RX_SHORTOPTS;
+const char md_shortopts[] = RX_SHORTOPTS;
/* Assembler options. */
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{"mbig-endian-data", no_argument, NULL, OPTION_BIG},
{"mlittle-endian-data", no_argument, NULL, OPTION_LITTLE},
@@ -105,7 +105,7 @@ struct option md_longopts[] =
{"mno-allow-string-insns", no_argument, NULL, OPTION_DISALLOW_STRING_INSNS},
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
struct cpu_type
{
--- a/gas/config/tc-s12z.c
+++ b/gas/config/tc-s12z.c
@@ -84,9 +84,9 @@ s12z_strtol (const char *str, char ** en
/* Options and initialization. */
-const char *md_shortopts = "";
+const char md_shortopts[] = "";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#define OPTION_REG_PREFIX (OPTION_MD_BASE)
{"mreg-prefix", required_argument, NULL, OPTION_REG_PREFIX},
@@ -95,7 +95,7 @@ struct option md_longopts[] =
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
relax_typeS md_relax_table[] =
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -254,11 +254,11 @@ int md_short_jump_size = 4;
int md_long_jump_size = 4;
#endif
-const char *md_shortopts = "A:m:kVQ:";
-struct option md_longopts[] = {
+const char md_shortopts[] = "A:m:kVQ:";
+const struct option md_longopts[] = {
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* Initialize the default opcode arch and word size from the default
architecture name if not specified by an option. */
--- a/gas/config/tc-score.c
+++ b/gas/config/tc-score.c
@@ -216,8 +216,8 @@ const pseudo_typeS md_pseudo_table[] =
{0, 0, 0}
};
-const char *md_shortopts = "nO::g::G:";
-struct option md_longopts[] =
+const char md_shortopts[] = "nO::g::G:";
+const struct option md_longopts[] =
{
#ifdef OPTION_EB
{"EB" , no_argument, NULL, OPTION_EB},
@@ -239,7 +239,7 @@ struct option md_longopts[] =
{NULL , no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
#define s3_GP 28
#define s3_PIC_CALL_REG 29
--- a/gas/config/tc-sh.c
+++ b/gas/config/tc-sh.c
@@ -2708,8 +2708,8 @@ enum options
OPTION_DUMMY /* Not used. This is just here to make it easy to add and subtract options from this enum. */
};
-const char *md_shortopts = "";
-struct option md_longopts[] =
+const char md_shortopts[] = "";
+const struct option md_longopts[] =
{
{"relax", no_argument, NULL, OPTION_RELAX},
{"big", no_argument, NULL, OPTION_BIG},
@@ -2732,7 +2732,7 @@ struct option md_longopts[] =
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -401,8 +401,8 @@ sparc_target_format (void)
* error. For example, from sparclite to v9.
*/
-const char *md_shortopts = "A:K:VQ:sq";
-struct option md_longopts[] = {
+const char md_shortopts[] = "A:K:VQ:sq";
+const struct option md_longopts[] = {
#define OPTION_BUMP (OPTION_MD_BASE)
{"bump", no_argument, NULL, OPTION_BUMP},
#define OPTION_SPARC (OPTION_MD_BASE + 1)
@@ -442,7 +442,7 @@ struct option md_longopts[] = {
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c, const char *arg)
--- a/gas/config/tc-spu.c
+++ b/gas/config/tc-spu.c
@@ -120,8 +120,8 @@ md_begin (void)
str_hash_insert (op_hash, spu_opcodes[i].mnemonic, &spu_opcodes[i], 0);
}
-const char *md_shortopts = "";
-struct option md_longopts[] = {
+const char md_shortopts[] = "";
+const struct option md_longopts[] = {
#define OPTION_APUASM (OPTION_MD_BASE)
{"apuasm", no_argument, NULL, OPTION_APUASM},
#define OPTION_DD2 (OPTION_MD_BASE+1)
@@ -132,7 +132,7 @@ struct option md_longopts[] = {
{"mdd3.0", no_argument, NULL, OPTION_DD3},
{ NULL, no_argument, NULL, 0 }
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* When set (by -apuasm) our assembler emulates the behaviour of apuasm.
* e.g. don't add bias to float conversion and don't right shift
--- a/gas/config/tc-tic30.c
+++ b/gas/config/tc-tic30.c
@@ -40,13 +40,13 @@ const char comment_chars[] = ";";
const char line_comment_chars[] = "*";
const char line_separator_chars[] = "";
-const char *md_shortopts = "";
-struct option md_longopts[] =
+const char md_shortopts[] = "";
+const struct option md_longopts[] =
{
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* Chars that mean this number is a floating point constant.
As in 0f12.456
--- a/gas/config/tc-tic4x.c
+++ b/gas/config/tc-tic4x.c
@@ -77,8 +77,8 @@ static unsigned long tic4x_oplevel = 0;
#define OPTION_ENHANCED (OPTION_MD_BASE + 7)
#define OPTION_REV (OPTION_MD_BASE + 8)
-const char *md_shortopts = "bm:prs";
-struct option md_longopts[] =
+const char md_shortopts[] = "bm:prs";
+const struct option md_longopts[] =
{
{ "mcpu", required_argument, NULL, OPTION_CPU },
{ "mdsp", required_argument, NULL, OPTION_CPU },
@@ -93,8 +93,7 @@ struct option md_longopts[] =
{ NULL, no_argument, NULL, 0 }
};
-size_t md_longopts_size = sizeof (md_longopts);
-
+const size_t md_longopts_size = sizeof (md_longopts);
typedef enum
{
--- a/gas/config/tc-tic54x.c
+++ b/gas/config/tc-tic54x.c
@@ -138,14 +138,14 @@ const char FLT_CHARS[] = "fF";
nums. */
const char EXP_CHARS[] = "eE";
-const char *md_shortopts = "";
+const char md_shortopts[] = "";
#define OPTION_ADDRESS_MODE (OPTION_MD_BASE)
#define OPTION_CPU_VERSION (OPTION_ADDRESS_MODE + 1)
#define OPTION_COFF_VERSION (OPTION_CPU_VERSION + 1)
#define OPTION_STDERR_TO_FILE (OPTION_COFF_VERSION + 1)
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{ "mfar-mode", no_argument, NULL, OPTION_ADDRESS_MODE },
{ "mf", no_argument, NULL, OPTION_ADDRESS_MODE },
@@ -155,7 +155,7 @@ struct option md_longopts[] =
{ NULL, no_argument, NULL, 0},
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
static int assembly_begun = 0;
/* Addressing mode is not entirely implemented; the latest rev of the Other
--- a/gas/config/tc-tic6x.c
+++ b/gas/config/tc-tic6x.c
@@ -48,7 +48,7 @@ const char line_separator_chars[] = "@";
const char EXP_CHARS[] = "eE";
const char FLT_CHARS[] = "dDfF";
-const char *md_shortopts = "";
+const char md_shortopts[] = "";
enum
{
@@ -63,7 +63,7 @@ enum
OPTION_MGENERATE_REL
};
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{ "march", required_argument, NULL, OPTION_MARCH },
{ "mbig-endian", no_argument, NULL, OPTION_MBIG_ENDIAN },
@@ -76,7 +76,7 @@ struct option md_longopts[] =
{ "mgenerate-rel", no_argument, NULL, OPTION_MGENERATE_REL },
{ NULL, no_argument, NULL, 0 }
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* The instructions enabled based only on the selected architecture
(all instructions, if no architecture specified). */
--- a/gas/config/tc-tilegx.c
+++ b/gas/config/tc-tilegx.c
@@ -84,9 +84,9 @@ tilegx_target_format (void)
#define OPTION_EB (OPTION_MD_BASE + 2)
#define OPTION_EL (OPTION_MD_BASE + 3)
-const char *md_shortopts = "VQ:";
+const char md_shortopts[] = "VQ:";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{"32", no_argument, NULL, OPTION_32},
{"64", no_argument, NULL, OPTION_64},
@@ -95,7 +95,7 @@ struct option md_longopts[] =
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
--- a/gas/config/tc-tilepro.c
+++ b/gas/config/tc-tilepro.c
@@ -61,14 +61,14 @@ const char EXP_CHARS[] = "eE";
as in 0d1.0. */
const char FLT_CHARS[] = "rRsSfFdDxXpP";
-const char *md_shortopts = "VQ:";
+const char md_shortopts[] = "VQ:";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c, const char *arg ATTRIBUTE_UNUSED)
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -1515,9 +1515,9 @@ parse_register_list (unsigned long *insn
return NULL;
}
-const char *md_shortopts = "m:";
+const char md_shortopts[] = "m:";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#define OPTION_DISP_SIZE_DEFAULT_22 (OPTION_MD_BASE)
{"disp-size-default-22", no_argument, NULL, OPTION_DISP_SIZE_DEFAULT_22},
@@ -1526,7 +1526,7 @@ struct option md_longopts[] =
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
static bool v850_data_8 = false;
--- a/gas/config/tc-vax.c
+++ b/gas/config/tc-vax.c
@@ -2190,18 +2190,18 @@ md_create_long_jump (char *ptr,
}
#ifdef OBJ_ELF
-const char *md_shortopts = "d:STt:VkQ:";
+const char md_shortopts[] = "d:STt:VkQ:";
#else
-const char *md_shortopts = "d:STt:V";
+const char md_shortopts[] = "d:STt:V";
#endif
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#ifdef OBJ_ELF
{ "pic", no_argument, NULL, 'k' },
#endif
{ NULL, no_argument, NULL, 0 }
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c, const char *arg)
--- a/gas/config/tc-visium.c
+++ b/gas/config/tc-visium.c
@@ -218,14 +218,14 @@ md_undefined_symbol (char *name ATTRIBUT
}
/* The parse options. */
-const char *md_shortopts = "m:";
+const char md_shortopts[] = "m:";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
struct visium_option_table
{
--- a/gas/config/tc-wasm32.c
+++ b/gas/config/tc-wasm32.c
@@ -78,7 +78,7 @@ const char comment_chars[] = ";#";
const char line_comment_chars[] = ";#";
const char line_separator_chars[] = "";
-const char *md_shortopts = "m:";
+const char md_shortopts[] = "m:";
const char EXP_CHARS[] = "eE";
const char FLT_CHARS[] = "dD";
@@ -94,12 +94,12 @@ const pseudo_typeS md_pseudo_table[] =
static htab_t wasm32_hash;
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
/* No relaxation/no machine-dependent frags. */
--- a/gas/config/tc-xgate.c
+++ b/gas/config/tc-xgate.c
@@ -163,9 +163,9 @@ const pseudo_typeS md_pseudo_table[] =
{0, 0, 0}
};
-const char *md_shortopts = "m:";
+const char md_shortopts[] = "m:";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#define OPTION_PRINT_INSN_SYNTAX (OPTION_MD_BASE + 0)
{ "print-insn-syntax", no_argument, NULL, OPTION_PRINT_INSN_SYNTAX },
@@ -191,7 +191,7 @@ struct option md_longopts[] =
{ NULL, no_argument, NULL, 0 }
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
const char *
md_atof (int type, char *litP, int *sizeP)
--- a/gas/config/tc-xstormy16.c
+++ b/gas/config/tc-xstormy16.c
@@ -56,13 +56,13 @@ const char FLT_CHARS[] = "dD"
#define O_fptr_symbol (O_max + 1)
#define XSTORMY16_SHORTOPTS ""
-const char * md_shortopts = XSTORMY16_SHORTOPTS;
+const char md_shortopts[] = XSTORMY16_SHORTOPTS;
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c ATTRIBUTE_UNUSED,
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -735,9 +735,9 @@ enum
option_abi_call0,
};
-const char *md_shortopts = "";
+const char md_shortopts[] = "";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{ "density", no_argument, NULL, option_density },
{ "no-density", no_argument, NULL, option_no_density },
@@ -820,8 +820,7 @@ struct option md_longopts[] =
{ NULL, no_argument, NULL, 0 }
};
-size_t md_longopts_size = sizeof md_longopts;
-
+const size_t md_longopts_size = sizeof md_longopts;
int
md_parse_option (int c, const char *arg)
--- a/gas/config/tc-z80.c
+++ b/gas/config/tc-z80.c
@@ -34,7 +34,7 @@ const char EXP_CHARS[] = "eE\0";
const char FLT_CHARS[] = "RrDdFfSsHh\0";
/* For machine specific options. */
-const char * md_shortopts = ""; /* None yet. */
+const char md_shortopts[] = ""; /* None yet. */
enum options
{
@@ -80,7 +80,7 @@ enum options
#define INS_UNDOC (INS_IDX_HALF | INS_IN_F_C)
#define INS_UNPORT (INS_OUT_C_0 | INS_SLI | INS_ROT_II_LD)
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
{ "march", required_argument, NULL, OPTION_MARCH},
{ "z80", no_argument, NULL, OPTION_MACH_Z80},
@@ -115,7 +115,7 @@ struct option md_longopts[] =
{ NULL, no_argument, NULL, 0 }
} ;
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
extern int coff_flags;
/* Instruction classes that silently assembled. */
--- a/gas/config/tc-z8k.c
+++ b/gas/config/tc-z8k.c
@@ -1309,16 +1309,16 @@ md_atof (int type, char *litP, int *size
return ieee_md_atof (type, litP, sizeP, true);
}
-const char *md_shortopts = "z:";
+const char md_shortopts[] = "z:";
-struct option md_longopts[] =
+const struct option md_longopts[] =
{
#define OPTION_RELAX (OPTION_MD_BASE)
{"linkrelax", no_argument, NULL, OPTION_RELAX},
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof (md_longopts);
+const size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (int c, const char *arg)
--- a/gas/doc/internals.texi
+++ b/gas/doc/internals.texi
@@ -814,7 +814,7 @@ zero if the target is little endian.
@cindex md_show_usage
@cindex md_after_parse_args
GAS uses these variables and functions during option processing.
-@code{md_shortopts} is a @code{const char *} which GAS adds to the machine
+@code{md_shortopts} is a @code{const char []} which GAS adds to the machine
independent string passed to @code{getopt}. @code{md_longopts} is a
@code{struct option []} which GAS adds to the machine independent long options
passed to @code{getopt}; you may use @code{OPTION_MD_BASE}, defined in
--- a/gas/tc.h
+++ b/gas/tc.h
@@ -22,6 +22,10 @@
/* In theory (mine, at least!) the machine dependent part of the assembler
should only have to include one file. This one. -- JF */
+extern const char md_shortopts[];
+extern const struct option md_longopts[];
+extern const size_t md_longopts_size;
+
extern const pseudo_typeS md_pseudo_table[];
const char * md_atof (int, char *, int *);
- Previous message (by thread): [PATCH] x86: Refine instruction check in x86_check_tls_relocation
- Next message (by thread): [PATCH] ia64/ELF: fix HPUX testsuite fallout
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list