diff options
author | Trevor Saunders <tbsaunde+binutils@tbsaunde.org> | 2016-02-22 14:11:27 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2016-02-22 14:11:27 +0000 |
commit | 3b4dbbbf59aef4308bae6654bdc7968797504a3c (patch) | |
tree | af1183f877808046bf8ce94e50b899317840a0db /gas/input-scrub.c | |
parent | 75c1920bb02f09534da55b98277a613b7cb430cc (diff) | |
download | binutils-3b4dbbbf59aef4308bae6654bdc7968797504a3c.zip binutils-3b4dbbbf59aef4308bae6654bdc7968797504a3c.tar.gz binutils-3b4dbbbf59aef4308bae6654bdc7968797504a3c.tar.bz2 |
Add more const type qualifiers to GAS sources.
* output-file.c (output_file_create): Make file name argument const.
(output_file_close): Likewise.
* output-file.h (output_file_create): Adjust.
(output_file_close): Likewise.
* depend.c (quote_string_for_make): Make src argument const char *.
(register_dependency): Likewise.
(wrap_output): Likewise.
* as.h (register_dependency): Adjust.
* config/tc-xtensa.c (finish_vinsn): Remove unnecessary calls to
as_where ();
* symbols.c (S_SET_EXTERNAL): Likewise.
* input-scrub.c (as_where): Return the file name.
* as.h (as_where): Adjust prototype.
* app.c (do_scrub_chars): Adjust.
* cond.c (s_elseif): Likewise.
(s_else): Likewise.
(initialize_cframe): Likewise.
* config/obj-coff.c (obj_coff_init_stab_section): Likewise.
* config/obj-elf.c (obj_elf_init_stab_section): Likewise.
* config/obj-som.c (obj_som_init_stab_section): Likewise.
* config/tc-aarch64.c (output_info): Likewise.
* config/tc-ia64.c (md_assemble): Likewise.
(dot_alias): Likewise.
* config/tc-m68k.c (m68k_frob_label): Likewise.
* config/tc-mmix.c (s_bspec): Likewise.
(mmix_handle_mmixal): Likewise.
* config/tc-rx.c (rx_include): Likewise.
* config/tc-tic54x.c (tic54x_set_default_include): Likewise.
(tic54x_adjust_symtab): Likewise.
* config/tc-xtensa.c (directive_push): Likewise.
(xtensa_sanity_check): Likewise.
(xtensa_relax_frag): Likewise.
(md_convert_frag): Likewise.
(tinsn_to_slotbuf): Likewise.
* dwarf2dbg.c (dwarf2_where): Likewise.
* ecoff.c (add_file): Likewise.
(ecoff_generate_asm_lineno): Likewise.
* expr.c (make_expr_symbol): Likewise.
* frags.c (frag_new): Likewise.
(frag_var_init): Likewise.
* listing.c (listing_newline): Likewise.
* messages.c (identify): Likewise.
(as_show_where): Likewise.
(as_warn_internal): Likewise.
(as_bad_internal): Likewise.
* read.c (s_irp): Likewise.
(s_macro): Likewise.
(s_reloc): Likewise.
* stabs.c (stabs_generate_asm_file): Likewise.
(stabs_generate_asm_lineno): Likewise.
(stabs_generate_asm_func): Likewise.
* write.c (fix_new_internal): Likewise.
* as.h (PRINTF_WHERE_LIKE): Make file name argument const.
(as_warn_value_out_of_range): Adjust prototype.
(as_bad_value_out_of_range): Adjust prototype.
* messages.c (identify): Make file name argument const char *.
(as_warn_internal): Likewise.
(as_warn_where): Likewise.
(as_bad_internal): Likewise.
(as_bad_where): Likewise.
(as_internal_value_out_of_range): Likewise.
(as_warn_value_out_of_range): Likewise.
(as_bad_value_out_of_range): Likewise.
* as.h (found_comment_file): Change type to const char *.
* cond.c (file_line::file): Likewise.
* config/obj-coff.c (obj_coff_init_stab_section): Make variable const.
* config/obj-elf.c (obj_elf_init_stab_section): Likewise.
* config/obj-som.c (obj_som_init_stab_section): Likewise.
* config/tc-aarch64.c (output_info): Likewise.
* config/tc-alpha.c (insert_operand): Likewise.
* config/tc-arc.c (insert_operand): Likewise.
* config/tc-d30v.c (check_size): Likewise.
* config/tc-ia64.c (struct alias): Likewise.
* config/tc-m68k.c (struct label_line): Likewise.
* config/tc-mcore.c (md_apply_fix): Likewise.
* config/tc-microblaze.c (md_estimate_size_before_relax): Likewise.
* config/tc-mips.c (mips16_immed): Likewise.
* config/tc-mmix.c (mmix_handle_mmixal): Likewise.
* config/tc-ppc.c (ppc_insert_operand): Likewise.
* config/tc-rx.c (rx_include): Likewise.
* config/tc-s390.c (s390_insert_operand): Likewise.
* config/tc-tic54x.c (tic54x_set_default_include): Likewise.
(tic54x_adjust_symtab): Likewise.
* config/tc-tilegx.c (insert_operand): Likewise.
(apply_special_operator): Likewise.
* config/tc-tilepro.c (insert_operand): Likewise.
* config/tc-xtensa.c (directive_push): Likewise.
* ecoff.c (add_file): Likewise.
(ecoff_generate_asm_lineno): Likewise.
* listing.c (listing_newline): Likewise.
* read.c (s_irp): Likewise.
* write.c (install_reloc): Likewise.
* write.h (struct fix): Likewise.
* input-file.c (file_name): Change type to const char *.
(saved_file::file_name): Likewise.
(input_file_open): Change type of argument to const char *.
* input-file.h (input_file_open): Adjust.
* input-scrub.c (logical_input_file): change type to const char *.
(physical_input_file): Likewise.
(struct input_save): Adjust.
(input_scrub_push): Adjust.
(input_scrub_begin): Adjust.
(as_where): Adjust.
* input-scrub.c (input_scrub_new_file): Make file name argument const.
(input_scrub_include_file): Likewise.
(new_logical_line_flags): Likewise.
(new_logical_line): Likewise.
* as.h: Adjust.
* frags.h (struct frag): Change type of fr_file to const char *.
* expr.c (expr_symbol_where): Change type of file argument to
const char **.
* expr.h (expr_symbol_where): Likewise.
* config/tc-i370.c (md_apply_fix): adjust.
* config/tc-mmix.c (mmix_md_end): Likewise.
* config/tc-ppc.c (md_apply_fix): Likewise.
* config/tc-s390.c (md_apply_fix): Likewise.
* symbols.c (report_op_error): Likewise.
(resolve_symbol_value): Likewise.
* config/tc-ia64.c (slot::src_file): Change type to const char *.
(rsrc::file): Likewise.
* config/tc-xtensa.c (xtensa_sanity_check): Change type of variable to
const char *.
(xtensa_relax_frag): Likewise.
(md_convert_frag): Likewise.
(tinsn_to_slotbuf): Likewise.
* expr.c (expr_symbol_line): Likewise.
* macro.c (define_macro): Likewise.
* macro.h (macro_struct): Likewise.
* messages.c (as_show_where): Likewise.
* read.c (s_macro): Likewise.
* stabs.c (stabs_generate_asm_file): Likewise.
(generate_asm_file): Likewise.
(stabs_generate_asm_lineno): Likewise.
* write.h (struct reloc_list): Likewise.
* input-scrub.c (as_where): Change return type to const char *.
* as.h (as_wheree): Adjust.
Diffstat (limited to 'gas/input-scrub.c')
-rw-r--r-- | gas/input-scrub.c | 34 |
1 files changed, 16 insertions, 18 deletions
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; } } |