PATCH: gas/r9966: "as -alm" gives wrong listing when reading from STDIN
H.J. Lu
hongjiu.lu@intel.com
Mon Mar 23 17:43:00 GMT 2009
We don't handle `\\"' and ';' properly when generating listing from
STDIN. This patch fixes it. OK to install?
Thanks.
H.J.
---
2009-03-23 H.J. Lu <hongjiu.lu@intel.com>
PR gas/r9966
* listing.c (listing_newline): Properly handle `\\"' and ';'.
* read.c (is_end_of_line): Update comments for line separator.
(read_begin): Set line separator in is_end_of_line to 2.
--- gas/listing.c.pr9966 2008-10-06 18:00:16.000000000 -0700
+++ gas/listing.c 2009-03-23 10:40:16.000000000 -0700
@@ -338,13 +338,18 @@ listing_newline (char *ps)
char *copy;
int len;
int seen_quote = 0;
+ int seen_slash = 0;
for (copy = input_line_pointer - 1;
*copy && (seen_quote
- || (! is_end_of_line [(unsigned char) *copy]));
+ || is_end_of_line [(unsigned char) *copy] != 1);
copy++)
- if (*copy == '"' && copy[-1] != '\\')
- seen_quote = ! seen_quote;
+ {
+ if (*copy == '\\')
+ seen_slash = ! seen_slash;
+ if (*copy == '"' && seen_slash)
+ seen_quote = ! seen_quote;
+ }
len = (copy - input_line_pointer) + 2;
--- gas/read.c.pr9966 2009-03-09 09:14:31.000000000 -0700
+++ gas/read.c 2009-03-23 10:23:41.000000000 -0700
@@ -125,7 +125,8 @@ char lex_type[256] = {
};
/* In: a character.
- Out: 1 if this character ends a line. */
+ Out: 1 if this character ends a line.
+ 2 if this character is a line separator. */
char is_end_of_line[256] = {
#ifdef CR_EOL
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, /* @abcdefghijklmno */
@@ -239,7 +240,7 @@ read_begin (void)
/* Use machine dependent syntax. */
for (p = line_separator_chars; *p; p++)
- is_end_of_line[(unsigned char) *p] = 1;
+ is_end_of_line[(unsigned char) *p] = 2;
/* Use more. FIXME-SOMEDAY. */
if (flag_mri)
More information about the Binutils
mailing list