summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/gas/input-scrub.c
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2010-11-01 19:35:33 +0000
committerdim <dim@FreeBSD.org>2010-11-01 19:35:33 +0000
commit3f5c947f4453c6016a2a6a9636367ee3f48fc6fc (patch)
tree461aafc934d462eb9b9221308f8e25238c0ada62 /contrib/binutils/gas/input-scrub.c
parente6be3e7867eb43d220575baee2ce5662fb03e46c (diff)
parentd0f678fa0ff3f08a4eca29daf4d1ac39797b6326 (diff)
downloadFreeBSD-src-3f5c947f4453c6016a2a6a9636367ee3f48fc6fc.zip
FreeBSD-src-3f5c947f4453c6016a2a6a9636367ee3f48fc6fc.tar.gz
Merge ^/vendor/binutils/dist@214571 into contrib/binutils, which brings
us up to version 2.17.50.20070703, at the last GPLv2 commit. Amongst others, this added upstream support for some FreeBSD-specific things that we previously had to manually hack in, such as the OSABI label support, and so on. There are also quite a number of new files, some for cpu's (e.g. SPU) that we may or may not be interested in, but those can be cleaned up later on, if needed.
Diffstat (limited to 'contrib/binutils/gas/input-scrub.c')
-rw-r--r--contrib/binutils/gas/input-scrub.c52
1 files changed, 43 insertions, 9 deletions
diff --git a/contrib/binutils/gas/input-scrub.c b/contrib/binutils/gas/input-scrub.c
index 8562ee2..5698a6d 100644
--- a/contrib/binutils/gas/input-scrub.c
+++ b/contrib/binutils/gas/input-scrub.c
@@ -1,6 +1,6 @@
/* input_scrub.c - Break up input buffers into whole numbers of lines.
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 2000, 2001, 2003
+ 2000, 2001, 2003, 2006, 2007
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -20,7 +20,6 @@
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
-#include <errno.h> /* Need this to make errno declaration right */
#include "as.h"
#include "input-file.h"
#include "sb.h"
@@ -57,6 +56,10 @@
#define BEFORE_SIZE (1)
#define AFTER_SIZE (1)
+#ifndef TC_EOL_IN_INSN
+#define TC_EOL_IN_INSN(P) 0
+#endif
+
static char *buffer_start; /*->1st char of full buffer area. */
static char *partial_where; /*->after last full line in buffer. */
static int partial_size; /* >=0. Number of chars in partial line in buffer. */
@@ -342,8 +345,9 @@ input_scrub_next_buffer (char **bufp)
if (limit)
{
register char *p; /* Find last newline. */
-
- for (p = limit - 1; *p != '\n'; --p)
+ /* Terminate the buffer to avoid confusing TC_EOL_IN_INSN. */
+ *limit = '\0';
+ for (p = limit - 1; *p != '\n' || TC_EOL_IN_INSN (p); --p)
;
++p;
@@ -369,7 +373,9 @@ input_scrub_next_buffer (char **bufp)
return NULL;
}
- for (p = limit - 1; *p != '\n'; --p)
+ /* Terminate the buffer to avoid confusing TC_EOL_IN_INSN. */
+ *limit = '\0';
+ for (p = limit - 1; *p != '\n' || TC_EOL_IN_INSN (p); --p)
;
++p;
}
@@ -429,13 +435,34 @@ bump_line_counters (void)
Returns nonzero if the filename actually changes. */
int
-new_logical_line (char *fname, /* DON'T destroy it! We point to it! */
- int line_number)
+new_logical_line_flags (char *fname, /* DON'T destroy it! We point to it! */
+ int line_number,
+ int flags)
{
+ switch (flags)
+ {
+ case 0:
+ break;
+ case 1:
+ if (line_number != -1)
+ abort ();
+ break;
+ case 1 << 1:
+ case 1 << 2:
+ /* FIXME: we could check that include nesting is correct. */
+ break;
+ default:
+ abort ();
+ }
+
if (line_number >= 0)
logical_input_line = line_number;
- else if (line_number == -2 && logical_input_line > 0)
- --logical_input_line;
+ else if (line_number == -1 && fname && !*fname && (flags & (1 << 2)))
+ {
+ logical_input_file = physical_input_file;
+ logical_input_line = physical_input_line;
+ fname = NULL;
+ }
if (fname
&& (logical_input_file == NULL
@@ -447,6 +474,13 @@ new_logical_line (char *fname, /* DON'T destroy it! We point to it! */
else
return 0;
}
+
+int
+new_logical_line (char *fname, int line_number)
+{
+ return new_logical_line_flags (fname, line_number, 0);
+}
+
/* Return the current file name and line number.
namep should be char * const *, but there are compilers which screw
OpenPOWER on IntegriCloud