diff options
Diffstat (limited to 'contrib/binutils/gas/input-scrub.c')
-rw-r--r-- | contrib/binutils/gas/input-scrub.c | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/contrib/binutils/gas/input-scrub.c b/contrib/binutils/gas/input-scrub.c index fee00f3..ecbdaef 100644 --- a/contrib/binutils/gas/input-scrub.c +++ b/contrib/binutils/gas/input-scrub.c @@ -23,6 +23,7 @@ #include "as.h" #include "input-file.h" #include "sb.h" +#include "listing.h" /* * O/S independent module to supply buffers of sanitised source code @@ -73,6 +74,9 @@ static int sb_index = -1; /* If we are reading from an sb structure, this is it. */ static sb from_sb; +/* Should we do a conditional check on from_sb? */ +static int from_sb_is_expansion = 1; + /* The number of nested sb structures we have included. */ int macro_nest; @@ -110,6 +114,7 @@ struct input_save int logical_input_line; int sb_index; sb from_sb; + int from_sb_is_expansion; /* Should we do a conditional check? */ struct input_save *next_saved_file; /* Chain of input_saves */ char *input_file_save; /* Saved state of input routines */ char *saved_position; /* Caller's saved position in buf */ @@ -146,6 +151,7 @@ input_scrub_push (saved_position) saved->logical_input_line = logical_input_line; saved->sb_index = sb_index; saved->from_sb = from_sb; + saved->from_sb_is_expansion = from_sb_is_expansion; memcpy (saved->save_source, save_source, sizeof (save_source)); saved->next_saved_file = next_saved_file; saved->input_file_save = input_file_push (); @@ -180,6 +186,7 @@ input_scrub_pop (saved) logical_input_line = saved->logical_input_line; sb_index = saved->sb_index; from_sb = saved->from_sb; + from_sb_is_expansion = saved->from_sb_is_expansion; partial_where = saved->partial_where; partial_size = saved->partial_size; next_saved_file = saved->next_saved_file; @@ -229,7 +236,7 @@ input_scrub_new_file (filename) char *filename; { input_file_open (filename, !flag_no_comments); - physical_input_file = filename[0] ? filename : "{standard input}"; + physical_input_file = filename[0] ? filename : _("{standard input}"); physical_input_line = 0; partial_size = 0; @@ -254,17 +261,26 @@ input_scrub_include_file (filename, position) expanding a macro. */ void -input_scrub_include_sb (from, position) +input_scrub_include_sb (from, position, is_expansion) sb *from; char *position; + int is_expansion; { if (macro_nest > max_macro_nest) - as_fatal ("macros nested too deeply"); + as_fatal (_("buffers nested too deeply")); ++macro_nest; +#ifdef md_macro_start + if (is_expansion) + { + md_macro_start (); + } +#endif + next_saved_file = input_scrub_push (position); sb_new (&from_sb); + from_sb_is_expansion = is_expansion; if (from->len >= 1 && from->ptr[0] != '\n') { /* Add the sentinel required by read.c. */ @@ -296,8 +312,15 @@ input_scrub_next_buffer (bufp) if (sb_index >= from_sb.len) { sb_kill (&from_sb); - cond_finish_check (macro_nest); - --macro_nest; + if (from_sb_is_expansion) + { + cond_finish_check (macro_nest); +#ifdef md_macro_end + /* allow the target to clean up per-macro expansion data */ + md_macro_end (); +#endif + } + --macro_nest; partial_where = NULL; if (next_saved_file != NULL) *bufp = input_scrub_pop (next_saved_file); @@ -345,7 +368,7 @@ input_scrub_next_buffer (bufp) if (limit == NULL) { - as_warn ("partial line at end of file ignored"); + as_warn (_("partial line at end of file ignored")); partial_where = NULL; if (next_saved_file) *bufp = input_scrub_pop (next_saved_file); @@ -367,8 +390,12 @@ input_scrub_next_buffer (bufp) partial_where = 0; if (partial_size > 0) { - as_warn ("Partial line at end of file ignored"); + as_warn (_("Partial line at end of file ignored")); } + + /* Tell the listing we've finished the file. */ + LISTING_EOF (); + /* If we should pop to another file at EOF, do it. */ if (next_saved_file) { |