/* 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. */
#include "ggc.h"
#include "tree.h"
#include "hashtable.h"
-#include "flags.h"
#include "toplev.h"
/* The "" allocated string. */
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
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. */
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 (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
= (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