OSDN Git Service

* config/s390/s390.c (s390_emit_epilogue): Always restore registers
[pf3gnuchains/gcc-fork.git] / gcc / stringpool.c
index 0828bc0..e5b674a 100644 (file)
@@ -1,24 +1,24 @@
 /* String pool for GCC.
    Copyright (C) 2000, 2001 Free Software Foundation, Inc.
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-GNU CC 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
-later version.
+GCC 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 later
+version.
 
-GNU CC is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of 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 GNU CC; see the file COPYING.  If not, write to the Free
+along with GCC; see the file COPYING.  If not, write to the Free
 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA.  */
 
-/* String text, identifer text and identifier node allocator.  Strings
+/* String text, identifier text and identifier node allocator.  Strings
    allocated by ggc_alloc_string are stored in an obstack which is
    never shrunk.  Identifiers are uniquely stored in a hash table.
 
@@ -32,10 +32,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "ggc.h"
 #include "tree.h"
 #include "hashtable.h"
-#include "flags.h"
-#include "toplev.h"
-
-#define IS_FE_IDENT(NODE) (TREE_CODE (NODE) == IDENTIFIER_NODE)
 
 /* The "" allocated string.  */
 const char empty_string[] = "";
@@ -49,13 +45,10 @@ const char digit_vector[] = {
 
 struct ht *ident_hash;
 static struct obstack string_stack;
-static int do_identifier_warnings;
 
 static hashnode alloc_node PARAMS ((hash_table *));
 static int mark_ident PARAMS ((struct cpp_reader *, hashnode, const PTR));
 static void mark_ident_hash PARAMS ((void *));
-static int scan_for_clashes PARAMS ((struct cpp_reader *, hashnode,
-                                    const char *));
 
 /* Initialize the string pool.  */
 void
@@ -92,30 +85,13 @@ ggc_alloc_string (contents, length)
 
   if (length == 0)
     return empty_string;
-  if (length == 1 && contents[0] >= '0' && contents[0] <= '9')
+  if (length == 1 && ISDIGIT (contents[0]))
     return digit_string (contents[0] - '0');
 
   obstack_grow0 (&string_stack, contents, length);
   return obstack_finish (&string_stack);
 }
 
-/* NODE is an identifier known to the preprocessor.  Make it known to
-   the front ends as well.  */
-
-void
-make_identifier (node)
-     tree node;
-{
-  /* If this identifier is longer than the clash-warning length,
-     do a brute force search of the entire table for clashes.  */
-  if (warn_id_clash && do_identifier_warnings
-      && IDENTIFIER_LENGTH (node) >= id_clash_len)
-    ht_forall (ident_hash, (ht_cb) scan_for_clashes,
-              IDENTIFIER_POINTER (node));
-
-  TREE_SET_CODE (node, IDENTIFIER_NODE);
-}
-
 /* Return an IDENTIFIER_NODE whose name is TEXT (a null-terminated string).
    If an identifier with that name has previously been referred to,
    the same node is returned this time.  */
@@ -132,6 +108,22 @@ get_identifier (text)
   return HT_IDENT_TO_GCC_IDENT (ht_node);
 }
 
+/* Identical to get_identifier, except that the length is assumed
+   known.  */
+   
+tree
+get_identifier_with_length (text, length)
+     const char *text;
+     unsigned int length;
+{
+  hashnode ht_node = ht_lookup (ident_hash,
+                               (const unsigned char *) text,
+                               length, HT_ALLOC);
+
+  /* ht_node can't be NULL here.  */
+  return HT_IDENT_TO_GCC_IDENT (ht_node);
+}
+
 /* If an identifier with the name TEXT (a null-terminated string) has
    previously been referred to, return that node; otherwise return
    NULL_TREE.  */
@@ -141,66 +133,15 @@ maybe_get_identifier (text)
      const char *text;
 {
   hashnode ht_node;
-  tree node;
-  size_t length = strlen (text);
 
   ht_node = ht_lookup (ident_hash, (const unsigned char *) text,
-                      length, HT_NO_INSERT);
+                      strlen (text), HT_NO_INSERT);
   if (ht_node)
-    {
-      node = HT_IDENT_TO_GCC_IDENT (ht_node);
-      if (IS_FE_IDENT (node))
-       return node;
-    }
+    return HT_IDENT_TO_GCC_IDENT (ht_node);
 
   return NULL_TREE;
 }
 
-/* If this identifier is longer than the clash-warning length,
-   do a brute force search of the entire table for clashes.  */
-
-static int
-scan_for_clashes (pfile, h, text)
-     struct cpp_reader *pfile ATTRIBUTE_UNUSED;
-     hashnode h;
-     const char *text;
-{
-  tree node = HT_IDENT_TO_GCC_IDENT (h);
-
-  if (IS_FE_IDENT (node)
-      && IDENTIFIER_LENGTH (node) >= id_clash_len
-      && !memcmp (IDENTIFIER_POINTER (node), text, id_clash_len))
-    {
-      warning ("\"%s\" and \"%s\" identical in first %d characters",
-              text, IDENTIFIER_POINTER (node), id_clash_len);
-      return 0;
-    }
-
-  return 1;
-}
-
-/* Record the size of an identifier node for the language in use.
-   SIZE is the total size in bytes.
-   This is called by the language-specific files.  This must be
-   called before allocating any identifiers.  */
-
-void
-set_identifier_size (size)
-     int size;
-{
-  tree_code_length[(int) IDENTIFIER_NODE]
-    = (size - sizeof (struct tree_common)) / sizeof (tree);
-}
-
-/* Enable warnings on similar identifiers (if requested).
-   Done after the built-in identifiers are created.  */
-
-void
-start_identifier_warnings ()
-{
-  do_identifier_warnings = 1;
-}
-
 /* Report some basic statistics about the string pool.  */
 
 void