This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR gas/11356: "as -alm" returns very long lines


On Mon, Mar 08, 2010 at 02:51:39PM -0800, H.J. Lu wrote:
> My fix for PR 9966 didn't check EOL for `\`.  This patc fixes it.  OK
> to install?

No, your logic is still incorrect.  A backslash quote always lasts for
exactly one char so the bug was that seen_slash stayed set.  I think
the following is right.

	PR gas/11356
	* listing.c (listing_newline): Correct backslash quote logic.

Index: gas/listing.c
===================================================================
RCS file: /cvs/src/src/gas/listing.c,v
retrieving revision 1.46
diff -u -p -r1.46 listing.c
--- gas/listing.c	12 Jan 2010 01:10:55 -0000	1.46
+++ gas/listing.c	9 Mar 2010 00:36:10 -0000
@@ -347,10 +347,12 @@ listing_newline (char *ps)
 			 || is_end_of_line [(unsigned char) *copy] != 1);
 	       copy++)
 	    {
-	      if (*copy == '\\')
-		seen_slash = ! seen_slash;
-	      else if (*copy == '"' && seen_slash)
-		seen_quote = ! seen_quote;
+	      if (seen_slash)
+		seen_slash = 0;
+	      else if (*copy == '\\')
+		seen_slash = 1;
+	      else if (*copy == '"')
+		seen_quote = !seen_quote;
 	    }
 
 	  len = copy - input_line_pointer + 1;

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]