diff options
| author | Carl Worth <cworth@cworth.org> | 2010-05-26 08:15:49 -0700 | 
|---|---|---|
| committer | Carl Worth <cworth@cworth.org> | 2010-05-26 08:15:49 -0700 | 
| commit | ec4ada01c01338ae1deab634cf62f24344bdbd3a (patch) | |
| tree | 74b4e4c073d7d6f2c60102e82e253caac6eb13eb | |
| parent | c9dcc08d4512370b6fef6370afb8bcdb0ecd9292 (diff) | |
Prevent unexpanded macros from being expanded again in the future.
With this fix, tests 37 - 39 now pass.
| -rw-r--r-- | glcpp-parse.y | 13 | 
1 files changed, 11 insertions, 2 deletions
| diff --git a/glcpp-parse.y b/glcpp-parse.y index 5b792a976e..ec10433063 100644 --- a/glcpp-parse.y +++ b/glcpp-parse.y @@ -676,8 +676,17 @@ _glcpp_parser_expand_token_onto (glcpp_parser_t *parser,  	/* Finally, don't expand this macro if we're already actively  	 * expanding it, (to avoid infinite recursion). */ -	if (_string_list_contains (parser->active, identifier, NULL)) { -		_token_list_append (result, token); +	if (_string_list_contains (parser->active, identifier, NULL)) +	{ +		/* We change the token type here from IDENTIFIER to +		 * OTHER to prevent any future expansion of this +		 * unexpanded token. */ +		char *str; +		token_t *new_token; + +		str = xtalloc_strdup (result, token->value.str); +		new_token = _token_create_str (result, OTHER, str); +		_token_list_append (result, new_token);  		return 0;  	} | 
