diff mbox

Make hash-table.[ch] usable on the host

Message ID alpine.LSU.2.11.1410150929200.20733@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Oct. 15, 2014, 7:30 a.m. UTC
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  <rguenther@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.

Comments

Jakub Jelinek Oct. 15, 2014, 7:36 a.m. UTC | #1
On Wed, Oct 15, 2014 at 09:30:42AM +0200, Richard Biener wrote:
> 
> 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?

LGTM, thanks.

> 2014-10-15  Richard Biener  <rguenther@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.

	Jakub
diff mbox

Patch

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>