summaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2009-10-15 10:58:34 +0000
committerAlan Modra <amodra@bigpond.net.au>2009-10-15 10:58:34 +0000
commitf0d1a35ab0a01a472d3638dd0ba4ccf0b04b7c19 (patch)
tree6fb9f3678aa908b359fa3db9ecc92dcd29e42531 /gas/read.c
parentb8b053cc877106c4ffe97846a5151a0cb7dc53cb (diff)
downloadbinutils-redhat-f0d1a35ab0a01a472d3638dd0ba4ccf0b04b7c19.tar.gz
PR gas/1491
gas/ * macro.c: Delete unnecessary function declarations. (buffer_and_nest): Support multiple labels per line for LABELS_WITHOUT_COLONS targets if the labels do have colons. (free_macro): Move so that we don't need forward declaration. * read.c (read_a_source_file): Take a copy of macro expansion line before we trim labels. * listing.c (listing_newline): Adjust stdin line save for input_line_pointer still at start of line. gas/testsuite/ * gas/macros/dot.s: Don't start macro invocations is first column. * gas/macros/dot.l: Update. * gas/macros/macros.exp: Run dot test on more targets.
Diffstat (limited to 'gas/read.c')
-rw-r--r--gas/read.c74
1 files changed, 39 insertions, 35 deletions
diff --git a/gas/read.c b/gas/read.c
index cf4461e6b5..614457068a 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -620,19 +620,57 @@ read_a_source_file (char *name)
#endif
while (input_line_pointer < buffer_limit)
{
+ bfd_boolean was_new_line;
/* We have more of this buffer to parse. */
/* We now have input_line_pointer->1st char of next line.
If input_line_pointer [-1] == '\n' then we just
scanned another line: so bump line counters. */
- if (is_end_of_line[(unsigned char) input_line_pointer[-1]])
+ was_new_line = is_end_of_line[(unsigned char) input_line_pointer[-1]];
+ if (was_new_line)
{
#ifdef md_start_line_hook
md_start_line_hook ();
#endif
if (input_line_pointer[-1] == '\n')
bump_line_counters ();
+ }
+#ifndef NO_LISTING
+ /* If listing is on, and we are expanding a macro, then give
+ the listing code the contents of the expanded line. */
+ if (listing)
+ {
+ if ((listing & LISTING_MACEXP) && macro_nest > 0)
+ {
+ /* Find the end of the current expanded macro line. */
+ s = find_end_of_line (input_line_pointer, flag_m68k_mri);
+
+ if (s != last_eol)
+ {
+ char *copy;
+ int len;
+
+ last_eol = s;
+ /* Copy it for safe keeping. Also give an indication of
+ how much macro nesting is involved at this point. */
+ len = s - input_line_pointer;
+ copy = (char *) xmalloc (len + macro_nest + 2);
+ memset (copy, '>', macro_nest);
+ copy[macro_nest] = ' ';
+ memcpy (copy + macro_nest + 1, input_line_pointer, len);
+ copy[macro_nest + 1 + len] = '\0';
+
+ /* Install the line with the listing facility. */
+ listing_newline (copy);
+ }
+ }
+ else
+ listing_newline (NULL);
+ }
+#endif
+ if (was_new_line)
+ {
line_label = NULL;
if (LABELS_WITHOUT_COLONS || flag_m68k_mri)
@@ -645,7 +683,6 @@ read_a_source_file (char *name)
char c;
int mri_line_macro;
- LISTING_NEWLINE ();
HANDLE_CONDITIONAL_ASSEMBLY ();
c = get_symbol_end ();
@@ -712,39 +749,6 @@ read_a_source_file (char *name)
c = *input_line_pointer++;
while (c == '\t' || c == ' ' || c == '\f');
-#ifndef NO_LISTING
- /* If listing is on, and we are expanding a macro, then give
- the listing code the contents of the expanded line. */
- if (listing)
- {
- if ((listing & LISTING_MACEXP) && macro_nest > 0)
- {
- char *copy;
- int len;
-
- /* Find the end of the current expanded macro line. */
- s = find_end_of_line (input_line_pointer - 1, flag_m68k_mri);
-
- if (s != last_eol)
- {
- last_eol = s;
- /* Copy it for safe keeping. Also give an indication of
- how much macro nesting is involved at this point. */
- len = s - (input_line_pointer - 1);
- copy = (char *) xmalloc (len + macro_nest + 2);
- memset (copy, '>', macro_nest);
- copy[macro_nest] = ' ';
- memcpy (copy + macro_nest + 1, input_line_pointer - 1, len);
- copy[macro_nest + 1 + len] = '\0';
-
- /* Install the line with the listing facility. */
- listing_newline (copy);
- }
- }
- else
- listing_newline (NULL);
- }
-#endif
/* C is the 1st significant character.
Input_line_pointer points after that character. */
if (is_name_beginner (c))