Commit 6c53ebff by Neil Booth Committed by Neil Booth

c-lex.c (c_lex): Replace tok.val.aux with tok.val.c or tok.val.arg_no as appropriate.

	* c-lex.c (c_lex): Replace tok.val.aux with tok.val.c or
	tok.val.arg_no as appropriate.
	* cppexp.c (lex): Similarly.
	* cpplex.c (_cpp_lex_token, cpp_spell_token, cpp_output_token,
	cpp_equiv_tokens, cpp_can_paste, cpp_avoid_paste): Similarly.
	* cppmacro.c (stringify_arg, replace_args, lex_expansion_token,
	cpp_macro_definition): Similarly.
	* cpplib.h (struct cpp_token): Replace aux with c and arg_no.

From-SVN: r37276
parent d1877a9b
2000-11-06 Neil Booth <neilb@earthling.net>
* c-lex.c (c_lex): Replace tok.val.aux with tok.val.c or
tok.val.arg_no as appropriate.
* cppexp.c (lex): Similarly.
* cpplex.c (_cpp_lex_token, cpp_spell_token, cpp_output_token,
cpp_equiv_tokens, cpp_can_paste, cpp_avoid_paste): Similarly.
* cppmacro.c (stringify_arg, replace_args, lex_expansion_token,
cpp_macro_definition): Similarly.
* cpplib.h (struct cpp_token): Replace aux with c and arg_no.
2000-11-06 Jakub Jelinek <jakub@redhat.com> 2000-11-06 Jakub Jelinek <jakub@redhat.com>
* config/sparc/sparc.md (adddi3): If operands[2] is 4096 and * config/sparc/sparc.md (adddi3): If operands[2] is 4096 and
......
...@@ -1440,12 +1440,12 @@ c_lex (value) ...@@ -1440,12 +1440,12 @@ c_lex (value)
case CPP_OPEN_BRACE: indent_level++; break; case CPP_OPEN_BRACE: indent_level++; break;
case CPP_CLOSE_BRACE: indent_level--; break; case CPP_CLOSE_BRACE: indent_level--; break;
/* Issue this error here, where we can get at tok.val.aux. */ /* Issue this error here, where we can get at tok.val.c. */
case CPP_OTHER: case CPP_OTHER:
if (ISGRAPH (tok.val.aux)) if (ISGRAPH (tok.val.c))
error ("stray '%c' in program", tok.val.aux); error ("stray '%c' in program", tok.val.c);
else else
error ("stray '\\%#o' in program", tok.val.aux); error ("stray '\\%#o' in program", tok.val.c);
goto retry; goto retry;
case CPP_NAME: case CPP_NAME:
......
...@@ -401,10 +401,10 @@ lex (pfile, skip_evaluation, token) ...@@ -401,10 +401,10 @@ lex (pfile, skip_evaluation, token)
SYNTAX_ERROR ("floating point numbers are not valid in #if"); SYNTAX_ERROR ("floating point numbers are not valid in #if");
case CPP_OTHER: case CPP_OTHER:
if (ISGRAPH (token->val.aux)) if (ISGRAPH (token->val.c))
SYNTAX_ERROR2 ("invalid character '%c' in #if", token->val.aux); SYNTAX_ERROR2 ("invalid character '%c' in #if", token->val.c);
else else
SYNTAX_ERROR2 ("invalid character '\\%03o' in #if", token->val.aux); SYNTAX_ERROR2 ("invalid character '\\%03o' in #if", token->val.c);
case CPP_NAME: case CPP_NAME:
if (token->val.node == pfile->spec_nodes.n_defined) if (token->val.node == pfile->spec_nodes.n_defined)
......
...@@ -1241,7 +1241,7 @@ _cpp_lex_token (pfile, result) ...@@ -1241,7 +1241,7 @@ _cpp_lex_token (pfile, result)
random_char: random_char:
default: default:
result->type = CPP_OTHER; result->type = CPP_OTHER;
result->val.aux = c; result->val.c = c;
break; break;
} }
} }
...@@ -1321,7 +1321,7 @@ cpp_spell_token (pfile, token, buffer) ...@@ -1321,7 +1321,7 @@ cpp_spell_token (pfile, token, buffer)
break; break;
case SPELL_CHAR: case SPELL_CHAR:
*buffer++ = token->val.aux; *buffer++ = token->val.c;
break; break;
case SPELL_NONE: case SPELL_NONE:
...@@ -1410,7 +1410,7 @@ cpp_output_token (token, fp) ...@@ -1410,7 +1410,7 @@ cpp_output_token (token, fp)
break; break;
case SPELL_CHAR: case SPELL_CHAR:
putc (token->val.aux, fp); putc (token->val.c, fp);
break; break;
case SPELL_NONE: case SPELL_NONE:
...@@ -1431,9 +1431,9 @@ _cpp_equiv_tokens (a, b) ...@@ -1431,9 +1431,9 @@ _cpp_equiv_tokens (a, b)
case SPELL_OPERATOR: case SPELL_OPERATOR:
return 1; return 1;
case SPELL_CHAR: case SPELL_CHAR:
return a->val.aux == b->val.aux; /* Character. */ return a->val.c == b->val.c; /* Character. */
case SPELL_NONE: case SPELL_NONE:
return (a->type != CPP_MACRO_ARG || a->val.aux == b->val.aux); return (a->type != CPP_MACRO_ARG || a->val.c == b->val.c);
case SPELL_IDENT: case SPELL_IDENT:
return a->val.node == b->val.node; return a->val.node == b->val.node;
case SPELL_STRING: case SPELL_STRING:
...@@ -1565,7 +1565,7 @@ cpp_can_paste (pfile, token1, token2, digraph) ...@@ -1565,7 +1565,7 @@ cpp_can_paste (pfile, token1, token2, digraph)
break; break;
case CPP_OTHER: case CPP_OTHER:
if (CPP_OPTION (pfile, objc) && token1->val.aux == '@') if (CPP_OPTION (pfile, objc) && token1->val.c == '@')
{ {
if (b == CPP_NAME) return CPP_NAME; if (b == CPP_NAME) return CPP_NAME;
if (b == CPP_STRING) return CPP_OSTRING; if (b == CPP_STRING) return CPP_OSTRING;
...@@ -1627,7 +1627,7 @@ cpp_avoid_paste (pfile, token1, token2) ...@@ -1627,7 +1627,7 @@ cpp_avoid_paste (pfile, token1, token2)
case CPP_NUMBER: return (b == CPP_NUMBER || b == CPP_NAME case CPP_NUMBER: return (b == CPP_NUMBER || b == CPP_NAME
|| c == '.' || c == '+' || c == '-'); || c == '.' || c == '+' || c == '-');
case CPP_OTHER: return (CPP_OPTION (pfile, objc) case CPP_OTHER: return (CPP_OPTION (pfile, objc)
&& token1->val.aux == '@' && token1->val.c == '@'
&& (b == CPP_NAME || b == CPP_STRING)); && (b == CPP_NAME || b == CPP_STRING));
default: break; default: break;
} }
......
...@@ -183,11 +183,11 @@ struct cpp_token ...@@ -183,11 +183,11 @@ struct cpp_token
union union
{ {
HOST_WIDEST_INT integer; /* an integer */ HOST_WIDEST_INT integer; /* An integer. */
struct cpp_hashnode *node; /* an identifier */ struct cpp_hashnode *node; /* An identifier. */
struct cpp_string str; /* a string, or number */ struct cpp_string str; /* A string, or number. */
unsigned int aux; /* argument no. for a CPP_MACRO_ARG, or unsigned int arg_no; /* Argument no. for a CPP_MACRO_ARG. */
character represented by CPP_OTHER. */ unsigned char c; /* Character represented by CPP_OTHER. */
} val; } val;
}; };
......
...@@ -386,7 +386,7 @@ stringify_arg (pfile, arg) ...@@ -386,7 +386,7 @@ stringify_arg (pfile, arg)
dest = cpp_spell_token (pfile, token, dest); dest = cpp_spell_token (pfile, token, dest);
total_len = dest - start; total_len = dest - start;
if (token->type == CPP_OTHER && token->val.aux == '\\') if (token->type == CPP_OTHER && token->val.c == '\\')
backslash_count++; backslash_count++;
else else
backslash_count = 0; backslash_count = 0;
...@@ -790,7 +790,7 @@ replace_args (pfile, macro, args, list) ...@@ -790,7 +790,7 @@ replace_args (pfile, macro, args, list)
{ {
/* We have an argument. If it is not being stringified or /* We have an argument. If it is not being stringified or
pasted it is macro-replaced before insertion. */ pasted it is macro-replaced before insertion. */
arg = &args[src->val.aux - 1]; arg = &args[src->val.arg_no - 1];
if (src->flags & STRINGIFY_ARG) if (src->flags & STRINGIFY_ARG)
{ {
if (!arg->stringified) if (!arg->stringified)
...@@ -818,7 +818,7 @@ replace_args (pfile, macro, args, list) ...@@ -818,7 +818,7 @@ replace_args (pfile, macro, args, list)
unsigned int count; unsigned int count;
const cpp_token *from; const cpp_token *from;
arg = &args[src->val.aux - 1]; arg = &args[src->val.arg_no - 1];
if (src->flags & STRINGIFY_ARG) if (src->flags & STRINGIFY_ARG)
from = arg->stringified, count = 1; from = arg->stringified, count = 1;
else if ((src->flags & PASTE_LEFT) else if ((src->flags & PASTE_LEFT)
...@@ -832,7 +832,7 @@ replace_args (pfile, macro, args, list) ...@@ -832,7 +832,7 @@ replace_args (pfile, macro, args, list)
it is a variable argument, it is also flagged. */ it is a variable argument, it is also flagged. */
dest->flags &= ~PREV_WHITE; dest->flags &= ~PREV_WHITE;
dest->flags |= src->flags & PREV_WHITE; dest->flags |= src->flags & PREV_WHITE;
if (macro->var_args && src->val.aux == macro->paramc) if (macro->var_args && src->val.arg_no == macro->paramc)
dest->flags |= VARARGS_FIRST; dest->flags |= VARARGS_FIRST;
/* The last token gets the PASTE_LEFT of the CPP_MACRO_ARG. */ /* The last token gets the PASTE_LEFT of the CPP_MACRO_ARG. */
...@@ -1392,7 +1392,7 @@ lex_expansion_token (pfile, macro) ...@@ -1392,7 +1392,7 @@ lex_expansion_token (pfile, macro)
if (token->type == CPP_NAME && token->val.node->arg_index) if (token->type == CPP_NAME && token->val.node->arg_index)
{ {
token->type = CPP_MACRO_ARG; token->type = CPP_MACRO_ARG;
token->val.aux = token->val.node->arg_index; token->val.arg_no = token->val.node->arg_index;
} }
else if (CPP_WTRADITIONAL (pfile) && macro->paramc > 0 else if (CPP_WTRADITIONAL (pfile) && macro->paramc > 0
&& (token->type == CPP_STRING || token->type == CPP_CHAR)) && (token->type == CPP_STRING || token->type == CPP_CHAR))
...@@ -1624,7 +1624,7 @@ cpp_macro_definition (pfile, node) ...@@ -1624,7 +1624,7 @@ cpp_macro_definition (pfile, node)
cpp_token *token = &macro->expansion[i]; cpp_token *token = &macro->expansion[i];
if (token->type == CPP_MACRO_ARG) if (token->type == CPP_MACRO_ARG)
len += macro->params[token->val.aux - 1]->length; len += macro->params[token->val.arg_no - 1]->length;
else else
len += cpp_token_len (token); /* Includes room for ' '. */ len += cpp_token_len (token); /* Includes room for ' '. */
if (token->flags & STRINGIFY_ARG) if (token->flags & STRINGIFY_ARG)
...@@ -1675,8 +1675,8 @@ cpp_macro_definition (pfile, node) ...@@ -1675,8 +1675,8 @@ cpp_macro_definition (pfile, node)
if (token->type == CPP_MACRO_ARG) if (token->type == CPP_MACRO_ARG)
{ {
len = macro->params[token->val.aux - 1]->length; len = macro->params[token->val.arg_no - 1]->length;
memcpy (buffer, macro->params[token->val.aux - 1]->name, len); memcpy (buffer, macro->params[token->val.arg_no - 1]->name, len);
buffer += len; buffer += len;
} }
else else
......
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