aboutsummaryrefslogtreecommitdiff
path: root/gas/macro.h
AgeCommit message (Collapse)AuthorFilesLines
2023-03-17gas: expose flag_macro_alternate globallyJan Beulich1-2/+1
Yet again with the removal of gasp about 20 years ago this extra level of indirection isn't necessary anymore either. Drop macro.c's local variable and make as.c's global. While doing the conversion, switch the variable to "bool".
2023-03-17gas: use flag_mri directly in macro processingJan Beulich1-2/+1
Again with the removal of gasp about 20 years ago the extra level of indirection isn't necessary anymore. Drop macro.c's local variable and use the global flag directly.
2023-03-17gas: isolate macro_strip_at to macro.cJan Beulich1-1/+1
This removes a leftover from i960 support; with that nothing is left which would set macro_strip_at to non-zero, so the variable is converted to a #define (retaining the logic in case a new user would appear) and macro_init()'s respective parameter is dropped.
2023-03-17gas: drop function pointer parameter from macro_init()Jan Beulich1-2/+1
With the removal of gasp (about 20 years ago) the need for this kind- of-hook has disappeared. Go a step beyond merely moving the to be called function: Inline its contents right at the sole call site.
2023-01-27gas macro memory leaksAlan Modra1-2/+1
This tidies memory allocated for entries in macro_hash. Freeing the macro name requires a little restructuring of the define_macro interface due to the name being used in the error message, and exposed the fact that the name and other fields were not initialised by the iq2000 backend. There is also a fix for .macro .macro .endm .macro .macro .endm which prior to this patch reported mac.s:1: Warning: attempt to redefine pseudo-op `.macro' ignored mac.s:3: Error: Macro `.macro' was already defined rather than reporting the attempt to redefine twice. * macro.c (macro_del_f): New function. (macro_init): Use it when creating macro_hash. (free_macro): Free macro name too. (define_macro): Return the macro_entry, remove idx, file, line and namep params. Call as_where. Report errors here. Delete macro from macro_hash on attempt to redefined pseudo-op. (delete_macro): Don't call free_macro. * macro.h (define_macro): Update prototype. * read.c (s_macro): Adjust to suit. * config/tc-iq2000.c (iq2000_add_macro): Init all fields of macro_entry.
2023-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
The newer update-copyright.py fixes file encoding too, removing cr/lf on binutils/bfdtest2.c and ld/testsuite/ld-cygwin/exe-export.exp, and embedded cr in binutils/testsuite/binutils-all/ar.exp string match.
2022-07-09gas: free sy_hash, macro_hash and po_hashAlan Modra1-0/+1
* macro.c (macro_end): New function. * macro.h (macro_end): Declare. * read.c (read_end, poend): New functions. * read.h (read_end): Declare. * symbols.c (symbol_end): New function. * symbols.h (symbol_end): Declare. * output-file.c (output_file_close): Call new *_end functions.
2022-07-09macro.c: use string hash from hash.h for macro_hashAlan Modra1-94/+4
Another case of duplicated hash.h code, the only minor difference being that macro->format_hash was created with 7 entries vs. str_hash with 16 entries. * macro.c (macro_init, define_macro): Use str_htab_create. (do_formals, define_macro, macro_expand_body): Use str_hash_insert (macro_expand_body): Use str_hash_find and str_hash_delete. (delete_macro): Likewise. (sub_actual, macro_expand, check_macro): Use str_hash_find. (expand_irp): Use str_htab_create and str_hash_insert. * macro.h (struct macro_struct): Tidy. (struct macro_hash_entry, macro_hash_entry_t, hash_macro_entry), (eq_macro_entry, macro_entry_alloc, macro_entry_find), (struct formal_hash_entry, formal_hash_entry_t), (hash_formal_entry, eq_formal_entry, formal_entry_alloc), (formal_entry_find): Delete. * config/tc-iq2000.c (iq2000_add_macro): Use str_htab_create and str_hash_insert.
2022-01-02Update year range in copyright notice of binutils filesAlan Modra1-1/+1
The result of running etc/update-copyright.py --this-year, fixing all the files whose mode is changed by the script, plus a build with --enable-maintainer-mode --enable-cgen-maint=yes, then checking out */po/*.pot which we don't update frequently. The copy of cgen was with commit d1dd5fcc38ead reverted as that commit breaks building of bfp opcodes files.
2021-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2020-08-20Use libiberty hash in gas/macro.c.Martin Liska1-2/+92
* config/tc-iq2000.c (iq2000_add_macro): Use htab hash table. * macro.c (struct hash_control): Use htab. (macro_init): Likewise. (do_formals): Likewise. (free_macro): Likewise. (define_macro): Likewise. (sub_actual): Likewise. (macro_expand_body): Likewise. (macro_expand): Likewise. (check_macro): Likewise. (delete_macro): Likewise. (expand_irp): Likewise. * macro.h (struct macro_hash_entry): New struct. (hash_macro_entry): New. (eq_macro_entry): Likewise. (macro_entry_alloc): Likewise. (macro_entry_find): Likewise. (struct formal_hash_entry): Likewise. (hash_formal_entry): Likewise. (eq_formal_entry): Likewise. (formal_entry_alloc): Likewise. (formal_entry_find): Likewise.
2020-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2019-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2018-01-03Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2017-01-02Update year range in copyright notice of all files.Alan Modra1-1/+1
2016-02-22Add more const type qualifiers to GAS sources.Trevor Saunders1-2/+2
* 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-01-01Copyright update for binutilsAlan Modra1-1/+1
2015-01-02ChangeLog rotatation and copyright year updateAlan Modra1-1/+1
2014-03-05Update copyright yearsAlan Modra1-2/+1
2012-06-07 PR gas/14201Alan Modra1-7/+8
* sb.h (sb_max_power_two): Delete. (struct sb): Delete "item" and "pot". Make "len" a size_t. Add "max". (sb_element): Delete. (sb_add_char, sb_add_buffer, sb_skip_comma, sb_skip_write): Update prototypes. * sb.c (string_count, free_list): Delete. (sb_build, sb_kill, sb_check): Rewrite. (scrub_from_sb, sb_add_char, sb_add_string, sb_add_buffer, sb_skip_white, sb_skip_comma): Replace assorted int params, vars and return types with size_t. * input-scrub.c: Likewise. * macro.c: Likewise. * macro.h: Likewise. * as.c: Likewise. * as.h: Likewise. * input-file.h: Likewise. * input-file.c: Likewise. * read.c: Likewise. * app.c: ..or ptrdiff_t. * input-file.c (input_file_get): Use ferror. (input_file_give_next_buffer): Use input_file_get.
2009-09-11 * po/bfd.pot: Updated by the Translation project.Nick Clifton1-6/+8
* po/binutils.pot: Updated by the Translation project. * po/gold.pot: Updated by the Translation project. * po/gold.pot: Updated by the Translation project. * po/gprof.pot: Updated by the Translation project. * po/sv.po: Updated Swedish translation. * po/ld.pot: Updated by the Translation project. * po/fi.po: Updated Finnish translation. * po/ld.pot: Updated by the Translation project. * po/fi.po: Updated Finnish translation. Updated sources to compile cleanly with -Wc++-compat: * basic_blocks.c: Add casts. * cg_dfn.c: Add cast. * corefile.c: Add casts. * gmon_io.c: Add casts. * hist.c: Add cast. * source.c: Add cast. * sym_ids.c (struct match): Moved to top level. Updated soruces in ld/* to compile cleanly with -Wc++-compat: * ld.h (enum endian_enum,enum symbolic_enum,enum dynamic_list_enum): Move to top level. * ldcref.c: Add casts. * ldctor.c: Add casts. * ldexp.c * ldexp.h (enum node_tree_enum,enum phase_enum): Move to top level. * ldlang.c: Add casts. (lang_insert_orphan): Use enum name instead of integer. * ldlang.h (enum statement_enum): Move to top level. * ldmain.c: Add casts. * ldwrite.c: Add casts. * lexsup.c: Add casts. (enum control_enum): Move to top level. * mri.c: Add casts. (mri_draw_tree): Use enum name instead of integer. Updated sources to compile cleanly with -Wc++-compat: * basic_blocks.c: Add casts. * cg_dfn.c: Add cast. * corefile.c: Add casts. * gmon_io.c: Add casts. * hist.c: Add cast. * source.c: Add cast. * sym_ids.c (struct match): Moved to top level. * as.c (main): Call dwarf2_init. * config/obj-elf.c (struct group_list): New field. (build_group_lists): Use hash lookup. (free_section_idx): New function. (elf_frob_file): Adjust. * dwarf2dbg.c (all_segs_hash, last_seg_ptr): New variables. (get_line_subseg): Adjust. (dwarf2_init): New function. * dwarf2dbg.h (dwarf2_init): New declaration.
2009-09-02update copyright datesAlan Modra1-1/+1
2007-07-03Switch to GPLv3Nick Clifton1-3/+3
2006-06-07remove some duplicate #include's.Alan Modra1-4/+1
2005-05-06gas/Jan Beulich1-0/+6
2005-05-06 Jan Beulich <jbeulich@novell.com> * macro.c (new_formal, del_formal): New. (do_formals): Use new_formal. Check for and parse qualifier. Warn if required argument has default value. Stop looking for more formal when there was a vararg one. (macro_expand_body): Use new_formal and del_formal. (macro_expand): Likewise. Initialize local variable err. Don't return immediately when encountering an error. Warn when keyword argument already had a value assigned. Eliminate duplicate clearing of argument value. When current positional argument matches parameter of vararg type, assign to it all the remaining arguments. Issue error when required parameter does not have value. (free_macro): Use del_formal. (expand_irp): Initialize formal type. Free buffers associated with formal prior to returning. * macro.h (struct formal_struct): Add new field 'type' with new enumeration type 'formal_type'. * doc/as.texinfo: Document macro parameter qualifiers. * NEWS: Mention new functionality. gas/testsuite/ 2005-05-06 Jan Beulich <jbeulich@novell.com> * gas/macros/badarg.s: Add check for bad qualifier specification. * gas/macros/badarg.l: Adjust. * gas/macros/vararg.[sd]: New. * gas/macros/macros.exp: Run new test.
2005-05-05Update the address and phone number of the FSFNick Clifton1-2/+2
2005-05-03* config/obj-ecoff.c (ecoff_frob_file_before_fix): Fix invocations of ↵Nick Clifton1-0/+4
bfd_section_list... macros. * config/tc-mmix.c (mmix_frob_file): Likewise. * config/tc-xtensa.c (xtensa_remove_section): Likewise. (xtensa_insert_section): Likewise. * macro.c (macro_hash): Remove static. * macro.h (macro_hash): Provide an external declaration.
2005-04-25gas/Jan Beulich1-1/+4
2005-04-25 Jan Beulich <jbeulich@novell.com> * macro.c (macro_expand_body): Replace locals indicator parameters with actual macro_entry. New local variables macro_line and err. Don't return when encountering an error, just record the fact. Detect local symbol name colliding with parameter. Track line number inside of macro expansion. (do_formals): Move local variable name to wider scope. Check parameter of the same name doesn't already exist. In MRI mode, also check it doesn't collide with the argument count pseudo-parameter). (define_macro): Add file and line number parameters. Remove local variable namestr. New local variable error. Initialize macro_entry members file, line, and name. Don't return when encountering an error, just record the fact. Use %s in some diagnostics for read.c to insert the macro name. Free macro_entry on error. (macro_expand): Pass macro_entry to macro_epand_body. Don't return when encountering an error, just record the fact. (expand_irp): Don't return when encountering an error, just record the fact. * macro.h (macro_struct): New members name, file, and line. (define_macro): Add file and line number parameters. * read.c (s_macro): Pass file and line to define_macro. Tag warning regarding pseudo-op redefinition with the file/line that macro definition started at. gas/testsuite/ 2005-04-25 Jan Beulich <jbeulich@novell.com> * gas/macros/badarg.s: Add tests for collisions between/among macro parameters and local symbols. * gas/macros/badarg.l: Adjust.
2005-03-03update copyright datesAlan Modra1-1/+1
2004-08-13Add and handle new --alternate command line option.Nick Clifton1-0/+1
2003-11-24 * listing.c: Convert to ISO-C.Kazu Hirata1-12/+7
* listing.h: Likewise. * macro.c: Likewise. * macro.h: Likewise.
2003-10-27 * ChangeLog: Fix typos.Kazu Hirata1-1/+1
* ChangeLog-9295: Likewise. * as.c: Fix comment typos. * as.h: Likewise. * atof-generic.c: Likewise. * bit_fix.h: Likewise. * frags.h: Likewise. * hash.c: Likewise. * input-file.c: Likewise. * input-scrub.c: Likewise. * itbl-ops.c: Likewise. * itbl-parse.y: Likewise. * listing.c: Likewise. * macro.h: Likewise. * read.c: Likewise. * sb.c: Likewise. * sb.h: Likewise. * symbols.c: Likewise. * symbols.h: Likewise.
2002-12-02Remove GASP.Nick Clifton1-23/+24
2002-05-18 * app.c: Fix formatting.Kazu Hirata1-1/+1
* as.c: Likewise. * ehopt.c: Likewise. * expr.c: Likewise. * input-file.c: Likewise. * listing.c: Likewise. * macro.h: Likewise. * stabs.c: Likewise. * symbols.c: Likewise.
2001-03-08Fix copyright noticesNick Clifton1-1/+2
2000-11-072000-11-06 Kazu Hirata <kazu@hxi.com>Kazu Hirata1-17/+13
* as.c: Fix formatting. * dwarf2dbg.c: Likewise. * itbl-ops.c: Likewise. * listing.c: Likewise. * macro.h: Likewise. * messages.c: Likewise. * read.c: Likewise. * subsegs.c: Likewise. * subsegs.h: Likewise. * write.c: Likewise.
2000-09-122000-09-12 Kazu Hirata <kazu@hxi.com>Kazu Hirata1-9/+9
* as.h: Fix formatting. * asintl.h: Likewise. * bit_fix.h: Likewise. * dwarf2dbg.h: Likewise. * expr.h: Likewise. * flonum.h: Likewise. * frags.h: Likewise. * itbl-ops.h: Likewise. * macro.h: Likewise. * read.h: Likewise. * sb.h: Likewise. * struc-symbol.h: Likewise. * subsegs.h: Likewise. * symbols.h: Likewise. * tc.h: Likewise. * write.h: Likewise.
2000-03-26Add macro handling extensions and line substitution support.Timothy Wall1-1/+38
1999-05-0319990502 sourceware importbinu_ss_19990502Richard Henderson1-0/+53