From d67ffd56e13eaa14f522a1edc592d69da3bc66a1 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 24 Mar 2009 01:04:25 +0000 Subject: [PATCH] 2009-03-23 H.J. Lu PR gas/9966 * 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/ChangeLog | 8 ++++++++ gas/listing.c | 11 ++++++++--- gas/read.c | 5 +++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 103d442144c..eb9b7422a4f 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +2009-03-23 H.J. Lu + + PR gas/9966 + * 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. + 2009-03-19 David S. Miller * config/tc-sparc.c (md_parse_option): If the user gives diff --git a/gas/listing.c b/gas/listing.c index 025a2ca6742..e307be21c9a 100644 --- a/gas/listing.c +++ b/gas/listing.c @@ -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; + else if (*copy == '"' && seen_slash) + seen_quote = ! seen_quote; + } len = (copy - input_line_pointer) + 2; diff --git a/gas/read.c b/gas/read.c index 863a6ac13db..184dba7ebdc 100644 --- a/gas/read.c +++ b/gas/read.c @@ -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) -- 2.30.2