From 641cf0e2c049efac533cbc517a18c04a150b2595 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Tue, 29 Oct 2024 08:08:02 +0100 Subject: [PATCH] gas: constify md_{short,long}opts and md_longopts_size 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. --- gas/as.c | 3 --- gas/config/tc-aarch64.c | 6 +++--- gas/config/tc-alpha.c | 8 ++++---- gas/config/tc-arc.c | 6 +++--- gas/config/tc-arm.c | 6 +++--- gas/config/tc-avr.c | 6 +++--- gas/config/tc-bfin.c | 6 +++--- gas/config/tc-bpf.c | 6 +++--- gas/config/tc-cr16.c | 6 +++--- gas/config/tc-cris.c | 6 +++--- gas/config/tc-cris.h | 4 ---- gas/config/tc-crx.c | 6 +++--- gas/config/tc-csky.c | 6 +++--- gas/config/tc-d10v.c | 6 +++--- gas/config/tc-d30v.c | 6 +++--- gas/config/tc-dlx.c | 6 +++--- gas/config/tc-epiphany.c | 6 +++--- gas/config/tc-fr30.c | 6 +++--- gas/config/tc-frv.c | 6 +++--- gas/config/tc-ft32.c | 6 +++--- gas/config/tc-h8300.c | 6 +++--- gas/config/tc-hppa.c | 12 ++++++------ gas/config/tc-i386.c | 8 ++++---- gas/config/tc-ia64.c | 6 +++--- gas/config/tc-ip2k.c | 6 +++--- gas/config/tc-iq2000.c | 6 +++--- gas/config/tc-kvx.c | 6 +++--- gas/config/tc-lm32.c | 6 +++--- gas/config/tc-loongarch.c | 6 +++--- gas/config/tc-m32c.c | 6 +++--- gas/config/tc-m32r.c | 6 +++--- gas/config/tc-m68hc11.c | 6 +++--- gas/config/tc-m68k.c | 6 +++--- gas/config/tc-mcore.c | 6 +++--- gas/config/tc-mep.c | 6 +++--- gas/config/tc-metag.c | 6 +++--- gas/config/tc-microblaze.c | 6 +++--- gas/config/tc-mips.c | 6 +++--- gas/config/tc-mmix.c | 6 +++--- gas/config/tc-mn10200.c | 6 +++--- gas/config/tc-mn10300.c | 6 +++--- gas/config/tc-moxie.c | 6 +++--- gas/config/tc-msp430.c | 6 +++--- gas/config/tc-mt.c | 6 +++--- gas/config/tc-nds32.c | 6 +++--- gas/config/tc-nios2.c | 6 +++--- gas/config/tc-ns32k.c | 6 +++--- gas/config/tc-or1k.c | 6 +++--- gas/config/tc-pdp11.c | 6 +++--- gas/config/tc-pj.c | 6 +++--- gas/config/tc-ppc.c | 4 ++-- gas/config/tc-pru.c | 6 +++--- gas/config/tc-riscv.c | 6 +++--- gas/config/tc-rl78.c | 6 +++--- gas/config/tc-rx.c | 6 +++--- gas/config/tc-s12z.c | 6 +++--- gas/config/tc-s390.c | 6 +++--- gas/config/tc-score.c | 6 +++--- gas/config/tc-sh.c | 6 +++--- gas/config/tc-sparc.c | 6 +++--- gas/config/tc-spu.c | 6 +++--- gas/config/tc-tic30.c | 6 +++--- gas/config/tc-tic4x.c | 7 +++---- gas/config/tc-tic54x.c | 6 +++--- gas/config/tc-tic6x.c | 6 +++--- gas/config/tc-tilegx.c | 6 +++--- gas/config/tc-tilepro.c | 6 +++--- gas/config/tc-v850.c | 6 +++--- gas/config/tc-vax.c | 8 ++++---- gas/config/tc-visium.c | 6 +++--- gas/config/tc-wasm32.c | 6 +++--- gas/config/tc-xgate.c | 6 +++--- gas/config/tc-xstormy16.c | 6 +++--- gas/config/tc-xtensa.c | 7 +++---- gas/config/tc-z80.c | 6 +++--- gas/config/tc-z8k.c | 6 +++--- gas/doc/internals.texi | 2 +- gas/tc.h | 4 ++++ 78 files changed, 232 insertions(+), 237 deletions(-) diff --git a/gas/as.c b/gas/as.c index 030da2e0501..f20b1e0cbe5 100644 --- 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 { diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index e94a0cff406..4970acee19b 100644 --- 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 { diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c index 0922f19f60f..05b8ee2f764 100644 --- 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 diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c index 5fd265acaa3..6a85ca39e26 100644 --- 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. */ diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 540ab487384..a1bf33a90a9 100644 --- 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 { diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c index b9fa9ed8681..9d80965da03 100644 --- 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. */ diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c index 001f90c045c..74937036db6 100644 --- 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 diff --git a/gas/config/tc-bpf.c b/gas/config/tc-bpf.c index effb4838601..d0c18df636b 100644 --- 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 diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c index e91e41ef41b..aa4a3441285 100644 --- 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) diff --git a/gas/config/tc-cris.c b/gas/config/tc-cris.c index 86ec1f701ec..31184f381f6 100644 --- 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 diff --git a/gas/config/tc-cris.h b/gas/config/tc-cris.h index 4dab3adba36..8e39c12b00e 100644 --- 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 diff --git a/gas/config/tc-crx.c b/gas/config/tc-crx.c index 3a47354c473..fb128aae7b2 100644 --- 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: diff --git a/gas/config/tc-csky.c b/gas/config/tc-csky.c index 0dc8bfd45dc..74762f0ea44 100644 --- 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; diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c index 6217654df74..2be6beb0cc8 100644 --- 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; diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c index 0eab055e386..70ea71cdf6e 100644 --- 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; diff --git a/gas/config/tc-dlx.c b/gas/config/tc-dlx.c index 6a7c520f986..cb5acf5fd3a 100644 --- a/gas/config/tc-dlx.c +++ b/gas/config/tc-dlx.c @@ -1047,14 +1047,14 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) 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, diff --git a/gas/config/tc-epiphany.c b/gas/config/tc-epiphany.c index fd6728cc617..8cd3646298d 100644 --- 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) diff --git a/gas/config/tc-fr30.c b/gas/config/tc-fr30.c index 1457f6be554..b4dd307e6df 100644 --- 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, diff --git a/gas/config/tc-frv.c b/gas/config/tc-frv.c index 40bab49ff6a..d7c8c66e1c2 100644 --- 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_SHORTOPTS; #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; diff --git a/gas/config/tc-ft32.c b/gas/config/tc-ft32.c index 7ecfcea991e..74a6bfe9d75 100644 --- a/gas/config/tc-ft32.c +++ b/gas/config/tc-ft32.c @@ -487,16 +487,16 @@ md_atof (int type, char *litP, int *sizeP) 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. */ diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c index aafceb0a6ad..08648acef4d 100644 --- a/gas/config/tc-h8300.c +++ b/gas/config/tc-h8300.c @@ -2076,15 +2076,15 @@ md_atof (int type, char *litP, int *sizeP) #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 { diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c index f209407cfd2..bf8a247c717 100644 --- a/gas/config/tc-hppa.c +++ b/gas/config/tc-hppa.c @@ -1631,26 +1631,26 @@ md_estimate_size_before_relax (fragS *fragP, asection *segment ATTRIBUTE_UNUSED) #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) diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index a695a1599a2..9f68a2fb412 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -16756,9 +16756,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) @@ -16798,7 +16798,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)) \ @@ -16848,7 +16848,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) diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index 666c0ae369b..d8488bdf4e7 100644 --- 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 { diff --git a/gas/config/tc-ip2k.c b/gas/config/tc-ip2k.c index 04a75808e91..babdf3470e2 100644 --- 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) diff --git a/gas/config/tc-iq2000.c b/gas/config/tc-iq2000.c index 1c2f4f5d54a..2198ffda2b9 100644 --- a/gas/config/tc-iq2000.c +++ b/gas/config/tc-iq2000.c @@ -108,12 +108,12 @@ static struct iq2000_hi_fixup * iq2000_hi_fixup_list; /* 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, diff --git a/gas/config/tc-kvx.c b/gas/config/tc-kvx.c index e0860c0294a..2cdb8435149 100644 --- 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"; /* catted to std short options */ #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) diff --git a/gas/config/tc-lm32.c b/gas/config/tc-lm32.c index 3d6fefe51c1..17ab16d6859 100644 --- 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. */ diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c index ab98a83e6f8..d5236aac525 100644 --- 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) diff --git a/gas/config/tc-m32c.c b/gas/config/tc-m32c.c index c29f754d4b2..3459b2494bb 100644 --- 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_SHORTOPTS; #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 */ diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c index 2deb07817ab..3b0c50b34da 100644 --- 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) diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c index c7e54e4f6e9..71012b8e083 100644 --- 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, diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index d04aa1edecd..92959769c8f 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -7341,9 +7341,9 @@ m68k_set_extension (char const *name, int allow_m, int silent) 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) diff --git a/gas/config/tc-mcore.c b/gas/config/tc-mcore.c index 41237dec45a..608db1a59ed 100644 --- a/gas/config/tc-mcore.c +++ b/gas/config/tc-mcore.c @@ -1629,7 +1629,7 @@ md_atof (int type, char * litP, int * sizeP) 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) diff --git a/gas/config/tc-mep.c b/gas/config/tc-mep.c index 2d01730668f..7119f5a0e66 100644 --- a/gas/config/tc-mep.c +++ b/gas/config/tc-mep.c @@ -139,7 +139,7 @@ static struct mep_hi_fixup * mep_hi_fixup_list; #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_longopts); | (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; diff --git a/gas/config/tc-metag.c b/gas/config/tc-metag.c index 66afa15709b..314f3feae14 100644 --- a/gas/config/tc-metag.c +++ b/gas/config/tc-metag.c @@ -81,13 +81,13 @@ static unsigned int mcpu_opt = CoreMeta12; 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; diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c index c971d187095..43e69d615b5 100644 --- a/gas/config/tc-microblaze.c +++ b/gas/config/tc-microblaze.c @@ -1901,9 +1901,9 @@ md_atof (int type, char * litP, int * sizeP) 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; diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index f4125c1b118..b7ab1627e3c 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -1450,7 +1450,7 @@ static const struct mips_cpu_info *mips_cpu_info_from_isa (int); 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 diff --git a/gas/config/tc-mmix.c b/gas/config/tc-mmix.c index 4d0f94eda48..f2a16e6f640 100644 --- 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; diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c index 66db9e3d81c..b191e2654d5 100644 --- 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[] = diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c index be79b19b66b..099d2058026 100644 --- 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) diff --git a/gas/config/tc-moxie.c b/gas/config/tc-moxie.c index 266afff5b23..d1923f09964 100644 --- 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) diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c index 19ea7fab9d6..32c57eea621 100644 --- 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) diff --git a/gas/config/tc-mt.c b/gas/config/tc-mt.c index 42028bda150..09cf397addd 100644 --- 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; diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c index 99254a1581d..b41182420a3 100644 --- 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 { diff --git a/gas/config/tc-nios2.c b/gas/config/tc-nios2.c index 3d48b1e5938..bd96629fe91 100644 --- 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. */ diff --git a/gas/config/tc-ns32k.c b/gas/config/tc-ns32k.c index bdd34749ca5..6e2ebd9c55a 100644 --- 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) diff --git a/gas/config/tc-or1k.c b/gas/config/tc-or1k.c index 14b09c9c3e6..c91ac11c04a 100644 --- 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 */ diff --git a/gas/config/tc-pdp11.c b/gas/config/tc-pdp11.c index 3054ad1b2ae..a0e06a3b501 100644 --- 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. */ diff --git a/gas/config/tc-pj.c b/gas/config/tc-pj.c index 38116373971..bc49776af90 100644 --- a/gas/config/tc-pj.c +++ b/gas/config/tc-pj.c @@ -319,9 +319,9 @@ md_atof (int type, char *litP, int *sizeP) 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) diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 41007999731..07e0f936d0b 100644 --- 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[] = { diff --git a/gas/config/tc-pru.c b/gas/config/tc-pru.c index fb158fb06e6..cfed102da21 100644 --- 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 { diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index 4e804ffa4c8..e19142dca19 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -4305,7 +4305,7 @@ md_number_to_chars (char *buf, valueT val, int n) number_to_chars_littleendian (buf, val, n); } -const char *md_shortopts = "O::g::G:"; +const char md_shortopts[] = "O::g::G:"; enum options { @@ -4326,7 +4326,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}, @@ -4346,7 +4346,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) diff --git a/gas/config/tc-rl78.c b/gas/config/tc-rl78.c index 3be82f36035..4b6564eec80 100644 --- 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) diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c index 157f8958e19..a881f2a112b 100644 --- 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 { diff --git a/gas/config/tc-s12z.c b/gas/config/tc-s12z.c index 0f8044de6a8..c0920f18ca4 100644 --- a/gas/config/tc-s12z.c +++ b/gas/config/tc-s12z.c @@ -84,9 +84,9 @@ s12z_strtol (const char *str, char ** endptr) /* 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[] = diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index 055b6948c84..d8f31daeef2 100644 --- 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. */ diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c index 707bd6f1891..2c24f42a659 100644 --- 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 diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index 78c3fca955a..1509a56c8b9 100644 --- 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) diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index bd489d5d26b..5dedd4299e4 100644 --- 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) diff --git a/gas/config/tc-spu.c b/gas/config/tc-spu.c index ea9d859091b..8793b5778fd 100644 --- 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 diff --git a/gas/config/tc-tic30.c b/gas/config/tc-tic30.c index 8377f28a505..a76c12664c6 100644 --- 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 diff --git a/gas/config/tc-tic4x.c b/gas/config/tc-tic4x.c index 6c86b21a887..3b4e4112814 100644 --- a/gas/config/tc-tic4x.c +++ b/gas/config/tc-tic4x.c @@ -77,8 +77,8 @@ static unsigned long tic4x_oplevel = 0; /* Opcode level */ #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 { diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c index 5a0722085d8..b60b1a7777b 100644 --- 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 diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c index 302043a2676..8a2d4e3bb96 100644 --- 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). */ diff --git a/gas/config/tc-tilegx.c b/gas/config/tc-tilegx.c index 4e81af71e45..1c249e0e832 100644 --- 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) diff --git a/gas/config/tc-tilepro.c b/gas/config/tc-tilepro.c index dced4e28dd9..a0ea5055e24 100644 --- 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) diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index cb518a7da05..e66a74e8a27 100644 --- 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; diff --git a/gas/config/tc-vax.c b/gas/config/tc-vax.c index cab1264e876..9125611ae52 100644 --- 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) diff --git a/gas/config/tc-visium.c b/gas/config/tc-visium.c index fcb128a1abb..62880210f5b 100644 --- a/gas/config/tc-visium.c +++ b/gas/config/tc-visium.c @@ -218,14 +218,14 @@ md_undefined_symbol (char *name ATTRIBUTE_UNUSED) } /* 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 { diff --git a/gas/config/tc-wasm32.c b/gas/config/tc-wasm32.c index 71f58bc1047..b0af6f86ab6 100644 --- 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. */ diff --git a/gas/config/tc-xgate.c b/gas/config/tc-xgate.c index d55e7a91395..6a345c5a0a5 100644 --- 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) diff --git a/gas/config/tc-xstormy16.c b/gas/config/tc-xstormy16.c index eb070791db9..a0336947e43 100644 --- 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, diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index deecbb143d0..8206b1a2591 100644 --- 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) diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c index eaabb261168..86f8e6be673 100644 --- 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. */ diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c index b23f152aa73..b96b5cf5160 100644 --- a/gas/config/tc-z8k.c +++ b/gas/config/tc-z8k.c @@ -1309,16 +1309,16 @@ md_atof (int type, char *litP, int *sizeP) 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) diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi index e59d67655d7..18fca0ebdef 100644 --- 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 diff --git a/gas/tc.h b/gas/tc.h index ec47d45b739..4e387d12f44 100644 --- 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 *);