From 4dc6c528c2b8e858ae65d91a82c6fae661894302 Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Sun, 29 Jun 2008 04:39:16 +0000 Subject: [PATCH] alloc-pool.c (create_alloc_pool): Fix -Wc++-compat warnings. * alloc-pool.c (create_alloc_pool): Fix -Wc++-compat warnings. * df-scan.c (df_notes_rescan): Likewise. * ggc-page.c (set_page_table_entry): Likewise. * intl.c (gcc_gettext_width): Likewise. * varasm.c (get_unnamed_section, get_noswitch_section, get_section): Likewise. From-SVN: r137245 --- gcc/ChangeLog | 9 +++++++++ gcc/alloc-pool.c | 9 +++------ gcc/df-scan.c | 6 +++--- gcc/ggc-page.c | 2 +- gcc/intl.c | 2 +- gcc/varasm.c | 6 +++--- 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c91e67f9032..1b0727bea14 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2008-06-29 Kaveh R. Ghazi + + * alloc-pool.c (create_alloc_pool): Fix -Wc++-compat warnings. + * df-scan.c (df_notes_rescan): Likewise. + * ggc-page.c (set_page_table_entry): Likewise. + * intl.c (gcc_gettext_width): Likewise. + * varasm.c (get_unnamed_section, get_noswitch_section, + get_section): Likewise. + 2008-06-28 Andrew Jenner * regrename.c (build_def_use): Don't copy RTX. diff --git a/gcc/alloc-pool.c b/gcc/alloc-pool.c index d5d1fab79af..b22869fe787 100644 --- a/gcc/alloc-pool.c +++ b/gcc/alloc-pool.c @@ -119,7 +119,7 @@ alloc_pool create_alloc_pool (const char *name, size_t size, size_t num) { alloc_pool pool; - size_t pool_size, header_size; + size_t header_size; #ifdef GATHER_STATISTICS struct alloc_pool_descriptor *desc; #endif @@ -141,11 +141,8 @@ create_alloc_pool (const char *name, size_t size, size_t num) /* Um, we can't really allocate 0 elements per block. */ gcc_assert (num); - /* Find the size of the pool structure, and the name. */ - pool_size = sizeof (struct alloc_pool_def); - - /* and allocate that much memory. */ - pool = xmalloc (pool_size); + /* Allocate memory for the pool structure. */ + pool = XNEW (struct alloc_pool_def); /* Now init the various pieces of our pool structure. */ pool->name = /*xstrdup (name)*/name; diff --git a/gcc/df-scan.c b/gcc/df-scan.c index 87dda3a7b2c..092273faa3b 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -2082,9 +2082,9 @@ df_notes_rescan (rtx insn) if (collection_rec.next_mw > num_deleted) { insn_info->mw_hardregs = - xrealloc (insn_info->mw_hardregs, - (count + 1 + collection_rec.next_mw) - * sizeof (struct df_ref*)); + XRESIZEVEC (struct df_mw_hardreg *, + insn_info->mw_hardregs, + count + 1 + collection_rec.next_mw); } memcpy (&insn_info->mw_hardregs[count], collection_rec.mw_vec, (collection_rec.next_mw + 1) * sizeof (struct df_mw_hardreg *)); diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c index 14e0776a1a6..4ac73d4af4f 100644 --- a/gcc/ggc-page.c +++ b/gcc/ggc-page.c @@ -610,7 +610,7 @@ set_page_table_entry (void *p, page_entry *entry) goto found; /* Not found -- allocate a new table. */ - table = xcalloc (1, sizeof(*table)); + table = XCNEW (struct page_table_chain); table->next = G.lookup; table->high_bits = high_bits; G.lookup = table; diff --git a/gcc/intl.c b/gcc/intl.c index f76dbada97b..dfc015d2123 100644 --- a/gcc/intl.c +++ b/gcc/intl.c @@ -91,7 +91,7 @@ size_t gcc_gettext_width (const char *msgstr) { size_t nwcs = mbstowcs (0, msgstr, 0); - wchar_t *wmsgstr = alloca ((nwcs + 1) * sizeof (wchar_t)); + wchar_t *wmsgstr = XALLOCAVEC (wchar_t, nwcs + 1); mbstowcs (wmsgstr, msgstr, nwcs + 1); return wcswidth (wmsgstr, nwcs); diff --git a/gcc/varasm.c b/gcc/varasm.c index f8390a43bc8..d8c611444d3 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -518,7 +518,7 @@ get_unnamed_section (unsigned int flags, void (*callback) (const void *), { section *sect; - sect = ggc_alloc (sizeof (struct unnamed_section)); + sect = GGC_NEW (section); sect->unnamed.common.flags = flags | SECTION_UNNAMED; sect->unnamed.callback = callback; sect->unnamed.data = data; @@ -535,7 +535,7 @@ get_noswitch_section (unsigned int flags, noswitch_section_callback callback) { section *sect; - sect = ggc_alloc (sizeof (struct unnamed_section)); + sect = GGC_NEW (section); sect->noswitch.common.flags = flags | SECTION_NOSWITCH; sect->noswitch.callback = callback; @@ -556,7 +556,7 @@ get_section (const char *name, unsigned int flags, tree decl) flags |= SECTION_NAMED; if (*slot == NULL) { - sect = ggc_alloc (sizeof (struct named_section)); + sect = GGC_NEW (section); sect->named.common.flags = flags; sect->named.name = ggc_strdup (name); sect->named.decl = decl; -- 2.30.2