]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add more const type qualifiers to GAS sources.
authorTrevor Saunders <tbsaunde+binutils@tbsaunde.org>
Mon, 22 Feb 2016 14:11:27 +0000 (14:11 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 22 Feb 2016 14:11:27 +0000 (14:11 +0000)
* 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.

46 files changed:
gas/ChangeLog
gas/app.c
gas/as.h
gas/cond.c
gas/config/obj-coff.c
gas/config/obj-elf.c
gas/config/obj-som.c
gas/config/tc-aarch64.c
gas/config/tc-alpha.c
gas/config/tc-arc.c
gas/config/tc-d30v.c
gas/config/tc-i370.c
gas/config/tc-ia64.c
gas/config/tc-m68k.c
gas/config/tc-mcore.c
gas/config/tc-microblaze.c
gas/config/tc-mips.c
gas/config/tc-mmix.c
gas/config/tc-ppc.c
gas/config/tc-rx.c
gas/config/tc-s390.c
gas/config/tc-tic54x.c
gas/config/tc-tilegx.c
gas/config/tc-tilepro.c
gas/config/tc-xtensa.c
gas/depend.c
gas/dwarf2dbg.c
gas/ecoff.c
gas/expr.c
gas/expr.h
gas/frags.c
gas/frags.h
gas/input-file.c
gas/input-file.h
gas/input-scrub.c
gas/listing.c
gas/macro.c
gas/macro.h
gas/messages.c
gas/output-file.c
gas/output-file.h
gas/read.c
gas/stabs.c
gas/symbols.c
gas/write.c
gas/write.h

index 293e00eb65a37e7e0d8bcebad6ef44c264f72c00..2059a6575e9bbd45efd3cfb57b149c9734cdd735 100644 (file)
@@ -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
        * 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.
 
index 074c447c362e8643b7da5501d35d7128248d2354..f53e7ce4134af9585d46b57ce02ab579e9ac6c86 100644 (file)
--- 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
            {
index 7714277644a3aa2489e3eefab22e60ff80fd86ce..4ee3f1bf9bf8c4ac449f1d3194e9c2b2f27d479a 100644 (file)
--- 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
index d99c1e0f149608cfe5c1bd11a1a66079b0728eec..824ba776c9816c64cd092e799720a77519c3af07 100644 (file)
@@ -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;
index c100c95e3b67cad1ababf24587bbe7fb1827dfae..03be65517151504f8e8f564a71b954557023a81c 100644 (file)
@@ -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");
index 9af349c2c167e7d723bd4eeabe421ff7eb8d2f34..e8af394e9ce57eb3860c8cd29dcdcf533770251d 100644 (file)
@@ -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");
index 953c3a70282b0252bb9701abaa9bcf173c95f371..c0b2b41b2a9c112216c233ea300afec0d9730e81 100644 (file)
@@ -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);
index dfcbd52136a533f79ed13e8a13dc11d81db5b28d..b455dc8c80325802dc240e0704ca02771b7f950a 100644 (file)
@@ -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)
index 5d754c96f9a7c10f42c2f0d751ab5306eaa9bdac..e849a959d6947ecdc6dd9e344029043ba928ff41 100644 (file)
@@ -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))
index bfe9ae1448841240f92c6fac049765fb007e924c..82cff9aebd8300e35fb94c150a1642986f459143 100644 (file)
@@ -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;
index 68880e0ccad10e9a2356cde04bfb8e0a5aa23f21..1ac160501dde4446b40393ccb5b16f68a3e44889 100644 (file)
@@ -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;
 
index 8554c6d8d14f8ba1d3c575a1155a8188e477c738..47955601ca79311bc5baee3ef553b75942c52deb 100644 (file)
@@ -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
index f0ba4ae4662f53b47acfc0d6dfe43f46b9ec3a99..8169bcea12c3893c50af6246a240541464a0389a 100644 (file)
@@ -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);
index 6bff4fb1884c52a10211078b741a345ff9d298f7..7ef5ff41234aad3b3d18dd83c4a332b13835fe88 100644 (file)
@@ -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;
index e4dda2db2c2ff76d70b628058d887f8995a3bfe5..f73f3b71f3615e25ab303ecb700b611c40b3db03 100644 (file)
@@ -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;
index 5484b30e1cedcb08b3a6e2afc6e3bf515e6484e3..16c70ad1d60e219aef63224093dab6e653334e4f 100644 (file)
@@ -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 "
index 7b34a4b4f8b9caea8110e343f6d1cfa740116611..862454df7511424d6ab115a5b52d30d63d0d55a2 100644 (file)
@@ -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)
 {
index 34c22ef391343fd5e9e57d93f08eed9147195eef..b7bfe14f6016f1afdfe386bcdc00cae03a2d967e 100644 (file)
@@ -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);
 
index 57029f729f1fc4757a5d27c2aec3d6beef59600a..71b2dac9060db2df3a17b7d955fa93e90e946bd6 100644 (file)
@@ -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
index 24f47cce7c9542f6c8f6381e9a11687afb03686e..91d4828a17de12c6e6744faceda20d7bd077f93f 100644 (file)
@@ -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"); */
 
index 66b54ea8adb7050996293ded85d8925caf73fc31..fda96a205abeba64bd809586223db2041bdbc516 100644 (file)
@@ -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
index 1ff204be283c9f90546ba2eb0053ad2b18df5f0d..3ed7933b56055e0c4bc4e5e43f805bc4c98fba59 100644 (file)
@@ -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);
     }
 }
index 0b4ece6c07adae742e91c5bac6d76e31e67a3572..7897aca44c3a1eece626780572c2231fddf6bdbf 100644 (file)
@@ -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;
index 00eeaa6ac66063c8b91784c54743418590f8a772..90ce09a7f473dc50657a3152d2b931b2cdaeaeaa 100644 (file)
@@ -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.  */
index 5773634d45b88da14800ca10cc114820f23fc59f..d99513141b209b5063d4fd67fe2039dd31d1b571 100644 (file)
@@ -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,
index 50db1154faa8754c1263e6677eab5cbcfa7dab80..2dd35a4470c67b0c7011b67a317019607053c3e1 100644 (file)
 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);
 
index 33703e83b85e9df470ddea63eb1fc90eb3e1280d..c559cadc9382ecf29d157275abf01034604bfe10 100644 (file)
@@ -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;
index eb3beb3ed15a48528db6adb2511b4c5084818df5..25c3d94bcd0acaaf8e9b138f9d22c40ba3b72508 100644 (file)
@@ -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))
index 825818d791f38691d72cb1f393c847fbe651b3d5..777504f1f8004821f6f19f584b603ea66850b655 100644 (file)
@@ -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;
 
index 8b3c4f2529ebf9ec994645584b46d59f881dbfdc..a270359644d5475cd188336bf364552b058ac51a 100644 (file)
@@ -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);
index cd3e990fab458f4d4483039ad17654460e69e98c..9ff577fc633a1334f4ff113edf4ac4fca0d49903 100644 (file)
@@ -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);
 }
index ebb5ac45f1209c0c2bab873ea2e27a17165bef7b..4a22fe0ebc5274141b3ee6138769cd6f29923dcb 100644 (file)
@@ -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
index 08ffa46b6d998019188e40aa8d4b6785a35892da..a3dcd9d2f89c291382368706ce0ee51c65bef223 100644 (file)
@@ -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);
 }
 \f
+/* 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;
index cedaa9bdd620fd58f4f78649a3c20b0198e874a5..35810462e917a4f283f78905b23e44262360abb6 100644 (file)
@@ -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);
index 9d4d75ad976e9215ad3f15cd8026fe61f15e311f..4bbb38faae49c3b5cfd4ec7989592b04dd0d2b4d 100644 (file)
@@ -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);
 }
 
 \f
-/* 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;
     }
 }
index a346f376056ba0e4155d701119233256a833f93d..4b5fd34cf8c41216f49de0f1121766342925b910 100644 (file)
@@ -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
index d83fb822e1574b4d7f599e86a5180441437edf54..b083382704aa101860696144f4c8f689a0d022e2 100644 (file)
@@ -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;
index cbd32c9717089bae50777428ae91b1a1b6fcf9ab..7000197729b738e673457fda4fb5058a5a788c30 100644 (file)
@@ -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 *));
index 2c9f3dab070184c1a1a8859a89eddf1363176921..dc016bf86e65ad9aa8e1c050de2a6b989291b038 100644 (file)
 
 #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);
index 41d767cfa6892c277f893aab22cf0ef4fbd53396..f2db85f0cd26e2624e30dc895936781e397e4465 100644 (file)
@@ -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;
 
index 6c467a32f59b5e6d43fa00ec35e247338b5fd81e..d4d32a2fad8c2310f0bacd8456485a2a4f876c2e 100644 (file)
@@ -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 */
index 5e0e3c8d99f0546ed6b9dc4b7babc2f1a6151ba5..e992534bce7ab7c854a26f5da951ee98d3bc7966 100644 (file)
@@ -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;
 
index 3b56a4872d14b7a0a96d24783d8c49f84df7bdfd..b734f35238dcb3579b7a56ea82e3faca9ee522a6 100644 (file)
@@ -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));
index 484badc27ceb80212cd94a0c3050a1f34fe8b412..e1170496096c918345c7d605d856e6781074587a 100644 (file)
@@ -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
index 46ce5df48d22a0b7cb93b9f46f0c77b311ed5c44..f623b00e27846c008effde66c0b3458701880b24 100644 (file)
@@ -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;
index 4aee78d0398acba2e71b83812a1958c2c355f73e..ce81a926c3d167070f3230b028662c5e6ab661bd 100644 (file)
@@ -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;
 };