From 3b4dbbbf59aef4308bae6654bdc7968797504a3c Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Mon, 22 Feb 2016 14:11:27 +0000 Subject: Add more const type qualifiers to GAS sources. * output-file.c (output_file_create): Make file name argument const. (output_file_close): Likewise. * output-file.h (output_file_create): Adjust. (output_file_close): Likewise. * depend.c (quote_string_for_make): Make src argument const char *. (register_dependency): Likewise. (wrap_output): Likewise. * as.h (register_dependency): Adjust. * config/tc-xtensa.c (finish_vinsn): Remove unnecessary calls to as_where (); * symbols.c (S_SET_EXTERNAL): Likewise. * input-scrub.c (as_where): Return the file name. * as.h (as_where): Adjust prototype. * app.c (do_scrub_chars): Adjust. * cond.c (s_elseif): Likewise. (s_else): Likewise. (initialize_cframe): Likewise. * config/obj-coff.c (obj_coff_init_stab_section): Likewise. * config/obj-elf.c (obj_elf_init_stab_section): Likewise. * config/obj-som.c (obj_som_init_stab_section): Likewise. * config/tc-aarch64.c (output_info): Likewise. * config/tc-ia64.c (md_assemble): Likewise. (dot_alias): Likewise. * config/tc-m68k.c (m68k_frob_label): Likewise. * config/tc-mmix.c (s_bspec): Likewise. (mmix_handle_mmixal): Likewise. * config/tc-rx.c (rx_include): Likewise. * config/tc-tic54x.c (tic54x_set_default_include): Likewise. (tic54x_adjust_symtab): Likewise. * config/tc-xtensa.c (directive_push): Likewise. (xtensa_sanity_check): Likewise. (xtensa_relax_frag): Likewise. (md_convert_frag): Likewise. (tinsn_to_slotbuf): Likewise. * dwarf2dbg.c (dwarf2_where): Likewise. * ecoff.c (add_file): Likewise. (ecoff_generate_asm_lineno): Likewise. * expr.c (make_expr_symbol): Likewise. * frags.c (frag_new): Likewise. (frag_var_init): Likewise. * listing.c (listing_newline): Likewise. * messages.c (identify): Likewise. (as_show_where): Likewise. (as_warn_internal): Likewise. (as_bad_internal): Likewise. * read.c (s_irp): Likewise. (s_macro): Likewise. (s_reloc): Likewise. * stabs.c (stabs_generate_asm_file): Likewise. (stabs_generate_asm_lineno): Likewise. (stabs_generate_asm_func): Likewise. * write.c (fix_new_internal): Likewise. * as.h (PRINTF_WHERE_LIKE): Make file name argument const. (as_warn_value_out_of_range): Adjust prototype. (as_bad_value_out_of_range): Adjust prototype. * messages.c (identify): Make file name argument const char *. (as_warn_internal): Likewise. (as_warn_where): Likewise. (as_bad_internal): Likewise. (as_bad_where): Likewise. (as_internal_value_out_of_range): Likewise. (as_warn_value_out_of_range): Likewise. (as_bad_value_out_of_range): Likewise. * as.h (found_comment_file): Change type to const char *. * cond.c (file_line::file): Likewise. * config/obj-coff.c (obj_coff_init_stab_section): Make variable const. * config/obj-elf.c (obj_elf_init_stab_section): Likewise. * config/obj-som.c (obj_som_init_stab_section): Likewise. * config/tc-aarch64.c (output_info): Likewise. * config/tc-alpha.c (insert_operand): Likewise. * config/tc-arc.c (insert_operand): Likewise. * config/tc-d30v.c (check_size): Likewise. * config/tc-ia64.c (struct alias): Likewise. * config/tc-m68k.c (struct label_line): Likewise. * config/tc-mcore.c (md_apply_fix): Likewise. * config/tc-microblaze.c (md_estimate_size_before_relax): Likewise. * config/tc-mips.c (mips16_immed): Likewise. * config/tc-mmix.c (mmix_handle_mmixal): Likewise. * config/tc-ppc.c (ppc_insert_operand): Likewise. * config/tc-rx.c (rx_include): Likewise. * config/tc-s390.c (s390_insert_operand): Likewise. * config/tc-tic54x.c (tic54x_set_default_include): Likewise. (tic54x_adjust_symtab): Likewise. * config/tc-tilegx.c (insert_operand): Likewise. (apply_special_operator): Likewise. * config/tc-tilepro.c (insert_operand): Likewise. * config/tc-xtensa.c (directive_push): Likewise. * ecoff.c (add_file): Likewise. (ecoff_generate_asm_lineno): Likewise. * listing.c (listing_newline): Likewise. * read.c (s_irp): Likewise. * write.c (install_reloc): Likewise. * write.h (struct fix): Likewise. * input-file.c (file_name): Change type to const char *. (saved_file::file_name): Likewise. (input_file_open): Change type of argument to const char *. * input-file.h (input_file_open): Adjust. * input-scrub.c (logical_input_file): change type to const char *. (physical_input_file): Likewise. (struct input_save): Adjust. (input_scrub_push): Adjust. (input_scrub_begin): Adjust. (as_where): Adjust. * input-scrub.c (input_scrub_new_file): Make file name argument const. (input_scrub_include_file): Likewise. (new_logical_line_flags): Likewise. (new_logical_line): Likewise. * as.h: Adjust. * frags.h (struct frag): Change type of fr_file to const char *. * expr.c (expr_symbol_where): Change type of file argument to const char **. * expr.h (expr_symbol_where): Likewise. * config/tc-i370.c (md_apply_fix): adjust. * config/tc-mmix.c (mmix_md_end): Likewise. * config/tc-ppc.c (md_apply_fix): Likewise. * config/tc-s390.c (md_apply_fix): Likewise. * symbols.c (report_op_error): Likewise. (resolve_symbol_value): Likewise. * config/tc-ia64.c (slot::src_file): Change type to const char *. (rsrc::file): Likewise. * config/tc-xtensa.c (xtensa_sanity_check): Change type of variable to const char *. (xtensa_relax_frag): Likewise. (md_convert_frag): Likewise. (tinsn_to_slotbuf): Likewise. * expr.c (expr_symbol_line): Likewise. * macro.c (define_macro): Likewise. * macro.h (macro_struct): Likewise. * messages.c (as_show_where): Likewise. * read.c (s_macro): Likewise. * stabs.c (stabs_generate_asm_file): Likewise. (generate_asm_file): Likewise. (stabs_generate_asm_lineno): Likewise. * write.h (struct reloc_list): Likewise. * input-scrub.c (as_where): Change return type to const char *. * as.h (as_wheree): Adjust. --- gas/config/obj-coff.c | 4 ++-- gas/config/obj-elf.c | 4 ++-- gas/config/obj-som.c | 5 +++-- gas/config/tc-aarch64.c | 4 ++-- gas/config/tc-alpha.c | 2 +- gas/config/tc-arc.c | 2 +- gas/config/tc-d30v.c | 2 +- gas/config/tc-i370.c | 2 +- gas/config/tc-ia64.c | 10 +++++----- gas/config/tc-m68k.c | 4 ++-- gas/config/tc-mcore.c | 2 +- gas/config/tc-microblaze.c | 6 +++--- gas/config/tc-mips.c | 4 ++-- gas/config/tc-mmix.c | 12 +++++------- gas/config/tc-ppc.c | 6 +++--- gas/config/tc-rx.c | 10 +++++----- gas/config/tc-s390.c | 4 ++-- gas/config/tc-tic54x.c | 7 +++---- gas/config/tc-tilegx.c | 5 +++-- gas/config/tc-tilepro.c | 2 +- gas/config/tc-xtensa.c | 32 +++++++++++++------------------- 21 files changed, 61 insertions(+), 68 deletions(-) (limited to 'gas/config') diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index c100c95..03be655 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -1810,7 +1810,7 @@ coff_frob_section (segT sec) void obj_coff_init_stab_section (segT seg) { - char *file; + const char *file; char *p; char *stabstr_name; unsigned int stroff; @@ -1819,7 +1819,7 @@ obj_coff_init_stab_section (segT seg) p = frag_more (12); /* Zero it out. */ memset (p, 0, 12); - as_where (&file, (unsigned int *) NULL); + file = as_where ((unsigned int *) NULL); stabstr_name = xmalloc (strlen (seg->name) + 4); strcpy (stabstr_name, seg->name); strcat (stabstr_name, "str"); diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 9af349c..e8af394 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -2045,7 +2045,7 @@ obj_elf_ident (int ignore ATTRIBUTE_UNUSED) void obj_elf_init_stab_section (segT seg) { - char *file; + const char *file; char *p; char *stabstr_name; unsigned int stroff; @@ -2058,7 +2058,7 @@ obj_elf_init_stab_section (segT seg) p = frag_more (12); /* Zero it out. */ memset (p, 0, 12); - as_where (&file, NULL); + file = as_where (NULL); stabstr_name = (char *) xmalloc (strlen (segment_name (seg)) + 4); strcpy (stabstr_name, segment_name (seg)); strcat (stabstr_name, "str"); diff --git a/gas/config/obj-som.c b/gas/config/obj-som.c index 953c3a7..c0b2b41 100644 --- a/gas/config/obj-som.c +++ b/gas/config/obj-som.c @@ -210,7 +210,8 @@ obj_som_init_stab_section (segT seg) segT saved_seg = now_seg; segT space; subsegT saved_subseg = now_subseg; - char *p, *file; + char *p; + const char * file; unsigned int stroff; /* Make the space which will contain the debug subspaces. */ @@ -241,7 +242,7 @@ obj_som_init_stab_section (segT seg) the call to get_stab_string_offset. */ p = frag_more (12); memset (p, 0, 12); - as_where (&file, (unsigned int *) NULL); + file = as_where ((unsigned int *) NULL); stroff = get_stab_string_offset (file, "$GDB_STRINGS$"); know (stroff == 1); md_number_to_chars (p, stroff, 4); diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index dfcbd52..b455dc8 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -4259,11 +4259,11 @@ print_operands (char *buf, const aarch64_opcode *opcode, static void output_info (const char *format, ...) { - char *file; + const char *file; unsigned int line; va_list args; - as_where (&file, &line); + file = as_where (&line); if (file) { if (line != 0) diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c index 5d754c9..e849a95 100644 --- a/gas/config/tc-alpha.c +++ b/gas/config/tc-alpha.c @@ -1973,7 +1973,7 @@ static unsigned insert_operand (unsigned insn, const struct alpha_operand *operand, offsetT val, - char *file, + const char *file, unsigned line) { if (operand->bits != 32 && !(operand->flags & AXP_OPERAND_NOOVERFLOW)) diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c index bfe9ae1..82cff9a 100644 --- a/gas/config/tc-arc.c +++ b/gas/config/tc-arc.c @@ -2239,7 +2239,7 @@ static unsigned insert_operand (unsigned insn, const struct arc_operand *operand, offsetT val, - char *file, + const char *file, unsigned line) { offsetT min = 0, max = 0; diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c index 68880e0..1ac1605 100644 --- a/gas/config/tc-d30v.c +++ b/gas/config/tc-d30v.c @@ -1840,7 +1840,7 @@ d30v_start_line (void) } static void -check_size (long value, int bits, char *file, int line) +check_size (long value, int bits, const char *file, int line) { int tmp, max; diff --git a/gas/config/tc-i370.c b/gas/config/tc-i370.c index 8554c6d..4795560 100644 --- a/gas/config/tc-i370.c +++ b/gas/config/tc-i370.c @@ -2498,7 +2498,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg) any operands that need relocation. Due to the 12-bit naturew of i370 addressing, this would be unusual. */ { - char *sfile; + const char *sfile; unsigned int sline; /* Use expr_symbol_where to see if this is an expression diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index f0ba4ae..8169bce 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -302,7 +302,7 @@ static struct struct label_fix *tag_fixups; struct unw_rec_list *unwind_record; /* Unwind directive. */ expressionS opnd[6]; - char *src_file; + const char *src_file; unsigned int src_line; struct dwarf2_line_info debug_line; } @@ -672,7 +672,7 @@ static struct rsrc { int insn_srlz; /* current insn serialization state */ int data_srlz; /* current data serialization state */ int qp_regno; /* qualifying predicate for this usage */ - char *file; /* what file marked this dependency */ + const char *file; /* what file marked this dependency */ unsigned int line; /* what line marked this dependency */ struct mem_offset mem_offset; /* optional memory offset hint */ enum { CMP_NONE, CMP_OR, CMP_AND } cmp_type; /* OR or AND compare? */ @@ -10856,7 +10856,7 @@ md_assemble (char *str) /* Build the instruction. */ CURR_SLOT.qp_regno = qp_regno; CURR_SLOT.idesc = idesc; - as_where (&CURR_SLOT.src_file, &CURR_SLOT.src_line); + CURR_SLOT.src_file = as_where (&CURR_SLOT.src_line); dwarf2_where (&CURR_SLOT.debug_line); dwarf2_consume_line_info (); @@ -11766,7 +11766,7 @@ ia64_check_label (symbolS *label) the relocatable file. */ struct alias { - char *file; /* The file where the directive is seen. */ + const char *file; /* The file where the directive is seen. */ unsigned int line; /* The line number the directive is at. */ const char *name; /* The original name of the symbol. */ }; @@ -11859,7 +11859,7 @@ dot_alias (int section) } h = (struct alias *) xmalloc (sizeof (struct alias)); - as_where (&h->file, &h->line); + h->file = as_where (&h->line); h->name = name; error_string = hash_jam (ahash, alias, (void *) h); diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index 6bff4fb..7ef5ff4 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -122,7 +122,7 @@ struct label_line { struct label_line *next; symbolS *label; - char *file; + const char *file; unsigned int line; int text; }; @@ -4792,7 +4792,7 @@ m68k_frob_label (symbolS *sym) n = (struct label_line *) xmalloc (sizeof *n); n->next = labels; n->label = sym; - as_where (&n->file, &n->line); + n->file = as_where (&n->line); n->text = 0; labels = n; current_label = n; diff --git a/gas/config/tc-mcore.c b/gas/config/tc-mcore.c index e4dda2d..f73f3b7 100644 --- a/gas/config/tc-mcore.c +++ b/gas/config/tc-mcore.c @@ -1917,7 +1917,7 @@ md_apply_fix (fixS * fixP, segT segment ATTRIBUTE_UNUSED) { char * buf = fixP->fx_where + fixP->fx_frag->fr_literal; - char * file = fixP->fx_file ? fixP->fx_file : _("unknown"); + const char * file = fixP->fx_file ? fixP->fx_file : _("unknown"); const char * symname; /* Note: use offsetT because it is signed, valueT is unsigned. */ offsetT val = *valP; diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c index 5484b30..16c70ad 100644 --- a/gas/config/tc-microblaze.c +++ b/gas/config/tc-microblaze.c @@ -1960,7 +1960,7 @@ md_apply_fix (fixS * fixP, segT segment) { char * buf = fixP->fx_where + fixP->fx_frag->fr_literal; - char * file = fixP->fx_file ? fixP->fx_file : _("unknown"); + const char * file = fixP->fx_file ? fixP->fx_file : _("unknown"); const char * symname; /* Note: use offsetT because it is signed, valueT is unsigned. */ offsetT val = (offsetT) * valp; @@ -2257,7 +2257,7 @@ md_estimate_size_before_relax (fragS * fragP, { /* Variable not in small data read only segment accessed using small data read only anchor. */ - char *file = fragP->fr_file ? fragP->fr_file : _("unknown"); + const char *file = fragP->fr_file ? fragP->fr_file : _("unknown"); as_bad_where (file, fragP->fr_line, _("Variable is accessed using small data read " @@ -2280,7 +2280,7 @@ md_estimate_size_before_relax (fragS * fragP, } else { - char *file = fragP->fr_file ? fragP->fr_file : _("unknown"); + const char *file = fragP->fr_file ? fragP->fr_file : _("unknown"); as_bad_where (file, fragP->fr_line, _("Variable is accessed using small data read " diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 7b34a4b..862454d 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -1307,7 +1307,7 @@ static void mips16_macro (struct mips_cl_insn * ip); static void mips_ip (char *str, struct mips_cl_insn * ip); static void mips16_ip (char *str, struct mips_cl_insn * ip); static void mips16_immed - (char *, unsigned int, int, bfd_reloc_code_real_type, offsetT, + (const char *, unsigned int, int, bfd_reloc_code_real_type, offsetT, unsigned int, unsigned long *); static size_t my_getSmallExpression (expressionS *, bfd_reloc_code_real_type *, char *); @@ -13784,7 +13784,7 @@ mips16_immed_in_range_p (const struct mips_int_operand *operand, is the length that the user requested, or 0 if none. */ static void -mips16_immed (char *file, unsigned int line, int type, +mips16_immed (const char *file, unsigned int line, int type, bfd_reloc_code_real_type reloc, offsetT val, unsigned int user_insn_length, unsigned long *insn) { diff --git a/gas/config/tc-mmix.c b/gas/config/tc-mmix.c index 34c22ef..b7bfe14 100644 --- a/gas/config/tc-mmix.c +++ b/gas/config/tc-mmix.c @@ -186,7 +186,7 @@ int mmix_next_semicolon_is_eoln = 1; /* Do we have a BSPEC in progress? */ static int doing_bspec = 0; -static char *bspec_file; +static const char *bspec_file; static unsigned int bspec_line; struct option md_longopts[] = @@ -2141,7 +2141,7 @@ s_bspec (int unused ATTRIBUTE_UNUSED) subseg_set (sec, 0); /* Save position for missing ESPEC. */ - as_where (&bspec_file, &bspec_line); + bspec_file = as_where (&bspec_line); doing_bspec = 1; } @@ -2939,18 +2939,16 @@ mmix_handle_mmixal (void) caller is about to bump the counters. Adjust the error messages. */ if (is_end_of_line[(unsigned int) *s]) { - char *name; unsigned int line; - as_where (&name, &line); + const char * name = as_where (&line); as_bad_where (name, line + 1, _("[0-9]H labels may not appear alone on a line")); current_fb_label = -1; } if (*s == '.') { - char *name; unsigned int line; - as_where (&name, &line); + const char * name = as_where (&line); as_bad_where (name, line + 1, _("[0-9]H labels do not mix with dot-pseudos")); current_fb_label = -1; @@ -3555,7 +3553,7 @@ mmix_md_end (void) actual_seg = S_GET_SEGMENT (loc_assert->loc_sym); if (actual_seg != loc_assert->old_seg) { - char *fnam; + const char *fnam; unsigned int line; int e_valid = expr_symbol_where (loc_assert->loc_sym, &fnam, &line); diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 57029f7..71b2dac 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -1774,7 +1774,7 @@ ppc_insert_operand (unsigned long insn, const struct powerpc_operand *operand, offsetT val, ppc_cpu_t cpu, - char *file, + const char *file, unsigned int line) { long min, max, right; @@ -6841,7 +6841,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) gas_assert (fixP->fx_addsy != NULL); if (fixP->fx_r_type == BFD_RELOC_NONE) { - char *sfile; + const char *sfile; unsigned int sline; /* Use expr_symbol_where to see if this is an expression @@ -7069,7 +7069,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) default: if (fixP->fx_addsy) { - char *sfile; + const char *sfile; unsigned int sline; /* Use expr_symbol_where to see if this is an diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c index 24f47cc..91d4828 100644 --- a/gas/config/tc-rx.c +++ b/gas/config/tc-rx.c @@ -266,10 +266,10 @@ rx_include (int ignore) FILE * try; char * path; char * filename; - char * current_filename; + const char * current_filename; char * last_char; - char * p; - char * d; + const char * p; + const char * d; char * f; char end_char; size_t len; @@ -300,7 +300,7 @@ rx_include (int ignore) return; } - as_where (& current_filename, NULL); + current_filename = as_where (NULL); f = (char *) xmalloc (strlen (current_filename) + strlen (filename) + 1); /* Check the filename. If [@]..FILE[@] is found then replace @@ -308,7 +308,7 @@ rx_include (int ignore) of any directory prefixes or extensions. */ if ((p = rx_strcasestr (filename, "..file")) != NULL) { - char * c; + const char * c; len = 6; /* strlen ("..file"); */ diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index 66b54ea..fda96a2 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -582,7 +582,7 @@ static void s390_insert_operand (unsigned char *insn, const struct s390_operand *operand, offsetT val, - char *file, + const char *file, unsigned int line) { addressT uval; @@ -2316,7 +2316,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) } else { - char *sfile; + const char *sfile; unsigned int sline; /* Use expr_symbol_where to see if this is an expression diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c index 1ff204b..3ed7933 100644 --- a/gas/config/tc-tic54x.c +++ b/gas/config/tc-tic54x.c @@ -1876,10 +1876,10 @@ tic54x_set_default_include (int dot) if (!dot) { - char *curfile; + const char *curfile; unsigned lineno; - as_where (&curfile, &lineno); + curfile = as_where (&lineno); dir = strcpy (xmalloc (strlen (curfile) + 1), curfile); tmp = strrchr (dir, '/'); } @@ -5002,9 +5002,8 @@ tic54x_adjust_symtab (void) if (symbol_rootP == NULL || S_GET_STORAGE_CLASS (symbol_rootP) != C_FILE) { - char *filename; unsigned lineno; - as_where (&filename, &lineno); + const char * filename = as_where (&lineno); c_dot_file_symbol (filename, 0); } } diff --git a/gas/config/tc-tilegx.c b/gas/config/tc-tilegx.c index 0b4ece6..7897aca 100644 --- a/gas/config/tc-tilegx.c +++ b/gas/config/tc-tilegx.c @@ -396,7 +396,7 @@ static tilegx_bundle_bits insert_operand (tilegx_bundle_bits bits, const struct tilegx_operand *operand, int operand_value, - char *file, + const char *file, unsigned lineno) { /* Range-check the immediate. */ @@ -434,7 +434,8 @@ insert_operand (tilegx_bundle_bits bits, static int -apply_special_operator (operatorT op, offsetT num, char *file, unsigned lineno) +apply_special_operator (operatorT op, offsetT num, const char *file, + unsigned lineno) { int ret; int check_shift = -1; diff --git a/gas/config/tc-tilepro.c b/gas/config/tc-tilepro.c index 00eeaa6..90ce09a 100644 --- a/gas/config/tc-tilepro.c +++ b/gas/config/tc-tilepro.c @@ -352,7 +352,7 @@ static tilepro_bundle_bits insert_operand (tilepro_bundle_bits bits, const struct tilepro_operand *operand, int operand_value, - char *file, + const char *file, unsigned lineno) { /* Range-check the immediate. */ diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index 5773634..d995131 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -1163,11 +1163,11 @@ do_align_targets (void) static void directive_push (directiveE directive, bfd_boolean negated, const void *datum) { - char *file; + const char *file; unsigned int line; state_stackS *stack = (state_stackS *) xmalloc (sizeof (state_stackS)); - as_where (&file, &line); + file = as_where (&line); stack->directive = directive; stack->negated = negated; @@ -6327,8 +6327,6 @@ finish_vinsn (vliw_insn *vinsn) { IStack slotstack; int i; - char *file_name; - unsigned line; if (find_vinsn_conflicts (vinsn)) { @@ -6350,9 +6348,7 @@ finish_vinsn (vliw_insn *vinsn) if (vinsn->format == XTENSA_UNDEFINED) { - as_where (&file_name, &line); - as_bad_where (file_name, line, - _("couldn't find a valid instruction format")); + as_bad (_("couldn't find a valid instruction format")); fprintf (stderr, _(" ops were: ")); for (i = 0; i < vinsn->num_slots; i++) fprintf (stderr, _(" %s;"), @@ -6376,8 +6372,7 @@ finish_vinsn (vliw_insn *vinsn) if (resources_conflict (vinsn)) { - as_where (&file_name, &line); - as_bad_where (file_name, line, _("illegal resource usage in bundle")); + as_bad (_("illegal resource usage in bundle")); fprintf (stderr, " ops were: "); for (i = 0; i < vinsn->num_slots; i++) fprintf (stderr, " %s;", @@ -6474,8 +6469,7 @@ finish_vinsn (vliw_insn *vinsn) /* Now check resource conflicts on the modified bundle. */ if (resources_conflict (vinsn)) { - as_where (&file_name, &line); - as_bad_where (file_name, line, _("illegal resource usage in bundle")); + as_bad (_("illegal resource usage in bundle")); fprintf (stderr, " ops were: "); for (i = 0; i < vinsn->num_slots; i++) fprintf (stderr, " %s;", @@ -8491,12 +8485,12 @@ static bfd_boolean is_local_forward_loop (const TInsn *, fragS *); static void xtensa_sanity_check (void) { - char *file_name; + const char *file_name; unsigned line; frchainS *frchP; asection *s; - as_where (&file_name, &line); + file_name = as_where (&line); for (s = stdoutput->sections; s; s = s->next) for (frchP = seg_info (s)->frchainP; frchP; frchP = frchP->frch_next) { @@ -9180,14 +9174,14 @@ xtensa_relax_frag (fragS *fragP, long stretch, int *stretched_p) xtensa_isa isa = xtensa_default_isa; int unreported = fragP->tc_frag_data.unreported_expansion; long new_stretch = 0; - char *file_name; + const char *file_name; unsigned line; int lit_size; static xtensa_insnbuf vbuf = NULL; int slot, num_slots; xtensa_format fmt; - as_where (&file_name, &line); + file_name = as_where (&line); new_logical_line (fragP->fr_file, fragP->fr_line); fragP->tc_frag_data.unreported_expansion = 0; @@ -10293,10 +10287,10 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT sec, fragS *fragp) int slot; int num_slots; xtensa_format fmt; - char *file_name; + const char *file_name; unsigned line; - as_where (&file_name, &line); + file_name = as_where (&line); new_logical_line (fragp->fr_file, fragp->fr_line); switch (fragp->fr_subtype) @@ -12571,7 +12565,7 @@ tinsn_to_slotbuf (xtensa_format fmt, expressionS *exp = &tinsn->tok[i]; int rc; unsigned line; - char *file_name; + const char *file_name; uint32 opnd_value; switch (exp->X_op) @@ -12592,7 +12586,7 @@ tinsn_to_slotbuf (xtensa_format fmt, case O_constant: if (xtensa_operand_is_visible (isa, opcode, i) == 0) break; - as_where (&file_name, &line); + file_name = as_where (&line); /* It is a constant and we called this function then we have to try to fit it. */ xtensa_insnbuf_set_operand (slotbuf, fmt, slot, opcode, i, -- cgit v1.1