aboutsummaryrefslogtreecommitdiff
path: root/gas/app.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>1993-11-28 06:54:04 +0000
committerJeff Law <law@redhat.com>1993-11-28 06:54:04 +0000
commit385ce4337dd40f5c7c038bc443c787384de1880a (patch)
treeeabf82c76412fa9836d8363c8249cfb67d2d7db1 /gas/app.c
parent5f74c940427d0df5814e886582971072440010dc (diff)
downloadgdb-385ce4337dd40f5c7c038bc443c787384de1880a.zip
gdb-385ce4337dd40f5c7c038bc443c787384de1880a.tar.gz
gdb-385ce4337dd40f5c7c038bc443c787384de1880a.tar.bz2
* read.c (read_a_source_file): Fix test for when to stick a colon
on the end of a label. Make code conditional on either MRI or LABELS_WITHOUT_COLONS. * app.c (do_scrub_next_char): If a line begins with whitespace, leave the single whitespace character alone. Eat all others. * config/tc-hppa.h (LABELS_WITHOUT_COLONS): Define.
Diffstat (limited to 'gas/app.c')
-rw-r--r--gas/app.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/gas/app.c b/gas/app.c
index 28f2b18..f518eb5 100644
--- a/gas/app.c
+++ b/gas/app.c
@@ -53,6 +53,8 @@ static const char symbol_chars[] =
#define IS_LINE_COMMENT(c) (lex[c] == LEX_IS_LINE_COMMENT_START)
#define IS_NEWLINE(c) (lex[c] == LEX_IS_NEWLINE)
+static int process_escape PARAMS ((int));
+
/* FIXME-soon: The entire lexer/parser thingy should be
built statically at compile time rather than dynamically
each and every time the assembler is run. xoxorich. */
@@ -210,9 +212,9 @@ app_pop (arg)
/* @@ This assumes that \n &c are the same on host and target. This is not
necessarily true. */
-int
+static int
process_escape (ch)
- char ch;
+ int ch;
{
switch (ch)
{
@@ -261,6 +263,7 @@ do_scrub_next_char (get, unget)
Taylor, ian@cygnus.com. */
register int ch, ch2 = 0;
+ int not_cpp_line = 0;
switch (state)
{
@@ -359,9 +362,6 @@ do_scrub_next_char (get, unget)
case '"':
case '\\':
-#ifdef TC_HPPA
- case 'x': /* '\\x' introduces escaped sequences on the PA */
-#endif
case 'b':
case 'f':
case 'n':
@@ -370,6 +370,8 @@ do_scrub_next_char (get, unget)
#ifdef BACKSLASH_V
case 'v':
#endif /* BACKSLASH_V */
+ case 'x':
+ case 'X':
case '0':
case '1':
case '2':
@@ -425,13 +427,24 @@ recycle:
{
case LEX_IS_WHITESPACE:
do
- ch = (*get) ();
+ /* Preserve a single whitespace character at the beginning of
+ a line. */
+ if (state == 0)
+ {
+ state = 1;
+ return ch;
+ }
+ else
+ ch = (*get) ();
while (ch != EOF && IS_WHITESPACE (ch));
if (ch == EOF)
return ch;
if (IS_COMMENT (ch) || (state == 0 && IS_LINE_COMMENT (ch)) || ch == '/' || IS_LINE_SEPARATOR (ch))
{
+ /* cpp never outputs a leading space before the #, so try to
+ avoid being confused. */
+ not_cpp_line = 1;
goto recycle;
}
#ifdef MRI
@@ -455,7 +468,9 @@ recycle:
state++;
goto recycle; /* Punted leading sp */
case 1:
- BAD_CASE (state); /* We can't get here */
+ /* We can arrive here if we leave a leading whitespace character
+ at the beginning of a line. */
+ goto recycle;
case 2:
state = 3;
(*unget) (ch);
@@ -600,6 +615,9 @@ recycle:
}
} /* bad hack */
+ if (ch != '#')
+ not_cpp_line = 1;
+
do
ch = (*get) ();
while (ch != EOF && IS_WHITESPACE (ch));
@@ -608,7 +626,7 @@ recycle:
as_warn ("EOF in comment: Newline inserted");
return '\n';
}
- if (ch < '0' || ch > '9')
+ if (ch < '0' || ch > '9' || not_cpp_line)
{
/* Non-numerics: Eat whole comment line */
while (ch != EOF && !IS_NEWLINE (ch))