This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[commited] Allow a line number of zero in .appline
- From: Nick Clifton <nickc at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Sun, 07 Aug 2005 11:39:59 +0100
- Subject: [commited] Allow a line number of zero in .appline
Hi Guys,
I am applying the patch below to allow line numbers of zero when
processing the .appline directive. This is because GCC will
generate such line numbers when it pre-processes an assembler file.
eg:
$ cat foo.S
nop
$ gcc -c foo.S --save-temps
foo.S:1: Warning: line numbers must be positive; line number 0 rejected
$ cat foo.s
# 1 "foo.S"
# 0 "<built-in>"
# 1 "<command line>"
# 1 "foo.S"
nop
I am not sure whether technically the number zero counts as a
positive number, but I do feel that we should accept it.
Cheers
Nick
gas/ChangeLog
2005-08-07 Nick Clifton <nickc@redhat.com>
* read.c (s_app_line): Accept a line number of 0 for compatibility
with gcc's output for assembler-with-cpp files.
Index: gas/read.c
===================================================================
RCS file: /cvs/src/src/gas/read.c,v
retrieving revision 1.104
diff -c -3 -p -r1.104 read.c
*** gas/read.c 17 May 2005 14:02:27 -0000 1.104
--- gas/read.c 7 Aug 2005 10:26:41 -0000
*************** s_app_line (int ignore ATTRIBUTE_UNUSED)
*** 1698,1706 ****
/* The given number is that of the next line. */
l = get_absolute_expression () - 1;
! if (l < 0)
/* Some of the back ends can't deal with non-positive line numbers.
! Besides, it's silly. */
as_warn (_("line numbers must be positive; line number %d rejected"),
l + 1);
else
--- 1698,1714 ----
/* The given number is that of the next line. */
l = get_absolute_expression () - 1;
!
! if (l < -1)
/* Some of the back ends can't deal with non-positive line numbers.
! Besides, it's silly. GCC however will generate a line number of
! zero when it is preprocessing builtins for assembler-with-cpp files:
!
! # 0 "<built-in>"
!
! We do not want to barf on this, especially since such files are used
! in the GCC and GDB testsuites. So we check for negative line numbers
! rather than non-positive line numbers. */
as_warn (_("line numbers must be positive; line number %d rejected"),
l + 1);
else