PR gas/11122, C listing line numbers start at 0

Alan Modra amodra@gmail.com
Tue Jan 12 01:13:00 GMT 2010


Nick, this regression appeared with rev 1.38 of listing.c, when
caching was added and the line number stored before the increment in
buffer_line.  I only mention that because your checkin appears to lack
a ChangeLog entry, and it's a generally nice change that ought to be
credited..

	PR 11122
	* listing.c (print_source): Add one to line number.

Index: gas/listing.c
===================================================================
RCS file: /cvs/src/src/gas/listing.c,v
retrieving revision 1.45
diff -u -p -r1.45 listing.c
--- gas/listing.c	11 Dec 2009 13:42:09 -0000	1.45
+++ gas/listing.c	12 Jan 2010 00:02:42 -0000
@@ -1,6 +1,6 @@
 /* listing.c - maintain assembly listings
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009
+   2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -1047,7 +1047,7 @@ print_source (file_info_type *  current_
 
 	  cache = cached_lines + next_free_line;
 	  cache->file = current_file;
-	  cache->line = current_file->linenum;
+	  cache->line = current_file->linenum + 1;
 	  cache->buffer[0] = 0;
 	  p = buffer_line (current_file, cache->buffer, width);
 

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list