aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gas/ChangeLog141
-rw-r--r--gas/app.c2
-rw-r--r--gas/as.h24
-rw-r--r--gas/cond.c14
-rw-r--r--gas/config/obj-coff.c4
-rw-r--r--gas/config/obj-elf.c4
-rw-r--r--gas/config/obj-som.c5
-rw-r--r--gas/config/tc-aarch64.c4
-rw-r--r--gas/config/tc-alpha.c2
-rw-r--r--gas/config/tc-arc.c2
-rw-r--r--gas/config/tc-d30v.c2
-rw-r--r--gas/config/tc-i370.c2
-rw-r--r--gas/config/tc-ia64.c10
-rw-r--r--gas/config/tc-m68k.c4
-rw-r--r--gas/config/tc-mcore.c2
-rw-r--r--gas/config/tc-microblaze.c6
-rw-r--r--gas/config/tc-mips.c4
-rw-r--r--gas/config/tc-mmix.c12
-rw-r--r--gas/config/tc-ppc.c6
-rw-r--r--gas/config/tc-rx.c10
-rw-r--r--gas/config/tc-s390.c4
-rw-r--r--gas/config/tc-tic54x.c7
-rw-r--r--gas/config/tc-tilegx.c5
-rw-r--r--gas/config/tc-tilepro.c2
-rw-r--r--gas/config/tc-xtensa.c32
-rw-r--r--gas/depend.c22
-rw-r--r--gas/dwarf2dbg.c3
-rw-r--r--gas/ecoff.c9
-rw-r--r--gas/expr.c6
-rw-r--r--gas/expr.h2
-rw-r--r--gas/frags.c4
-rw-r--r--gas/frags.h2
-rw-r--r--gas/input-file.c8
-rw-r--r--gas/input-file.h2
-rw-r--r--gas/input-scrub.c34
-rw-r--r--gas/listing.c6
-rw-r--r--gas/macro.c2
-rw-r--r--gas/macro.h4
-rw-r--r--gas/messages.c32
-rw-r--r--gas/output-file.c4
-rw-r--r--gas/output-file.h4
-rw-r--r--gas/read.c12
-rw-r--r--gas/stabs.c19
-rw-r--r--gas/symbols.c11
-rw-r--r--gas/write.c4
-rw-r--r--gas/write.h4
46 files changed, 315 insertions, 189 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 293e00e..2059a65 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,142 @@
+2016-02-22 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
+
+ * 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.
+
2016-02-21 H.J. Lu <hongjiu.lu@intel.com>
* write.c (compress_debug): Move BFD compression bits setting
@@ -24,7 +163,7 @@
* read.c (read_a_source_file): Check for assemble_one returning
with input_line_pointer set to NULL.
-016-02-19 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
+2016-02-19 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* listing.c (rebuffer_line): Change return type to void.
diff --git a/gas/app.c b/gas/app.c
index 074c447..f53e7ce 100644
--- a/gas/app.c
+++ b/gas/app.c
@@ -1291,7 +1291,7 @@ do_scrub_chars (size_t (*get) (char *, size_t), char *tostart, size_t tolen)
#ifdef WARN_COMMENTS
if (!found_comment)
- as_where (&found_comment_file, &found_comment);
+ found_comment_file = as_where (&found_comment);
#endif
do
{
diff --git a/gas/as.h b/gas/as.h
index 7714277..4ee3f1b 100644
--- a/gas/as.h
+++ b/gas/as.h
@@ -453,13 +453,13 @@ typedef struct _pseudo_type pseudo_typeS;
void FCN (const char *format, ...) \
__attribute__ ((__format__ (__printf__, 1, 2)))
#define PRINTF_WHERE_LIKE(FCN) \
- void FCN (char *file, unsigned int line, const char *format, ...) \
+ void FCN (const char *file, unsigned int line, const char *format, ...) \
__attribute__ ((__format__ (__printf__, 3, 4)))
#else /* __GNUC__ < 2 || defined(VMS) */
#define PRINTF_LIKE(FCN) void FCN (const char *format, ...)
-#define PRINTF_WHERE_LIKE(FCN) void FCN (char *file, \
+#define PRINTF_WHERE_LIKE(FCN) void FCN (const char *file, \
unsigned int line, \
const char *format, ...)
@@ -477,17 +477,19 @@ void as_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
void sprint_value (char *, addressT);
int had_errors (void);
int had_warnings (void);
-void as_warn_value_out_of_range (char *, offsetT, offsetT, offsetT, char *, unsigned);
-void as_bad_value_out_of_range (char *, offsetT, offsetT, offsetT, char *, unsigned);
+void as_warn_value_out_of_range (char *, offsetT, offsetT, offsetT,
+ const char *, unsigned);
+void as_bad_value_out_of_range (char *, offsetT, offsetT, offsetT,
+ const char *, unsigned);
void print_version_id (void);
char * app_push (void);
char * atof_ieee (char *, int, LITTLENUM_TYPE *);
char * ieee_md_atof (int, char *, int *, bfd_boolean);
char * vax_md_atof (int, char *, int *);
-char * input_scrub_include_file (char *, char *);
+char * input_scrub_include_file (const char *, char *);
void input_scrub_insert_line (const char *);
void input_scrub_insert_file (char *);
-char * input_scrub_new_file (char *);
+char * input_scrub_new_file (const char *);
char * input_scrub_next_buffer (char **bufp);
size_t do_scrub_chars (size_t (*get) (char *, size_t), char *, size_t);
int gen_to_words (LITTLENUM_TYPE *, int, long);
@@ -497,14 +499,14 @@ void cond_finish_check (int);
void cond_exit_macro (int);
int seen_at_least_1_file (void);
void app_pop (char *);
-void as_where (char **, unsigned int *);
+const char * as_where (unsigned int *);
void bump_line_counters (void);
void do_scrub_begin (int);
void input_scrub_begin (void);
void input_scrub_close (void);
void input_scrub_end (void);
-int new_logical_line (char *, int);
-int new_logical_line_flags (char *, int, int);
+int new_logical_line (const char *, int);
+int new_logical_line_flags (const char *, int, int);
void subsegs_begin (void);
void subseg_change (segT, int);
segT subseg_new (const char *, subsegT);
@@ -513,7 +515,7 @@ void subseg_set (segT, subsegT);
int subseg_text_p (segT);
int seg_not_empty_p (segT);
void start_dependencies (char *);
-void register_dependency (char *);
+void register_dependency (const char *);
void print_dependencies (void);
segT subseg_get (const char *, int);
@@ -578,7 +580,7 @@ COMMON int flag_m68k_mri;
#ifdef WARN_COMMENTS
COMMON int warn_comment;
COMMON unsigned int found_comment;
-COMMON char * found_comment_file;
+COMMON const char * found_comment_file;
#endif
#if defined OBJ_ELF || defined OBJ_MAYBE_ELF
diff --git a/gas/cond.c b/gas/cond.c
index d99c1e0..824ba77 100644
--- a/gas/cond.c
+++ b/gas/cond.c
@@ -29,7 +29,7 @@
struct obstack cond_obstack;
struct file_line {
- char *file;
+ const char *file;
unsigned int line;
};
@@ -317,8 +317,8 @@ s_elseif (int arg)
}
else
{
- as_where (&current_cframe->else_file_line.file,
- &current_cframe->else_file_line.line);
+ current_cframe->else_file_line.file
+ = as_where (&current_cframe->else_file_line.line);
current_cframe->dead_tree |= !current_cframe->ignoring;
current_cframe->ignoring = current_cframe->dead_tree;
@@ -423,8 +423,8 @@ s_else (int arg ATTRIBUTE_UNUSED)
}
else
{
- as_where (&current_cframe->else_file_line.file,
- &current_cframe->else_file_line.line);
+ current_cframe->else_file_line.file
+ = as_where (&current_cframe->else_file_line.line);
current_cframe->ignoring =
current_cframe->dead_tree | !current_cframe->ignoring;
@@ -527,8 +527,8 @@ static void
initialize_cframe (struct conditional_frame *cframe)
{
memset (cframe, 0, sizeof (*cframe));
- as_where (&cframe->if_file_line.file,
- &cframe->if_file_line.line);
+ cframe->if_file_line.file
+ = as_where (&cframe->if_file_line.line);
cframe->previous_cframe = current_cframe;
cframe->dead_tree = current_cframe != NULL && current_cframe->ignoring;
cframe->macro_nest = macro_nest;
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,
diff --git a/gas/depend.c b/gas/depend.c
index 50db115..2dd35a4 100644
--- a/gas/depend.c
+++ b/gas/depend.c
@@ -25,10 +25,10 @@
static char * dep_file = NULL;
struct dependency
- {
- char * file;
- struct dependency * next;
- };
+{
+ char * file;
+ struct dependency * next;
+};
/* All the files we depend on. */
static struct dependency * dep_chain = NULL;
@@ -36,8 +36,8 @@ static struct dependency * dep_chain = NULL;
/* Current column in output file. */
static int column = 0;
-static int quote_string_for_make (FILE *, char *);
-static void wrap_output (FILE *, char *, int);
+static int quote_string_for_make (FILE *, const char *);
+static void wrap_output (FILE *, const char *, int);
/* Number of columns allowable. */
#define MAX_COLUMNS 72
@@ -54,7 +54,7 @@ start_dependencies (char *filename)
/* Noticed a new filename, so try to register it. */
void
-register_dependency (char *filename)
+register_dependency (const char *filename)
{
struct dependency *dep;
@@ -80,9 +80,9 @@ register_dependency (char *filename)
This code is taken from gcc with only minor changes. */
static int
-quote_string_for_make (FILE *file, char *src)
+quote_string_for_make (FILE *file, const char *src)
{
- char *p = src;
+ const char *p = src;
int i = 0;
for (;;)
@@ -101,7 +101,7 @@ quote_string_for_make (FILE *file, char *src)
preceded by 2N backslashes represents N backslashes at
the end of a file name; and backslashes in other
contexts should not be doubled. */
- char *q;
+ const char *q;
for (q = p - 1; src < q && q[-1] == '\\'; q--)
{
@@ -142,7 +142,7 @@ quote_string_for_make (FILE *file, char *src)
wrapping as necessary. */
static void
-wrap_output (FILE *f, char *string, int spacer)
+wrap_output (FILE *f, const char *string, int spacer)
{
int len = quote_string_for_make (NULL, string);
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 33703e8..c559cad 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -350,8 +350,7 @@ dwarf2_where (struct dwarf2_line_info *line)
{
if (debug_type == DEBUG_DWARF2)
{
- char *filename;
- as_where (&filename, &line->line);
+ const char *filename = as_where (&line->line);
line->filenum = get_filenum (filename, 0);
line->column = 0;
line->flags = DWARF2_FLAG_IS_STMT;
diff --git a/gas/ecoff.c b/gas/ecoff.c
index eb3beb3..25c3d94 100644
--- a/gas/ecoff.c
+++ b/gas/ecoff.c
@@ -2196,12 +2196,9 @@ add_file (const char *file_name, int indx ATTRIBUTE_UNUSED, int fake)
want to use the actual file name. */
if (file_name == (const char *) NULL)
{
- char *file;
-
if (first_file != (efdr_t *) NULL)
as_fatal (_("fake .file after real one"));
- as_where (&file, (unsigned int *) NULL);
- file_name = (const char *) file;
+ file_name = as_where ((unsigned int *) NULL);
/* Automatically generate ECOFF debugging information, since I
think that's what other ECOFF assemblers do. We don't do
@@ -5181,10 +5178,10 @@ void
ecoff_generate_asm_lineno (void)
{
unsigned int lineno;
- char *filename;
+ const char *filename;
lineno_list_t *list;
- as_where (&filename, &lineno);
+ filename = as_where (&lineno);
if (current_stabs_filename == (char *) NULL
|| filename_cmp (current_stabs_filename, filename))
diff --git a/gas/expr.c b/gas/expr.c
index 825818d..777504f 100644
--- a/gas/expr.c
+++ b/gas/expr.c
@@ -54,7 +54,7 @@ extern const char EXP_CHARS[], FLT_CHARS[];
struct expr_symbol_line {
struct expr_symbol_line *next;
symbolS *sym;
- char *file;
+ const char *file;
unsigned int line;
};
@@ -110,7 +110,7 @@ make_expr_symbol (expressionS *expressionP)
n = (struct expr_symbol_line *) xmalloc (sizeof *n);
n->sym = symbolP;
- as_where (&n->file, &n->line);
+ n->file = as_where (&n->line);
n->next = expr_symbol_lines;
expr_symbol_lines = n;
@@ -122,7 +122,7 @@ make_expr_symbol (expressionS *expressionP)
the symbol. */
int
-expr_symbol_where (symbolS *sym, char **pfile, unsigned int *pline)
+expr_symbol_where (symbolS *sym, const char **pfile, unsigned int *pline)
{
struct expr_symbol_line *l;
diff --git a/gas/expr.h b/gas/expr.h
index 8b3c4f2..a270359 100644
--- a/gas/expr.h
+++ b/gas/expr.h
@@ -180,7 +180,7 @@ extern void subtract_from_result (expressionS *, offsetT, int);
extern segT expr (int, expressionS *, enum expr_mode);
extern unsigned int get_single_number (void);
extern symbolS *make_expr_symbol (expressionS * expressionP);
-extern int expr_symbol_where (symbolS *, char **, unsigned int *);
+extern int expr_symbol_where (symbolS *, const char **, unsigned int *);
extern void current_location (expressionS *);
extern symbolS *expr_build_uconstant (offsetT);
diff --git a/gas/frags.c b/gas/frags.c
index cd3e990..9ff577f 100644
--- a/gas/frags.c
+++ b/gas/frags.c
@@ -176,7 +176,7 @@ frag_new (size_t old_frags_var_max_size
gas_assert (former_last_fragP == frag_now);
frag_now = frag_alloc (&frchP->frch_obstack);
- as_where (&frag_now->fr_file, &frag_now->fr_line);
+ frag_now->fr_file = as_where (&frag_now->fr_line);
/* Generally, frag_now->points to an address rounded up to next
alignment. However, characters will add to obstack frags
@@ -237,7 +237,7 @@ frag_var_init (relax_stateT type, size_t max_chars, size_t var,
#ifdef TC_FRAG_INIT
TC_FRAG_INIT (frag_now);
#endif
- as_where (&frag_now->fr_file, &frag_now->fr_line);
+ frag_now->fr_file = as_where (&frag_now->fr_line);
frag_new (max_chars);
}
diff --git a/gas/frags.h b/gas/frags.h
index ebb5ac4..4a22fe0 100644
--- a/gas/frags.h
+++ b/gas/frags.h
@@ -60,7 +60,7 @@ struct frag {
struct frag *fr_next;
/* Where the frag was created, or where it became a variant frag. */
- char *fr_file;
+ const char *fr_file;
unsigned int fr_line;
#ifndef NO_LISTING
diff --git a/gas/input-file.c b/gas/input-file.c
index 08ffa46..a3dcd9d 100644
--- a/gas/input-file.c
+++ b/gas/input-file.c
@@ -42,13 +42,13 @@ int preprocess = 0;
/* We use static data: the data area is not sharable. */
static FILE *f_in;
-static char *file_name;
+static const char *file_name;
/* Struct for saving the state of this module for file includes. */
struct saved_file
{
FILE * f_in;
- char * file_name;
+ const char * file_name;
int preprocess;
char * app_save;
};
@@ -111,8 +111,10 @@ input_file_pop (char *arg)
free (arg);
}
+/* Open the specified file, "" means stdin. Filename must not be null. */
+
void
-input_file_open (char *filename, /* "" means use stdin. Must not be 0. */
+input_file_open (const char *filename,
int pre)
{
int c;
diff --git a/gas/input-file.h b/gas/input-file.h
index cedaa9b..3581046 100644
--- a/gas/input-file.h
+++ b/gas/input-file.h
@@ -61,5 +61,5 @@ size_t input_file_buffer_size (void);
void input_file_begin (void);
void input_file_close (void);
void input_file_end (void);
-void input_file_open (char *filename, int pre);
+void input_file_open (const char *filename, int pre);
void input_file_pop (char *arg);
diff --git a/gas/input-scrub.c b/gas/input-scrub.c
index 9d4d75a..4bbb38f 100644
--- a/gas/input-scrub.c
+++ b/gas/input-scrub.c
@@ -95,8 +95,8 @@ int macro_nest;
source line numbers. Whenever we open a file we must fill in
physical_input_file. So if it is NULL we have not opened any files yet. */
-static char *physical_input_file;
-static char *logical_input_file;
+static const char *physical_input_file;
+static const char *logical_input_file;
/* 1-origin line number in a source file. */
/* A line ends in '\n' or eof. */
@@ -110,8 +110,8 @@ struct input_save {
int partial_size;
char save_source[AFTER_SIZE];
size_t buffer_length;
- char * physical_input_file;
- char * logical_input_file;
+ const char * physical_input_file;
+ const char * logical_input_file;
unsigned int physical_input_line;
int logical_input_line;
size_t sb_index;
@@ -159,7 +159,7 @@ input_scrub_push (char *saved_position)
input_file_begin (); /* Reinitialize! */
logical_input_line = -1;
- logical_input_file = (char *) NULL;
+ logical_input_file = NULL;
buffer_length = input_file_buffer_size ();
sb_index = -1;
@@ -214,7 +214,7 @@ input_scrub_begin (void)
/* Line number things. */
logical_input_line = -1;
- logical_input_file = (char *) NULL;
+ logical_input_file = NULL;
physical_input_file = NULL; /* No file read yet. */
next_saved_file = NULL; /* At EOF, don't pop to any other file */
do_scrub_begin (flag_m68k_mri);
@@ -235,7 +235,7 @@ input_scrub_end (void)
Return start of caller's part of buffer. */
char *
-input_scrub_new_file (char *filename)
+input_scrub_new_file (const char *filename)
{
input_file_open (filename, !flag_no_comments);
physical_input_file = filename[0] ? filename : _("{standard input}");
@@ -250,7 +250,7 @@ input_scrub_new_file (char *filename)
input_scrub_new_file. */
char *
-input_scrub_include_file (char *filename, char *position)
+input_scrub_include_file (const char *filename, char *position)
{
next_saved_file = input_scrub_push (position);
return input_scrub_new_file (filename);
@@ -435,7 +435,7 @@ bump_line_counters (void)
Returns nonzero if the filename actually changes. */
int
-new_logical_line_flags (char *fname, /* DON'T destroy it! We point to it! */
+new_logical_line_flags (const char *fname, /* DON'T destroy it! We point to it! */
int line_number,
int flags)
{
@@ -476,36 +476,34 @@ new_logical_line_flags (char *fname, /* DON'T destroy it! We point to it! */
}
int
-new_logical_line (char *fname, int line_number)
+new_logical_line (const char *fname, int line_number)
{
return new_logical_line_flags (fname, line_number, 0);
}
-/* Return the current file name and line number.
- namep should be char * const *, but there are compilers which screw
- up declarations like that, and it's easier to avoid it. */
+/* Return the current file name and line number. */
-void
-as_where (char **namep, unsigned int *linep)
+const char *
+as_where (unsigned int *linep)
{
if (logical_input_file != NULL
&& (linep == NULL || logical_input_line >= 0))
{
- *namep = logical_input_file;
if (linep != NULL)
*linep = logical_input_line;
+ return logical_input_file;
}
else if (physical_input_file != NULL)
{
- *namep = physical_input_file;
if (linep != NULL)
*linep = physical_input_line;
+ return physical_input_file;
}
else
{
- *namep = 0;
if (linep != NULL)
*linep = 0;
+ return NULL;
}
}
diff --git a/gas/listing.c b/gas/listing.c
index a346f37..4b5fd34 100644
--- a/gas/listing.c
+++ b/gas/listing.c
@@ -297,10 +297,10 @@ new_frag (void)
void
listing_newline (char *ps)
{
- char *file;
+ const char *file;
unsigned int line;
static unsigned int last_line = 0xffff;
- static char *last_file = NULL;
+ static const char *last_file = NULL;
list_info_type *new_i = NULL;
if (listing == 0)
@@ -327,7 +327,7 @@ listing_newline (char *ps)
}
#endif
- as_where (&file, &line);
+ file = as_where (&line);
if (ps == NULL)
{
if (line == last_line
diff --git a/gas/macro.c b/gas/macro.c
index d83fb82..b083382 100644
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -648,7 +648,7 @@ free_macro (macro_entry *macro)
const char *
define_macro (size_t idx, sb *in, sb *label,
size_t (*get_line) (sb *),
- char *file, unsigned int line,
+ const char *file, unsigned int line,
const char **namep)
{
macro_entry *macro;
diff --git a/gas/macro.h b/gas/macro.h
index cbd32c9..7000197 100644
--- a/gas/macro.h
+++ b/gas/macro.h
@@ -65,7 +65,7 @@ typedef struct macro_struct
formal_entry *formals; /* Pointer to list of formal_structs. */
struct hash_control *formal_hash; /* Hash table of formals. */
const char *name; /* Macro name. */
- char *file; /* File the macro was defined in. */
+ const char *file; /* File the macro was defined in. */
unsigned int line; /* Line number of definition. */
} macro_entry;
@@ -88,7 +88,7 @@ extern void macro_init (int, int, int,
extern void macro_set_alternate (int);
extern void macro_mri_mode (int);
extern const char *define_macro (size_t, sb *, sb *, size_t (*) (sb *),
- char *, unsigned int, const char **);
+ const char *, unsigned int, const char **);
extern int check_macro (const char *, sb *, const char **, macro_entry **);
extern void delete_macro (const char *);
extern const char *expand_irp (int, size_t, sb *, sb *, size_t (*) (sb *));
diff --git a/gas/messages.c b/gas/messages.c
index 2c9f3da..dc016bf 100644
--- a/gas/messages.c
+++ b/gas/messages.c
@@ -19,10 +19,10 @@
#include "as.h"
-static void identify (char *);
+static void identify (const char *);
static void as_show_where (void);
-static void as_warn_internal (char *, unsigned int, char *);
-static void as_bad_internal (char *, unsigned int, char *);
+static void as_warn_internal (const char *, unsigned int, char *);
+static void as_bad_internal (const char *, unsigned int, char *);
/* Despite the rest of the comments in this file, (FIXME-SOON),
here is the current scheme for error messages etc:
@@ -61,7 +61,7 @@ static void as_bad_internal (char *, unsigned int, char *);
continues as though no error occurred. */
static void
-identify (char *file)
+identify (const char *file)
{
static int identified;
@@ -72,7 +72,7 @@ identify (char *file)
if (!file)
{
unsigned int x;
- as_where (&file, &x);
+ file = as_where (&x);
}
if (file)
@@ -105,10 +105,10 @@ had_errors (void)
static void
as_show_where (void)
{
- char *file;
+ const char *file;
unsigned int line;
- as_where (&file, &line);
+ file = as_where (&line);
identify (file);
if (file)
{
@@ -140,12 +140,12 @@ as_tsktsk (const char *format, ...)
/* The common portion of as_warn and as_warn_where. */
static void
-as_warn_internal (char *file, unsigned int line, char *buffer)
+as_warn_internal (const char *file, unsigned int line, char *buffer)
{
++warning_count;
if (file == NULL)
- as_where (&file, &line);
+ file = as_where (&line);
identify (file);
if (file)
@@ -188,7 +188,7 @@ as_warn (const char *format, ...)
the varargs correctly and portably. */
void
-as_warn_where (char *file, unsigned int line, const char *format, ...)
+as_warn_where (const char *file, unsigned int line, const char *format, ...)
{
va_list args;
char buffer[2000];
@@ -205,12 +205,12 @@ as_warn_where (char *file, unsigned int line, const char *format, ...)
/* The common portion of as_bad and as_bad_where. */
static void
-as_bad_internal (char *file, unsigned int line, char *buffer)
+as_bad_internal (const char *file, unsigned int line, char *buffer)
{
++error_count;
if (file == NULL)
- as_where (&file, &line);
+ file = as_where (&line);
identify (file);
if (file)
@@ -251,7 +251,7 @@ as_bad (const char *format, ...)
the varargs correctly and portably. */
void
-as_bad_where (char *file, unsigned int line, const char *format, ...)
+as_bad_where (const char *file, unsigned int line, const char *format, ...)
{
va_list args;
char buffer[2000];
@@ -346,7 +346,7 @@ as_internal_value_out_of_range (const char * prefix,
offsetT val,
offsetT min,
offsetT max,
- char * file,
+ const char * file,
unsigned line,
int bad)
{
@@ -418,7 +418,7 @@ as_warn_value_out_of_range (char * prefix,
offsetT value,
offsetT min,
offsetT max,
- char * file,
+ const char * file,
unsigned line)
{
as_internal_value_out_of_range (prefix, value, min, max, file, line, 0);
@@ -429,7 +429,7 @@ as_bad_value_out_of_range (char * prefix,
offsetT value,
offsetT min,
offsetT max,
- char * file,
+ const char * file,
unsigned line)
{
as_internal_value_out_of_range (prefix, value, min, max, file, line, 1);
diff --git a/gas/output-file.c b/gas/output-file.c
index 41d767c..f2db85f 100644
--- a/gas/output-file.c
+++ b/gas/output-file.c
@@ -28,7 +28,7 @@
bfd *stdoutput;
void
-output_file_create (char *name)
+output_file_create (const char *name)
{
if (name[0] == '-' && name[1] == '\0')
as_fatal (_("can't open a bfd on stdout %s"), name);
@@ -50,7 +50,7 @@ output_file_create (char *name)
}
void
-output_file_close (char *filename)
+output_file_close (const char *filename)
{
bfd_boolean res;
diff --git a/gas/output-file.h b/gas/output-file.h
index 6c467a3..d4d32a2 100644
--- a/gas/output-file.h
+++ b/gas/output-file.h
@@ -19,7 +19,7 @@
the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
void output_file_append (char *where, long length, char *filename);
-void output_file_close (char *filename);
-void output_file_create (char *name);
+void output_file_close (const char *filename);
+void output_file_create (const char *name);
/* end of output-file.h */
diff --git a/gas/read.c b/gas/read.c
index 5e0e3c8..e992534 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -2348,13 +2348,14 @@ s_globl (int ignore ATTRIBUTE_UNUSED)
void
s_irp (int irpc)
{
- char *file, *eol;
+ char * eol;
+ const char * file;
unsigned int line;
sb s;
const char *err;
sb out;
- as_where (&file, &line);
+ file = as_where (&line);
eol = find_end_of_line (input_line_pointer, 0);
sb_build (&s, eol - input_line_pointer);
@@ -2683,13 +2684,14 @@ get_macro_line_sb (sb *line)
void
s_macro (int ignore ATTRIBUTE_UNUSED)
{
- char *file, *eol;
+ char *eol;
+ const char * file;
unsigned int line;
sb s;
const char *err;
const char *name;
- as_where (&file, &line);
+ file = as_where (&line);
eol = find_end_of_line (input_line_pointer, 0);
sb_build (&s, eol - input_line_pointer);
@@ -4163,7 +4165,7 @@ s_reloc (int ignore ATTRIBUTE_UNUSED)
break;
}
- as_where (&reloc->file, &reloc->line);
+ reloc->file = as_where (&reloc->line);
reloc->next = reloc_list;
reloc_list = reloc;
diff --git a/gas/stabs.c b/gas/stabs.c
index 3b56a48..b734f35 100644
--- a/gas/stabs.c
+++ b/gas/stabs.c
@@ -35,7 +35,7 @@
int outputting_stabs_line_debug = 0;
static void s_stab_generic (int, const char *, const char *);
-static void generate_asm_file (int, char *);
+static void generate_asm_file (int, const char *);
/* Allow backends to override the names used for the stab sections. */
#ifndef STAB_SECTION_NAME
@@ -490,10 +490,10 @@ s_desc (ignore)
void
stabs_generate_asm_file (void)
{
- char *file;
+ const char *file;
unsigned int lineno;
- as_where (&file, &lineno);
+ file = as_where (&lineno);
if (use_gnu_debug_info_extensions)
{
const char *dir;
@@ -512,15 +512,15 @@ stabs_generate_asm_file (void)
TYPE is one of N_SO, N_SOL. */
static void
-generate_asm_file (int type, char *file)
+generate_asm_file (int type, const char *file)
{
static char *last_file;
static int label_count;
char *hold;
char sym[30];
char *buf;
- char *tmp = file;
- char *file_endp = file + strlen (file);
+ const char *tmp = file;
+ const char *file_endp = file + strlen (file);
char *bufp;
if (last_file != NULL
@@ -583,7 +583,7 @@ stabs_generate_asm_lineno (void)
{
static int label_count;
char *hold;
- char *file;
+ const char *file;
unsigned int lineno;
char *buf;
char sym[30];
@@ -598,7 +598,7 @@ stabs_generate_asm_lineno (void)
hold = input_line_pointer;
- as_where (&file, &lineno);
+ file = as_where (&lineno);
/* Don't emit sequences of stabs for the same line. */
if (prev_file == NULL)
@@ -661,7 +661,6 @@ stabs_generate_asm_func (const char *funcname, const char *startlabname)
static int void_emitted_p;
char *hold = input_line_pointer;
char *buf;
- char *file;
unsigned int lineno;
if (! void_emitted_p)
@@ -671,7 +670,7 @@ stabs_generate_asm_func (const char *funcname, const char *startlabname)
void_emitted_p = 1;
}
- as_where (&file, &lineno);
+ as_where (&lineno);
if (asprintf (&buf, "\"%s:F1\",%d,0,%d,%s",
funcname, N_FUN, lineno + 1, startlabname) == -1)
as_fatal ("%s", xstrerror (errno));
diff --git a/gas/symbols.c b/gas/symbols.c
index 484badc..e117049 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -972,7 +972,7 @@ use_complex_relocs_for (symbolS * symp)
static void
report_op_error (symbolS *symp, symbolS *left, operatorT op, symbolS *right)
{
- char *file;
+ const char *file;
unsigned int line;
segT seg_left = left ? S_GET_SEGMENT (left) : 0;
segT seg_right = S_GET_SEGMENT (right);
@@ -1379,7 +1379,7 @@ resolve_symbol_value (symbolS *symp)
already issued a warning about using a bad symbol. */
if (seg_right == absolute_section && finalize_syms)
{
- char *file;
+ const char *file;
unsigned int line;
if (expr_symbol_where (symp, &file, &line))
@@ -2222,13 +2222,8 @@ S_SET_EXTERNAL (symbolS *s)
}
if (s->bsym->flags & BSF_SECTION_SYM)
{
- char * file;
- unsigned int line;
-
/* Do not reassign section symbols. */
- as_where (& file, & line);
- as_warn_where (file, line,
- _("section symbols are already global"));
+ as_warn (_("section symbols are already global"));
return;
}
#ifndef TC_GLOBAL_REGISTER_SYMBOL_OK
diff --git a/gas/write.c b/gas/write.c
index 46ce5df..f623b00 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -192,7 +192,7 @@ fix_new_internal (fragS *frag, /* Which frag? */
TC_INIT_FIX_DATA (fixP);
#endif
- as_where (&fixP->fx_file, &fixP->fx_line);
+ fixP->fx_file = as_where (&fixP->fx_line);
{
@@ -1137,7 +1137,7 @@ fix_segment (bfd *abfd ATTRIBUTE_UNUSED,
static void
install_reloc (asection *sec, arelent *reloc, fragS *fragp,
- char *file, unsigned int line)
+ const char *file, unsigned int line)
{
char *err;
bfd_reloc_status_type s;
diff --git a/gas/write.h b/gas/write.h
index 4aee78d..ce81a92 100644
--- a/gas/write.h
+++ b/gas/write.h
@@ -112,7 +112,7 @@ struct fix
/* The location of the instruction which created the reloc, used
in error messages. */
- char *fx_file;
+ const char *fx_file;
unsigned fx_line;
#ifdef USING_CGEN
@@ -156,7 +156,7 @@ struct reloc_list
arelent r;
} b;
} u;
- char *file;
+ const char *file;
unsigned int line;
};