This makes it possible to use hash-table from generator programs
after it got GGC support.  The following simple approach (compared
to that in vec.h) works for my usage on the match-and-simplify
branch.

I'll give it a round of bootstrap there once I finish a merge
from trunk.

Ok for trunk?

Thanks,
Richard.

2014-10-15  Richard Biener  <rguent...@suse.de>

        * hash-table.c: Include bconfig.h if building for the host.
        * hash-table.h: Do not include ggc.h on the host but just declare
        a few ggc allocation templates.

Index: gcc/hash-table.c
===================================================================
--- gcc/hash-table.c    (revision 216201)
+++ gcc/hash-table.c    (working copy)
@@ -22,7 +22,11 @@ along with GCC; see the file COPYING3.
 /* This file implements a typed hash table.
    The implementation borrows from libiberty's hashtab.  */
 
+#ifdef GENERATOR_FILE
+#include "bconfig.h"
+#else
 #include "config.h"
+#endif
 #include "system.h"
 #include "coretypes.h"
 #include "hash-table.h"
Index: gcc/hash-table.h
===================================================================
--- gcc/hash-table.h    (revision 216201)
+++ gcc/hash-table.h    (working copy)
@@ -196,7 +196,14 @@ along with GCC; see the file COPYING3.
 #ifndef TYPED_HASHTAB_H
 #define TYPED_HASHTAB_H
 
+#ifndef GENERATOR_FILE
 #include "ggc.h"
+#else
+template <typename T>
+T *ggc_cleared_vec_alloc (size_t);
+template <typename T>
+T *ggc_alloc ();
+#endif
 #include "hashtab.h"
 #include <new>
 

Reply via email to