Commit aac02f4e by Richard Henderson Committed by Richard Henderson

c-parse.in: Revert last change.

        * c-parse.in: Revert last change.
        (init_reswords): Do not enter disabled keywords into the ridpointers
        table, modulo objc weirdness.
        (_yylex): Return the canonical spelling for a keyword.

From-SVN: r36303
parent 75d8aea7
2000-09-10 Richard Henderson <rth@cygnus.com>
* c-parse.in: Revert last change.
(init_reswords): Do not enter disabled keywords into the ridpointers
table, modulo objc weirdness.
(_yylex): Return the canonical spelling for a keyword.
2000-09-10 Philip Blundell <philb@gnu.org> 2000-09-10 Philip Blundell <philb@gnu.org>
* config/arm/arm.h (CPP_ISA_SPEC): Don't define `arm' or `thumb'. * config/arm/arm.h (CPP_ISA_SPEC): Don't define `arm' or `thumb'.
......
...@@ -1901,14 +1901,14 @@ stmt: ...@@ -1901,14 +1901,14 @@ stmt:
{ stmt_count++; { stmt_count++;
emit_line_note ($<filename>-1, $<lineno>0); emit_line_note ($<filename>-1, $<lineno>0);
c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE, c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE,
$2 && C_RID_CODE ($2) == RID_VOLATILE, $2 == ridpointers[(int)RID_VOLATILE],
input_filename, lineno); } input_filename, lineno); }
/* This is the case with input operands as well. */ /* This is the case with input operands as well. */
| ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':' asm_operands ')' ';' | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':' asm_operands ')' ';'
{ stmt_count++; { stmt_count++;
emit_line_note ($<filename>-1, $<lineno>0); emit_line_note ($<filename>-1, $<lineno>0);
c_expand_asm_operands ($4, $6, $8, NULL_TREE, c_expand_asm_operands ($4, $6, $8, NULL_TREE,
$2 && C_RID_CODE ($2) == RID_VOLATILE, $2 == ridpointers[(int)RID_VOLATILE],
input_filename, lineno); } input_filename, lineno); }
/* This is the case with clobbered registers as well. */ /* This is the case with clobbered registers as well. */
| ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':' | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':'
...@@ -1916,7 +1916,7 @@ stmt: ...@@ -1916,7 +1916,7 @@ stmt:
{ stmt_count++; { stmt_count++;
emit_line_note ($<filename>-1, $<lineno>0); emit_line_note ($<filename>-1, $<lineno>0);
c_expand_asm_operands ($4, $6, $8, $10, c_expand_asm_operands ($4, $6, $8, $10,
$2 && C_RID_CODE ($2) == RID_VOLATILE, $2 == ridpointers[(int)RID_VOLATILE],
input_filename, lineno); } input_filename, lineno); }
| GOTO identifier ';' | GOTO identifier ';'
{ tree decl; { tree decl;
...@@ -3061,8 +3061,7 @@ init_reswords () ...@@ -3061,8 +3061,7 @@ init_reswords ()
{ {
unsigned int i; unsigned int i;
tree id; tree id;
int mask = (D_YES int mask = ((doing_objc_thang ? 0 : D_OBJC)
| (doing_objc_thang ? 0 : D_OBJC)
| (flag_isoc99 ? 0 : D_C89) | (flag_isoc99 ? 0 : D_C89)
| (flag_traditional ? D_TRAD : 0) | (flag_traditional ? D_TRAD : 0)
| (flag_no_asm ? (flag_isoc99 ? D_EXT : D_EXT|D_EXT89) : 0)); | (flag_no_asm ? (flag_isoc99 ? D_EXT : D_EXT|D_EXT89) : 0));
...@@ -3073,10 +3072,19 @@ init_reswords () ...@@ -3073,10 +3072,19 @@ init_reswords ()
ridpointers = (tree *) xcalloc ((int) RID_MAX, sizeof (tree)); ridpointers = (tree *) xcalloc ((int) RID_MAX, sizeof (tree));
for (i = 0; i < N_reswords; i++) for (i = 0; i < N_reswords; i++)
{ {
/* If a keyword is disabled, do not enter it into the table
and so create a canonical spelling that isn't a keyword. */
if (reswords[i].disable & mask)
continue;
id = get_identifier (reswords[i].word); id = get_identifier (reswords[i].word);
C_RID_CODE (id) = reswords[i].rid; C_RID_CODE (id) = reswords[i].rid;
ridpointers [(int) reswords[i].rid] = id; ridpointers [(int) reswords[i].rid] = id;
if (! (reswords[i].disable & mask))
/* Objective C does tricky things with enabling and disabling
keywords. So these we must not elide in the test above, but
wait and not mark them reserved now. */
if (! (reswords[i].disable & D_YES))
C_IS_RESERVED_WORD (id) = 1; C_IS_RESERVED_WORD (id) = 1;
} }
} }
...@@ -3219,7 +3227,12 @@ _yylex () ...@@ -3219,7 +3227,12 @@ _yylex ()
case CPP_NAME: case CPP_NAME:
if (C_IS_RESERVED_WORD (yylval.ttype)) if (C_IS_RESERVED_WORD (yylval.ttype))
return rid_to_yy[C_RID_CODE (yylval.ttype)]; {
enum rid rid_code = C_RID_CODE (yylval.ttype);
/* Return the canonical spelling for this keyword. */
yylval.ttype = ridpointers[(int) rid_code];
return rid_to_yy[(int) rid_code];
}
if (IDENTIFIER_POINTER (yylval.ttype)[0] == '@') if (IDENTIFIER_POINTER (yylval.ttype)[0] == '@')
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment