diff options
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 8af9f46..df45bb6 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -127,7 +127,7 @@ static void cp_token_cache_push_token static cp_token_cache * cp_token_cache_new () { - return (cp_token_cache *) ggc_alloc_cleared (sizeof (cp_token_cache)); + return ggc_alloc_cleared (sizeof (cp_token_cache)); } /* Add *TOKEN to *CACHE. */ @@ -141,7 +141,7 @@ cp_token_cache_push_token (cp_token_cache *cache, /* See if we need to allocate a new token block. */ if (!b || b->num_tokens == CP_TOKEN_BLOCK_NUM_TOKENS) { - b = ((cp_token_block *) ggc_alloc_cleared (sizeof (cp_token_block))); + b = ggc_alloc_cleared (sizeof (cp_token_block)); b->prev = cache->last; if (cache->last) { @@ -305,11 +305,10 @@ cp_lexer_new_main (void) cpp_get_callbacks (parse_in)->valid_pch = NULL; /* Allocate the memory. */ - lexer = (cp_lexer *) ggc_alloc_cleared (sizeof (cp_lexer)); + lexer = ggc_alloc_cleared (sizeof (cp_lexer)); /* Create the circular buffer. */ - lexer->buffer = ((cp_token *) - ggc_calloc (CP_TOKEN_BUFFER_SIZE, sizeof (cp_token))); + lexer->buffer = ggc_calloc (CP_TOKEN_BUFFER_SIZE, sizeof (cp_token)); lexer->buffer_end = lexer->buffer + CP_TOKEN_BUFFER_SIZE; /* There is one token in the buffer. */ @@ -345,13 +344,13 @@ cp_lexer_new_from_tokens (cp_token_cache *tokens) ptrdiff_t num_tokens; /* Allocate the memory. */ - lexer = (cp_lexer *) ggc_alloc_cleared (sizeof (cp_lexer)); + lexer = ggc_alloc_cleared (sizeof (cp_lexer)); /* Create a new buffer, appropriately sized. */ num_tokens = 0; for (block = tokens->first; block != NULL; block = block->next) num_tokens += block->num_tokens; - lexer->buffer = ((cp_token *) ggc_alloc (num_tokens * sizeof (cp_token))); + lexer->buffer = ggc_alloc (num_tokens * sizeof (cp_token)); lexer->buffer_end = lexer->buffer + num_tokens; /* Install the tokens. */ @@ -521,9 +520,8 @@ cp_lexer_maybe_grow_buffer (cp_lexer* lexer) /* Compute the current buffer size. */ buffer_length = lexer->buffer_end - lexer->buffer; /* Allocate a buffer twice as big. */ - new_buffer = ((cp_token *) - ggc_realloc (lexer->buffer, - 2 * buffer_length * sizeof (cp_token))); + new_buffer = ggc_realloc (lexer->buffer, + 2 * buffer_length * sizeof (cp_token)); /* Because the buffer is circular, logically consecutive tokens are not necessarily placed consecutively in memory. @@ -1130,11 +1128,10 @@ cp_parser_context_new (cp_parser_context* next) /* Pull the first entry from the free list. */ context = cp_parser_context_free_list; cp_parser_context_free_list = context->next; - memset ((char *)context, 0, sizeof (*context)); + memset (context, 0, sizeof (*context)); } else - context = ((cp_parser_context *) - ggc_alloc_cleared (sizeof (cp_parser_context))); + context = ggc_alloc_cleared (sizeof (cp_parser_context)); /* No errors have occurred yet in this context. */ context->status = CP_PARSER_STATUS_KIND_NO_ERROR; /* If this is not the bottomost context, copy information that we @@ -2067,7 +2064,7 @@ cp_parser_new (void) cp_lexer_new_main might load a PCH file. */ lexer = cp_lexer_new_main (); - parser = (cp_parser *) ggc_alloc_cleared (sizeof (cp_parser)); + parser = ggc_alloc_cleared (sizeof (cp_parser)); parser->lexer = lexer; parser->context = cp_parser_context_new (NULL); @@ -13796,10 +13793,9 @@ cp_parser_sizeof_operand (cp_parser* parser, enum rid keyword) saved_message = parser->type_definition_forbidden_message; /* And create the new one. */ parser->type_definition_forbidden_message - = ((const char *) - xmalloc (strlen (format) - + strlen (IDENTIFIER_POINTER (ridpointers[keyword])) - + 1 /* `\0' */)); + = xmalloc (strlen (format) + + strlen (IDENTIFIER_POINTER (ridpointers[keyword])) + + 1 /* `\0' */); sprintf ((char *) parser->type_definition_forbidden_message, format, IDENTIFIER_POINTER (ridpointers[keyword])); |