c-opts.c (sanitize_cpp_opts): Make warn_long_long be set according to warn_c90_c99_co...
[gcc.git] / libcpp / symtab.c
index 5414ff05fc9dc3a5143b2818830a57b6565b6981..73c421e17425a8147c847cf3c856f688c29d3fcb 100644 (file)
@@ -1,9 +1,9 @@
 /* Hash tables.
-   Copyright (C) 2000, 2001, 2003, 2004, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2000-2014 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option) any
+Free Software Foundation; either version 3, or (at your option) any
 later version.
 
 This program is distributed in the hope that it will be useful,
@@ -12,8 +12,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+along with this program; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.
 
  In other words, you are welcome to use, share and improve this program.
  You are forbidden to forbid anyone else to use, share and improve
@@ -30,7 +30,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    existing entry with a potential new one.  */
 
 static unsigned int calc_hash (const unsigned char *, size_t);
-static void ht_expand (hash_table *);
+static void ht_expand (cpp_hash_table *);
 static double approx_sqrt (double);
 
 /* A deleted entry.  */
@@ -52,13 +52,13 @@ calc_hash (const unsigned char *str, size_t len)
 
 /* Initialize an identifier hashtable.  */
 
-hash_table *
+cpp_hash_table *
 ht_create (unsigned int order)
 {
   unsigned int nslots = 1 << order;
-  hash_table *table;
+  cpp_hash_table *table;
 
-  table = XCNEW (hash_table);
+  table = XCNEW (cpp_hash_table);
 
   /* Strings need no alignment.  */
   _obstack_begin (&table->stack, 0, 0,
@@ -76,7 +76,7 @@ ht_create (unsigned int order)
 /* Frees all memory associated with a hash table.  */
 
 void
-ht_destroy (hash_table *table)
+ht_destroy (cpp_hash_table *table)
 {
   obstack_free (&table->stack, NULL);
   if (table->entries_owned)
@@ -90,7 +90,7 @@ ht_destroy (hash_table *table)
    returns NULL.  Otherwise insert and returns a new entry.  A new
    string is allocated.  */
 hashnode
-ht_lookup (hash_table *table, const unsigned char *str, size_t len,
+ht_lookup (cpp_hash_table *table, const unsigned char *str, size_t len,
           enum ht_lookup_option insert)
 {
   return ht_lookup_with_hash (table, str, len, calc_hash (str, len),
@@ -98,7 +98,7 @@ ht_lookup (hash_table *table, const unsigned char *str, size_t len,
 }
 
 hashnode
-ht_lookup_with_hash (hash_table *table, const unsigned char *str,
+ht_lookup_with_hash (cpp_hash_table *table, const unsigned char *str,
                     size_t len, unsigned int hash,
                     enum ht_lookup_option insert)
 {
@@ -162,7 +162,7 @@ ht_lookup_with_hash (hash_table *table, const unsigned char *str,
 
   if (table->alloc_subobject)
     {
-      char *chars = table->alloc_subobject (len + 1);
+      char *chars = (char *) table->alloc_subobject (len + 1);
       memcpy (chars, str, len);
       chars[len] = '\0';
       HT_STR (node) = (const unsigned char *) chars;
@@ -181,7 +181,7 @@ ht_lookup_with_hash (hash_table *table, const unsigned char *str,
 /* Double the size of a hash table, re-hashing existing entries.  */
 
 static void
-ht_expand (hash_table *table)
+ht_expand (cpp_hash_table *table)
 {
   hashnode *nentries, *p, *limit;
   unsigned int size, sizemask;
@@ -223,7 +223,7 @@ ht_expand (hash_table *table)
 /* For all nodes in TABLE, callback CB with parameters TABLE->PFILE,
    the node, and V.  */
 void
-ht_forall (hash_table *table, ht_cb cb, const void *v)
+ht_forall (cpp_hash_table *table, ht_cb cb, const void *v)
 {
   hashnode *p, *limit;
 
@@ -241,7 +241,7 @@ ht_forall (hash_table *table, ht_cb cb, const void *v)
 /* Like ht_forall, but a nonzero return from the callback means that
    the entry should be removed from the table.  */
 void
-ht_purge (hash_table *table, ht_cb cb, const void *v)
+ht_purge (cpp_hash_table *table, ht_cb cb, const void *v)
 {
   hashnode *p, *limit;
 
@@ -258,7 +258,7 @@ ht_purge (hash_table *table, ht_cb cb, const void *v)
 
 /* Restore the hash table.  */
 void
-ht_load (hash_table *ht, hashnode *entries,
+ht_load (cpp_hash_table *ht, hashnode *entries,
         unsigned int nslots, unsigned int nelements,
         bool own)
 {
@@ -273,7 +273,7 @@ ht_load (hash_table *ht, hashnode *entries,
 /* Dump allocation statistics to stderr.  */
 
 void
-ht_dump_statistics (hash_table *table)
+ht_dump_statistics (cpp_hash_table *table)
 {
   size_t nelts, nids, overhead, headers;
   size_t total_bytes, longest, deleted = 0;