* app.c (do_scrub_chars): Handle '||' in two states.
This commit is contained in:
parent
ee3fd32958
commit
b1ac4c66ea
|
@ -1,3 +1,7 @@
|
||||||
|
2003-02-19 Jie Zhang <zhangjie@magima.com.cn>
|
||||||
|
|
||||||
|
* app.c (do_scrub_chars): Handle '||' in two states.
|
||||||
|
|
||||||
2003-02-13 Alan Modra <amodra@bigpond.net.au>
|
2003-02-13 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
* write.c (TC_FORCE_RELOCATION_SUB_SAME): Revert last change.
|
* write.c (TC_FORCE_RELOCATION_SUB_SAME): Revert last change.
|
||||||
|
|
75
gas/app.c
75
gas/app.c
|
@ -1,6 +1,6 @@
|
||||||
/* This is the Assembler Pre-Processor
|
/* This is the Assembler Pre-Processor
|
||||||
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
||||||
1999, 2000, 2002
|
1999, 2000, 2002, 2003
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GAS, the GNU Assembler.
|
This file is part of GAS, the GNU Assembler.
|
||||||
|
@ -189,7 +189,7 @@ do_scrub_begin (m68k_mri)
|
||||||
lex[';'] = LEX_IS_COMMENT_START;
|
lex[';'] = LEX_IS_COMMENT_START;
|
||||||
lex['*'] = LEX_IS_LINE_COMMENT_START;
|
lex['*'] = LEX_IS_LINE_COMMENT_START;
|
||||||
/* The MRI documentation says '!' is LEX_IS_COMMENT_START, but
|
/* The MRI documentation says '!' is LEX_IS_COMMENT_START, but
|
||||||
then it can't be used in an expression. */
|
then it can't be used in an expression. */
|
||||||
lex['!'] = LEX_IS_LINE_COMMENT_START;
|
lex['!'] = LEX_IS_LINE_COMMENT_START;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -377,10 +377,12 @@ do_scrub_chars (get, tostart, tolen)
|
||||||
-1: output string in out_string and go to the state in old_state
|
-1: output string in out_string and go to the state in old_state
|
||||||
-2: flush text until a '*' '/' is seen, then go to state old_state
|
-2: flush text until a '*' '/' is seen, then go to state old_state
|
||||||
#ifdef TC_V850
|
#ifdef TC_V850
|
||||||
12: After seeing a dash, looking for a second dash as a start of comment.
|
12: After seeing a dash, looking for a second dash as a start
|
||||||
|
of comment.
|
||||||
#endif
|
#endif
|
||||||
#ifdef DOUBLEBAR_PARALLEL
|
#ifdef DOUBLEBAR_PARALLEL
|
||||||
13: After seeing a vertical bar, looking for a second vertical bar as a parallel expression seperator.
|
13: After seeing a vertical bar, looking for a second
|
||||||
|
vertical bar as a parallel expression separator.
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -450,8 +452,8 @@ do_scrub_chars (get, tostart, tolen)
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
/* The cases in this switch end with continue, in order to
|
/* The cases in this switch end with continue, in order to
|
||||||
branch back to the top of this while loop and generate the
|
branch back to the top of this while loop and generate the
|
||||||
next output character in the appropriate state. */
|
next output character in the appropriate state. */
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
|
@ -534,9 +536,9 @@ do_scrub_chars (get, tostart, tolen)
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
/* We are going to copy everything up to a quote character,
|
/* We are going to copy everything up to a quote character,
|
||||||
with special handling for a backslash. We try to
|
with special handling for a backslash. We try to
|
||||||
optimize the copying in the simple case without using the
|
optimize the copying in the simple case without using the
|
||||||
GET and PUT macros. */
|
GET and PUT macros. */
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
int len;
|
int len;
|
||||||
|
@ -545,7 +547,7 @@ do_scrub_chars (get, tostart, tolen)
|
||||||
{
|
{
|
||||||
ch = *s;
|
ch = *s;
|
||||||
/* This condition must be changed if the type of any
|
/* This condition must be changed if the type of any
|
||||||
other character can be LEX_IS_STRINGQUOTE. */
|
other character can be LEX_IS_STRINGQUOTE. */
|
||||||
if (ch == '\\'
|
if (ch == '\\'
|
||||||
|| ch == '"'
|
|| ch == '"'
|
||||||
|| ch == '\''
|
|| ch == '\''
|
||||||
|
@ -663,6 +665,19 @@ do_scrub_chars (get, tostart, tolen)
|
||||||
state = 0;
|
state = 0;
|
||||||
PUT (ch);
|
PUT (ch);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
#ifdef DOUBLEBAR_PARALLEL
|
||||||
|
case 13:
|
||||||
|
ch = GET ();
|
||||||
|
if (ch != '|')
|
||||||
|
abort ();
|
||||||
|
|
||||||
|
/* Reset back to state 1 and pretend that we are parsing a
|
||||||
|
line from just after the first white space. */
|
||||||
|
state = 1;
|
||||||
|
PUT ('|');
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OK, we are somewhere in states 0 through 4 or 9 through 11 */
|
/* OK, we are somewhere in states 0 through 4 or 9 through 11 */
|
||||||
|
@ -703,9 +718,9 @@ do_scrub_chars (get, tostart, tolen)
|
||||||
|
|
||||||
#ifdef TC_M68K
|
#ifdef TC_M68K
|
||||||
/* We want to have pseudo-ops which control whether we are in
|
/* We want to have pseudo-ops which control whether we are in
|
||||||
MRI mode or not. Unfortunately, since m68k MRI mode affects
|
MRI mode or not. Unfortunately, since m68k MRI mode affects
|
||||||
the scrubber, that means that we need a special purpose
|
the scrubber, that means that we need a special purpose
|
||||||
recognizer here. */
|
recognizer here. */
|
||||||
if (mri_state == NULL)
|
if (mri_state == NULL)
|
||||||
{
|
{
|
||||||
if ((state == 0 || state == 1)
|
if ((state == 0 || state == 1)
|
||||||
|
@ -742,14 +757,14 @@ do_scrub_chars (get, tostart, tolen)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We've read the entire pseudo-op. mips_last_ch is
|
/* We've read the entire pseudo-op. mips_last_ch is
|
||||||
either '0' or '1' indicating whether to enter or
|
either '0' or '1' indicating whether to enter or
|
||||||
leave MRI mode. */
|
leave MRI mode. */
|
||||||
do_scrub_begin (mri_last_ch == '1');
|
do_scrub_begin (mri_last_ch == '1');
|
||||||
mri_state = NULL;
|
mri_state = NULL;
|
||||||
|
|
||||||
/* We continue handling the character as usual. The
|
/* We continue handling the character as usual. The
|
||||||
main gas reader must also handle the .mri pseudo-op
|
main gas reader must also handle the .mri pseudo-op
|
||||||
to control expression parsing and the like. */
|
to control expression parsing and the like. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -790,7 +805,7 @@ do_scrub_chars (get, tostart, tolen)
|
||||||
if (lex[ch] == LEX_IS_COLON)
|
if (lex[ch] == LEX_IS_COLON)
|
||||||
{
|
{
|
||||||
/* Only keep this white if there's no white *after* the
|
/* Only keep this white if there's no white *after* the
|
||||||
colon. */
|
colon. */
|
||||||
ch2 = GET ();
|
ch2 = GET ();
|
||||||
UNGET (ch2);
|
UNGET (ch2);
|
||||||
if (!IS_WHITESPACE (ch2))
|
if (!IS_WHITESPACE (ch2))
|
||||||
|
@ -878,9 +893,9 @@ do_scrub_chars (get, tostart, tolen)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We know that ch is not ':', since we tested that
|
/* We know that ch is not ':', since we tested that
|
||||||
case above. Therefore this is not a label, so it
|
case above. Therefore this is not a label, so it
|
||||||
must be the opcode, and we've just seen the
|
must be the opcode, and we've just seen the
|
||||||
whitespace after it. */
|
whitespace after it. */
|
||||||
state = 3;
|
state = 3;
|
||||||
}
|
}
|
||||||
UNGET (ch);
|
UNGET (ch);
|
||||||
|
@ -912,7 +927,7 @@ do_scrub_chars (get, tostart, tolen)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* This UNGET will ensure that we count newlines
|
/* This UNGET will ensure that we count newlines
|
||||||
correctly. */
|
correctly. */
|
||||||
UNGET (ch2);
|
UNGET (ch2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -956,7 +971,7 @@ do_scrub_chars (get, tostart, tolen)
|
||||||
PUT (' ');
|
PUT (' ');
|
||||||
|
|
||||||
/* PUT didn't jump out. We could just break, but we
|
/* PUT didn't jump out. We could just break, but we
|
||||||
know what will happen, so optimize a bit. */
|
know what will happen, so optimize a bit. */
|
||||||
ch = GET ();
|
ch = GET ();
|
||||||
old_state = 3;
|
old_state = 3;
|
||||||
}
|
}
|
||||||
|
@ -1078,15 +1093,15 @@ do_scrub_chars (get, tostart, tolen)
|
||||||
#ifdef DOUBLEBAR_PARALLEL
|
#ifdef DOUBLEBAR_PARALLEL
|
||||||
case LEX_IS_DOUBLEBAR_1ST:
|
case LEX_IS_DOUBLEBAR_1ST:
|
||||||
ch2 = GET ();
|
ch2 = GET ();
|
||||||
|
UNGET (ch2);
|
||||||
if (ch2 != '|')
|
if (ch2 != '|')
|
||||||
{
|
{
|
||||||
UNGET (ch2);
|
|
||||||
goto de_fault;
|
goto de_fault;
|
||||||
}
|
}
|
||||||
/* Reset back to state 1 and pretend that we are parsing a line from
|
/* Handle '||' in two states as invoking PUT twice might
|
||||||
just after the first white space. */
|
result in the first one jumping out of this loop. We'd
|
||||||
state = 1;
|
then lose track of the state and one '|' char. */
|
||||||
PUT ('|');
|
state = 13;
|
||||||
PUT ('|');
|
PUT ('|');
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1219,7 +1234,7 @@ do_scrub_chars (get, tostart, tolen)
|
||||||
state = 9;
|
state = 9;
|
||||||
|
|
||||||
/* This is a common case. Quickly copy CH and all the
|
/* This is a common case. Quickly copy CH and all the
|
||||||
following symbol component or normal characters. */
|
following symbol component or normal characters. */
|
||||||
if (to + 1 < toend
|
if (to + 1 < toend
|
||||||
&& mri_state == NULL
|
&& mri_state == NULL
|
||||||
#if defined TC_ARM && defined OBJ_ELF
|
#if defined TC_ARM && defined OBJ_ELF
|
||||||
|
@ -1243,7 +1258,7 @@ do_scrub_chars (get, tostart, tolen)
|
||||||
if (s > from)
|
if (s > from)
|
||||||
{
|
{
|
||||||
/* Handle the last character normally, for
|
/* Handle the last character normally, for
|
||||||
simplicity. */
|
simplicity. */
|
||||||
--s;
|
--s;
|
||||||
}
|
}
|
||||||
len = s - from;
|
len = s - from;
|
||||||
|
|
Loading…
Reference in New Issue