summaryrefslogtreecommitdiff
path: root/libcpp/directives.c
diff options
context:
space:
mode:
authorgdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-28 15:52:48 +0000
committergdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-28 15:52:48 +0000
commit720aca9227005bb5d8eadd8bd95d630a28568180 (patch)
tree37f58a36e96cbf32993eff9e16ef6ca793365675 /libcpp/directives.c
parent08d9c733dad69cc9533a7fbc8d33bdaabfa1ebf5 (diff)
downloadgcc-720aca9227005bb5d8eadd8bd95d630a28568180.tar.gz
* configure.ac: Check declarations for asprintf and vasprintf.
* config.in: Regenerate. * configure: Likewise. * charset.c (conversion_loop): Use XRESIZEVEC. (convert_no_conversion): Likewise. (convert_using_iconv): Likewise. (init_iconv_desc): Cast return value of alloca. (cpp_host_to_exec_charset): Use XNEWVEC. (emit_numeric_escape): Use XRESIZEVEC. (cpp_interpret_string): Use XNEWVEC. (cpp_interpret_string): Use XRESIZEVEC. (_cpp_interpret_identifier): Cast return value of alloca. (_cpp_convert_input): Use XNEWVEC and XRESIZEVEC. * directives.c (glue_header_name): Use XNEWVEC and XRESIZEVEC. (parse_include): Use XNEWVEC. (insert_pragma_entry): Rename local variable "new" to "new_entry". (save_registered_pragmas): Cast return value of xmemdup. (destringize_and_run): Same for alloca. (parse_assertion): Likewise. (do_assert): Cast allocated storage to proper type. (cpp_define): Likewise. (_cpp_define_builtin): Likewise. (cpp_undef): Likewise. (handle_assertion): Likewise. (cpp_push_buffer): Rename local variable "new" to "new_buffer". * expr.c (CPP_UPLUS): Cast value to type cpp_ttype. (CPP_UMINUS): Likewise. (struct cpp_operator): Rename from struct operator. (_cpp_expand_op_stack): Use XRESIZEVEC. * files.c (pch_open_file): Use XNEWVEC. (pch_open_file): Use XRESIZEVEC. (read_file_guts): Use XNEWVEC and XRESIZEVEC. (dir_name_of_file): Use XNEWVEC. (make_cpp_file): Use XCNEW. (make_cpp_dir): Likewise. (allocate_file_hash_entries): USE XNEWVEC. (cpp_included): Cast return value of htab_find_with_hash. (append_file_to_dir): Use XNEWVEC. (read_filename_string): Likewise. Use XRESIZEVEC too. (read_name_map): Cast return value of alloca. Use XRESIZEVEC. (remap_filename): Use XNEWVEC. (struct pchf_entry): Move definition out of struct pchf_data. (_cpp_save_file_entries): Use XCNEWVAR. (_cpp_read_file_entries): Use XNEWVAR. * identifiers.c (alloc_node): Use XOBNEW. * init.c (cpp_create_reader): Use XCNEW. (cpp_init_builtins): Cast of b->value to enum builtin_type. (read_original_directory): Cast return value of alloca. * lex.c (add_line_note): Use XRESIZEVEC. (warn_about_normalization): Use XNEWVEC. (_cpp_lex_direct): Cast node->directive_index to (enum cpp_ttype). (new_buff): Use XNEWVEC. * line-map.c (linemap_add): Use XRESIZEVEC. * macro.c (builtin_macro): Cast return value of alloca. (paste_tokens): Likewise. (expand_arg): Use XNEWVEC and XRESIZEVEC. (_cpp_save_parameter): Use XRESIZEVEC. (create_iso_definition): Cast allocated storage to proper type. (_cpp_create_definition): Likewise. (cpp_macro_definition): Use XRESIZEVEC. * makedepend.c (add_clm): Use XNEW. (add_dir): Likewise. * mkdeps.c (munge): Use XNEWVEC. (deps_init): Use XCNEW. (deps_add_target): Use XRESIZEVEC. (deps_add_default_target): Cast return value of alloca. (deps_add_dep): Use XRESIZEVEC. (deps_add_vpath): Likewise. Use XNEWVEC too. (deps_restore): Likewise. * pch.c (save_idents): Use XNEW and XNEWVEC. (cpp_save_state): Use XNEW. (count_defs): Cast return value of htab_find. (write_defs): Likewise. (cpp_write_pch_deps): Use XNEWVEC. (collect_ht_nodes): Use XRESIZEVEC. (cpp_valid_state): Use XNEWVEC. (save_macros): Use XRESIZEVEC. Cast return value of xmemdup. * symtab.c (ht_create): Use XCNEW. (ht_lookup_with_hash): Cast return value of obstack_copy0. (ht_expand): Use XCNEWVEC. * system.h (HAVE_DESIGNATED_INITIALIZERS): False if __cplusplus. (bool): Do not define if __cplusplus. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100295 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/directives.c')
-rw-r--r--libcpp/directives.c69
1 files changed, 35 insertions, 34 deletions
diff --git a/libcpp/directives.c b/libcpp/directives.c
index 672415b8d61..a768ea14408 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -588,7 +588,7 @@ glue_header_name (cpp_reader *pfile)
/* To avoid lexed tokens overwriting our glued name, we can only
allocate from the string pool once we've lexed everything. */
- buffer = xmalloc (capacity);
+ buffer = XNEWVEC (char, capacity);
for (;;)
{
token = get_token_no_padding (pfile);
@@ -605,7 +605,7 @@ glue_header_name (cpp_reader *pfile)
if (total_len + len > capacity)
{
capacity = (capacity + len) * 2;
- buffer = xrealloc (buffer, capacity);
+ buffer = XRESIZEVEC (char, buffer, capacity);
}
if (token->flags & PREV_WHITE)
@@ -633,7 +633,7 @@ parse_include (cpp_reader *pfile, int *pangle_brackets)
header = get_token_no_padding (pfile);
if (header->type == CPP_STRING || header->type == CPP_HEADER_NAME)
{
- fname = xmalloc (header->val.str.len - 1);
+ fname = XNEWVEC (char, header->val.str.len - 1);
memcpy (fname, header->val.str.text + 1, header->val.str.len - 2);
fname[header->val.str.len - 2] = '\0';
*pangle_brackets = header->type == CPP_HEADER_NAME;
@@ -985,27 +985,27 @@ insert_pragma_entry (cpp_reader *pfile, struct pragma_entry **chain,
const cpp_hashnode *pragma, pragma_cb handler,
bool allow_expansion, bool internal)
{
- struct pragma_entry *new;
+ struct pragma_entry *new_entry;
- new = (struct pragma_entry *)
+ new_entry = (struct pragma_entry *)
_cpp_aligned_alloc (pfile, sizeof (struct pragma_entry));
- new->pragma = pragma;
+ new_entry->pragma = pragma;
if (handler)
{
- new->is_nspace = 0;
- new->u.handler = handler;
+ new_entry->is_nspace = 0;
+ new_entry->u.handler = handler;
}
else
{
- new->is_nspace = 1;
- new->u.space = NULL;
+ new_entry->is_nspace = 1;
+ new_entry->u.space = NULL;
}
- new->allow_expansion = allow_expansion;
- new->is_internal = internal;
- new->next = *chain;
- *chain = new;
- return new;
+ new_entry->allow_expansion = allow_expansion;
+ new_entry->is_internal = internal;
+ new_entry->next = *chain;
+ *chain = new_entry;
+ return new_entry;
}
/* Register a pragma NAME in namespace SPACE. If SPACE is null, it
@@ -1110,9 +1110,9 @@ save_registered_pragmas (struct pragma_entry *pe, char **sd)
{
if (pe->is_nspace)
sd = save_registered_pragmas (pe->u.space, sd);
- *sd++ = xmemdup (HT_STR (&pe->pragma->ident),
- HT_LEN (&pe->pragma->ident),
- HT_LEN (&pe->pragma->ident) + 1);
+ *sd++ = (char *) xmemdup (HT_STR (&pe->pragma->ident),
+ HT_LEN (&pe->pragma->ident),
+ HT_LEN (&pe->pragma->ident) + 1);
}
return sd;
}
@@ -1383,7 +1383,7 @@ destringize_and_run (cpp_reader *pfile, const cpp_string *in)
const unsigned char *src, *limit;
char *dest, *result;
- dest = result = alloca (in->len - 1);
+ dest = result = (char *) alloca (in->len - 1);
src = in->text + 1 + (in->text[0] == 'L');
limit = in->text + in->len - 1;
while (src < limit)
@@ -1760,7 +1760,7 @@ parse_assertion (cpp_reader *pfile, struct answer **answerp, int type)
else if (parse_answer (pfile, answerp, type) == 0)
{
unsigned int len = NODE_LEN (predicate->val.node);
- unsigned char *sym = alloca (len + 1);
+ unsigned char *sym = (unsigned char *) alloca (len + 1);
/* Prefix '#' to get it out of macro namespace. */
sym[0] = '#';
@@ -1855,7 +1855,8 @@ do_assert (cpp_reader *pfile)
if (pfile->hash_table->alloc_subobject)
{
struct answer *temp_answer = new_answer;
- new_answer = pfile->hash_table->alloc_subobject (answer_size);
+ new_answer = (struct answer *) pfile->hash_table->alloc_subobject
+ (answer_size);
memcpy (new_answer, temp_answer, answer_size);
}
else
@@ -1917,7 +1918,7 @@ cpp_define (cpp_reader *pfile, const char *str)
tack " 1" on the end. */
count = strlen (str);
- buf = alloca (count + 3);
+ buf = (char *) alloca (count + 3);
memcpy (buf, str, count);
p = strchr (str, '=');
@@ -1938,7 +1939,7 @@ void
_cpp_define_builtin (cpp_reader *pfile, const char *str)
{
size_t len = strlen (str);
- char *buf = alloca (len + 1);
+ char *buf = (char *) alloca (len + 1);
memcpy (buf, str, len);
buf[len] = '\n';
run_directive (pfile, T_DEFINE, buf, len);
@@ -1949,7 +1950,7 @@ void
cpp_undef (cpp_reader *pfile, const char *macro)
{
size_t len = strlen (macro);
- char *buf = alloca (len + 1);
+ char *buf = (char *) alloca (len + 1);
memcpy (buf, macro, len);
buf[len] = '\n';
run_directive (pfile, T_UNDEF, buf, len);
@@ -1978,7 +1979,7 @@ handle_assertion (cpp_reader *pfile, const char *str, int type)
/* Copy the entire option so we can modify it. Change the first
"=" in the string to a '(', and tack a ')' on the end. */
- char *buf = alloca (count + 2);
+ char *buf = (char *) alloca (count + 2);
memcpy (buf, str, count);
if (p)
@@ -2036,20 +2037,20 @@ cpp_buffer *
cpp_push_buffer (cpp_reader *pfile, const uchar *buffer, size_t len,
int from_stage3)
{
- cpp_buffer *new = XOBNEW (&pfile->buffer_ob, cpp_buffer);
+ cpp_buffer *new_buffer = XOBNEW (&pfile->buffer_ob, cpp_buffer);
/* Clears, amongst other things, if_stack and mi_cmacro. */
- memset (new, 0, sizeof (cpp_buffer));
+ memset (new_buffer, 0, sizeof (cpp_buffer));
- new->next_line = new->buf = buffer;
- new->rlimit = buffer + len;
- new->from_stage3 = from_stage3;
- new->prev = pfile->buffer;
- new->need_line = true;
+ new_buffer->next_line = new_buffer->buf = buffer;
+ new_buffer->rlimit = buffer + len;
+ new_buffer->from_stage3 = from_stage3;
+ new_buffer->prev = pfile->buffer;
+ new_buffer->need_line = true;
- pfile->buffer = new;
+ pfile->buffer = new_buffer;
- return new;
+ return new_buffer;
}
/* Pops a single buffer, with a file change call-back if appropriate.