aboutsummaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2003-05-13 01:51:40 +0000
committerHans-Peter Nilsson <hp@axis.com>2003-05-13 01:51:40 +0000
commit64e55042d6b950bf2726aed13fe1a4eb7c88fdd7 (patch)
tree3d08d7898f217fc4414268d2a4e55c0828451475 /gas/read.c
parent03e2bd2f1f5fe0c96579ef0a17b729b4aa9a73e1 (diff)
downloadgdb-64e55042d6b950bf2726aed13fe1a4eb7c88fdd7.zip
gdb-64e55042d6b950bf2726aed13fe1a4eb7c88fdd7.tar.gz
gdb-64e55042d6b950bf2726aed13fe1a4eb7c88fdd7.tar.bz2
* read.c (old_buffer, old_input, old_limit): Remove variables.
(read_a_source_file): Delete label contin. <handling #APP/#NO_APP>: Use an "sb" to push #APP expansion into input as with macros, instead of in separate old_* variables. Zero-terminate string being scrubbed.
Diffstat (limited to 'gas/read.c')
-rw-r--r--gas/read.c44
1 files changed, 16 insertions, 28 deletions
diff --git a/gas/read.c b/gas/read.c
index 3c4c244..07f8238 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -168,10 +168,6 @@ static char *buffer_limit; /*->1 + last char in buffer. */
internals manual. */
int target_big_endian = TARGET_BYTES_BIG_ENDIAN;
-static char *old_buffer; /* JF a hack. */
-static char *old_input;
-static char *old_limit;
-
/* Variables for handling include file directory table. */
/* Table of pointers to directories to search for .include's. */
@@ -533,9 +529,7 @@ read_a_source_file (name)
while ((buffer_limit = input_scrub_next_buffer (&input_line_pointer)) != 0)
{ /* We have another line to parse. */
know (buffer_limit[-1] == '\n'); /* Must have a sentinel. */
- contin: /* JF this goto is my fault I admit it.
- Someone brave please re-write the whole
- input section here? Pleeze??? */
+
while (input_line_pointer < buffer_limit)
{
/* We have more of this buffer to parse. */
@@ -953,6 +947,7 @@ read_a_source_file (name)
if (c && strchr (line_comment_chars, c))
{ /* Its a comment. Better say APP or NO_APP. */
+ sb sbuf;
char *ends;
char *new_buf;
char *new_tmp;
@@ -965,6 +960,7 @@ read_a_source_file (name)
continue; /* We ignore it */
s += 4;
+ sb_new (&sbuf);
ends = strstr (s, "#NO_APP\n");
if (!ends)
@@ -1026,7 +1022,7 @@ read_a_source_file (name)
if (size < space)
{
- new_tmp += size;
+ new_tmp[size] = 0;
break;
}
@@ -1037,13 +1033,19 @@ read_a_source_file (name)
if (tmp_buf)
free (tmp_buf);
- old_buffer = buffer;
- old_input = input_line_pointer;
- old_limit = buffer_limit;
- buffer = new_buf;
- input_line_pointer = new_buf;
- buffer_limit = new_tmp;
+ /* We've "scrubbed" input to the preferred format. In the
+ process we may have consumed the whole of the remaining
+ file (and included files). We handle this formatted
+ input similar to that of macro expansion, letting
+ actual macro expansion (possibly nested) and other
+ input expansion work. Beware that in messages, line
+ numbers and possibly file names will be incorrect. */
+ sb_add_string (&sbuf, new_buf);
+ input_scrub_include_sb (&sbuf, input_line_pointer, 0);
+ sb_kill (&sbuf);
+ buffer_limit = input_scrub_next_buffer (&input_line_pointer);
+ free (new_buf);
continue;
}
@@ -1061,20 +1063,6 @@ read_a_source_file (name)
#ifdef md_after_pass_hook
md_after_pass_hook ();
#endif
-
- if (old_buffer)
- {
- free (buffer);
- bump_line_counters ();
- if (old_input != 0)
- {
- buffer = old_buffer;
- input_line_pointer = old_input;
- buffer_limit = old_limit;
- old_buffer = 0;
- goto contin;
- }
- }
}
quit: