aboutsummaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2009-10-15 10:58:34 +0000
committerAlan Modra <amodra@gmail.com>2009-10-15 10:58:34 +0000
commitf19df8f73a7bbfeb12d1540791ed51aa86b0bdf9 (patch)
treeac25f2e334b6e60122305754da1c4d0e3bdc93ab /gas/read.c
parentc44c601a50df172a963c97120ae40c25630552a5 (diff)
downloadgdb-f19df8f73a7bbfeb12d1540791ed51aa86b0bdf9.zip
gdb-f19df8f73a7bbfeb12d1540791ed51aa86b0bdf9.tar.gz
gdb-f19df8f73a7bbfeb12d1540791ed51aa86b0bdf9.tar.bz2
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 cf4461e..6144570 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))