This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH take 2]: Fix a few remaining -Wc++-compat warnings
This is take 2 of of my recent patch to eliminate a few last -Wc++-compat
warnings from the top level directory. The change to this patch is that
it zaps the now unused variable pool_size in alloc-pool.c as requested by
Nathan. Otherwise it's the same.
All the questions and caveats from the previous message remain. :-)
http://gcc.gnu.org/ml/gcc-patches/2008-06/msg01658.html
Bootstrapped on x86_64-unknown-linux-gnu.
Okay for mainline?
Thanks,
--Kaveh
2008-06-26 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* 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.
diff -rup orig/egcc-SVN20080626/gcc/alloc-pool.c egcc-SVN20080626/gcc/alloc-pool.c
--- orig/egcc-SVN20080626/gcc/alloc-pool.c 2008-03-14 00:39:19.000000000 +0100
+++ egcc-SVN20080626/gcc/alloc-pool.c 2008-06-27 02:14:48.000000000 +0200
@@ -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, siz
/* 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 -rup orig/egcc-SVN20080626/gcc/df-scan.c egcc-SVN20080626/gcc/df-scan.c
--- orig/egcc-SVN20080626/gcc/df-scan.c 2008-06-26 02:34:32.000000000 +0200
+++ egcc-SVN20080626/gcc/df-scan.c 2008-06-27 02:13:05.000000000 +0200
@@ -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 -rup orig/egcc-SVN20080626/gcc/ggc-page.c egcc-SVN20080626/gcc/ggc-page.c
--- orig/egcc-SVN20080626/gcc/ggc-page.c 2008-06-26 02:34:32.000000000 +0200
+++ egcc-SVN20080626/gcc/ggc-page.c 2008-06-27 02:13:05.000000000 +0200
@@ -610,7 +610,7 @@ set_page_table_entry (void *p, page_entr
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 -rup orig/egcc-SVN20080626/gcc/intl.c egcc-SVN20080626/gcc/intl.c
--- orig/egcc-SVN20080626/gcc/intl.c 2008-03-14 00:34:27.000000000 +0100
+++ egcc-SVN20080626/gcc/intl.c 2008-06-27 02:13:05.000000000 +0200
@@ -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 -rup orig/egcc-SVN20080626/gcc/varasm.c egcc-SVN20080626/gcc/varasm.c
--- orig/egcc-SVN20080626/gcc/varasm.c 2008-06-20 20:46:26.000000000 +0200
+++ egcc-SVN20080626/gcc/varasm.c 2008-06-27 02:13:05.000000000 +0200
@@ -518,7 +518,7 @@ get_unnamed_section (unsigned int flags,
{
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
{
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
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;