This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Make hash-table.[ch] usable on the host
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Jakub Jelinek <jakub at redhat dot com>
- Date: Wed, 15 Oct 2014 09:30:42 +0200 (CEST)
- Subject: [PATCH] Make hash-table.[ch] usable on the host
- Authentication-results: sourceware.org; auth=none
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.
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>