Commit 2964d54f by Neil Booth Committed by Neil Booth

cpphash.h: (TOKEN_SPELL) Pulled from cpplex.c.

	* cpphash.h: (TOKEN_SPELL) Pulled from cpplex.c.
	* cpplex.c (TOKEN_SPELL) Move to cpphash.h.

	* cpphash.c: (struct macro_info, alloc_macro, free_macro,
	struct toklist_dummy): New.
	(cpp_free_definition): Free macros with free_macro.
	(count_params): Don't save paramter spellings.  Save macro
	information in a struct macro_info.
	(parse_define): Don't allocate a token list.
	(save_expansion): Allocate the macro's token list, and
	save parameter spellings if necessary.  Use TOKEN_SPELL.
	(cpp_create_definition): Make list const.

From-SVN: r34985
parent b9161f44
2000-07-12 Neil Booth <NeilB@earthling.net>
* cpphash.h: (TOKEN_SPELL) Pulled from cpplex.c.
* cpplex.c (TOKEN_SPELL) Move to cpphash.h.
* cpphash.c: (struct macro_info, alloc_macro, free_macro,
struct toklist_dummy): New.
(cpp_free_definition): Free macros with free_macro.
(count_params): Don't save paramter spellings. Save macro
information in a struct macro_info.
(parse_define): Don't allocate a token list.
(save_expansion): Allocate the macro's token list, and
save parameter spellings if necessary. Use TOKEN_SPELL.
(cpp_create_definition): Make list const.
2000-07-12 Gabriel Dos Reis <gdr@codesourcery.com> 2000-07-12 Gabriel Dos Reis <gdr@codesourcery.com>
* c-typeck.c (pedwarn_c99): Move to * c-typeck.c (pedwarn_c99): Move to
......
...@@ -43,6 +43,7 @@ struct token_spelling ...@@ -43,6 +43,7 @@ struct token_spelling
}; };
extern const struct token_spelling token_spellings[]; extern const struct token_spelling token_spellings[];
#define TOKEN_SPELL(token) (token_spellings[(token)->type].type)
/* Chained list of answers to an assertion. */ /* Chained list of answers to an assertion. */
struct answer struct answer
......
...@@ -139,7 +139,6 @@ static void process_directive PARAMS ((cpp_reader *, const cpp_token *)); ...@@ -139,7 +139,6 @@ static void process_directive PARAMS ((cpp_reader *, const cpp_token *));
/* An upper bound on the number of bytes needed to spell a token, /* An upper bound on the number of bytes needed to spell a token,
including preceding whitespace. */ including preceding whitespace. */
#define TOKEN_SPELL(token) token_spellings[(token)->type].type
#define TOKEN_LEN(token) (5 + (TOKEN_SPELL(token) == SPELL_STRING \ #define TOKEN_LEN(token) (5 + (TOKEN_SPELL(token) == SPELL_STRING \
? (token)->val.str.len \ ? (token)->val.str.len \
: (TOKEN_SPELL(token) == SPELL_IDENT \ : (TOKEN_SPELL(token) == SPELL_IDENT \
......
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