parse.y: Remove.

* parse.y: Remove.
	* spew.c: Likewise.
	* Make-lang.in (gt-cp-spew.h): Remove.
	* cp-tree.h (do_pending_lang_change): Remove.
	(do_identifier): Change prototype.
	(finish_id_expr): Remove.
	* decl.c (lookup_name_real): Remove yylex variable.
	* decl2.c (build_expr_from_tree): Adjust call to do_identifier.
	* lex.c (init_cpp_parse): Remove.
	(reduce_cmp): Likewise.
	(token_cmp): Likewise.
	(yychar): Likewise.
	(lastiddecl): Likewise.
	(token_count): Likewise.
	(reduce_count): Likewise.
	(yyhook): Likewise.
	(print_parse_statistics): Likewise.
	(do_pending_lang_change): Likewise.
	(do_identifier): Remove parsing parameter.
	* lex.h (lastiddecl): Remove.
	(looking_for_typename): Remove.
	(looking_for_template): Likewise.
	(pending_lang_change): Likewise.
	(yylex): Likewise.
	* semantics.c (finish_id_expr): Remove.

From-SVN: r60642
This commit is contained in:
Mark Mitchell 2002-12-30 19:02:11 +00:00 committed by Mark Mitchell
parent a47a68100f
commit afd9b9dd9d
10 changed files with 35 additions and 5955 deletions

View File

@ -10,6 +10,32 @@
2002-12-30 Mark Mitchell <mark@codesourcery.com>
* parse.y: Remove.
* spew.c: Likewise.
* Make-lang.in (gt-cp-spew.h): Remove.
* cp-tree.h (do_pending_lang_change): Remove.
(do_identifier): Change prototype.
(finish_id_expr): Remove.
* decl.c (lookup_name_real): Remove yylex variable.
* decl2.c (build_expr_from_tree): Adjust call to do_identifier.
* lex.c (init_cpp_parse): Remove.
(reduce_cmp): Likewise.
(token_cmp): Likewise.
(yychar): Likewise.
(lastiddecl): Likewise.
(token_count): Likewise.
(reduce_count): Likewise.
(yyhook): Likewise.
(print_parse_statistics): Likewise.
(do_pending_lang_change): Likewise.
(do_identifier): Remove parsing parameter.
* lex.h (lastiddecl): Remove.
(looking_for_typename): Remove.
(looking_for_template): Likewise.
(pending_lang_change): Likewise.
(yylex): Likewise.
* semantics.c (finish_id_expr): Remove.
* decl.c (grokdeclarator): Diagnost "extern thread" and "static
thread" correctly.

View File

@ -102,7 +102,7 @@ $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf
$(srcdir)/cp/cfns.gperf > $(srcdir)/cp/cfns.h
gtype-cp.h gt-cp-call.h gt-cp-decl.h gt-cp-decl2.h : s-gtype; @true
gt-cp-pt.h gt-cp-repo.h gt-cp-spew.h gt-cp-parser.h : s-gtype; @true
gt-cp-pt.h gt-cp-repo.h gt-cp-parser.h : s-gtype; @true
gt-cp-tree.h : s-gtype; @true
#

View File

@ -3974,10 +3974,9 @@ extern void snarf_method PARAMS ((tree));
extern void note_got_semicolon PARAMS ((tree));
extern void note_list_got_semicolon PARAMS ((tree));
extern void do_pending_lang_change PARAMS ((void));
extern void see_typename PARAMS ((void));
extern void unqualified_name_lookup_error PARAMS ((tree));
extern tree do_identifier PARAMS ((tree, int, tree));
extern tree do_identifier PARAMS ((tree, tree));
extern tree do_scoped_id PARAMS ((tree, tree));
extern tree identifier_typedecl_value PARAMS ((tree));
extern tree build_lang_decl PARAMS ((enum tree_code, tree, tree));
@ -4198,7 +4197,6 @@ extern tree finish_object_call_expr PARAMS ((tree, tree, tree));
extern tree finish_qualified_object_call_expr PARAMS ((tree, tree, tree));
extern tree finish_pseudo_destructor_expr (tree, tree, tree);
extern tree finish_unary_op_expr PARAMS ((enum tree_code, tree));
extern tree finish_id_expr PARAMS ((tree));
extern tree finish_compound_literal (tree, tree);
extern tree finish_fname (tree);
extern void save_type_access_control PARAMS ((tree));

View File

@ -6081,7 +6081,6 @@ lookup_name_real (tree name,
{
tree t;
tree val = NULL_TREE;
int yylex = 0;
int val_is_implicit_typename = 0;
/* Conversion operators are handled specially because ordinary
@ -6144,7 +6143,7 @@ lookup_name_real (tree name,
if (binding
&& (!val || !IMPLICIT_TYPENAME_TYPE_DECL_P (binding)))
{
if (val_is_implicit_typename && !yylex)
if (val_is_implicit_typename)
warn_about_implicit_typename_lookup (val, binding);
val = binding;
val_is_implicit_typename
@ -6160,7 +6159,7 @@ lookup_name_real (tree name,
t = unqualified_namespace_lookup (name, flags, 0);
if (t)
{
if (val_is_implicit_typename && !yylex)
if (val_is_implicit_typename)
warn_about_implicit_typename_lookup (val, t);
val = t;
}

View File

@ -2940,7 +2940,7 @@ build_expr_from_tree (t)
switch (TREE_CODE (t))
{
case IDENTIFIER_NODE:
return do_identifier (t, 0, NULL_TREE);
return do_identifier (t, NULL_TREE);
case LOOKUP_EXPR:
if (LOOKUP_EXPR_GLOBAL (t))
@ -2950,7 +2950,7 @@ build_expr_from_tree (t)
}
else
{
t = do_identifier (TREE_OPERAND (t, 0), 0, NULL_TREE);
t = do_identifier (TREE_OPERAND (t, 0), NULL_TREE);
if (TREE_CODE (t) == ALIAS_DECL)
t = DECL_INITIAL (t);
return t;
@ -3186,7 +3186,7 @@ build_expr_from_tree (t)
|| !lookup_member (current_class_type, id, 0, 0)))
{
/* Do Koenig lookup if there are no class members. */
name = do_identifier (id, 0, args);
name = do_identifier (id, args);
}
else if (TREE_CODE (name) == TEMPLATE_ID_EXPR
|| ! really_overloaded_fn (name))

View File

@ -47,7 +47,6 @@ Boston, MA 02111-1307, USA. */
#endif
static int interface_strcmp PARAMS ((const char *));
static int *init_cpp_parse PARAMS ((void));
static void init_cp_pragma PARAMS ((void));
static tree parse_strconst_pragma PARAMS ((const char *, int));
@ -57,12 +56,6 @@ static void handle_pragma_interface PARAMS ((cpp_reader *));
static void handle_pragma_implementation PARAMS ((cpp_reader *));
static void handle_pragma_java_exceptions PARAMS ((cpp_reader *));
#ifdef GATHER_STATISTICS
#ifdef REDUCE_LENGTH
static int reduce_cmp PARAMS ((int *, int *));
static int token_cmp PARAMS ((int *, int *));
#endif
#endif
static int is_global PARAMS ((tree));
static void init_operators PARAMS ((void));
static void copy_lang_type PARAMS ((tree));
@ -76,18 +69,6 @@ static void copy_lang_type PARAMS ((tree));
#include "cpplib.h"
extern int yychar; /* the lookahead symbol */
/* the declaration found for the last IDENTIFIER token read in. yylex
must look this up to detect typedefs, which get token type
tTYPENAME, so it is left around in case the identifier is not a
typedef but is used in a context which makes it a reference to a
variable. */
tree lastiddecl;
/* Array for holding counts of the numbers of tokens seen. */
extern int *token_count;
/* Functions and data structures for #pragma interface.
`#pragma implementation' means that the main file being compiled
@ -202,20 +183,6 @@ cxx_finish ()
c_common_finish ();
}
static int *
init_cpp_parse ()
{
#ifdef GATHER_STATISTICS
#ifdef REDUCE_LENGTH
reduce_count = (int *) xcalloc (sizeof (int), (REDUCE_LENGTH + 1));
reduce_count += 1;
token_count = (int *) xcalloc (sizeof (int), (TOKEN_LENGTH + 1));
token_count += 1;
#endif
#endif
return token_count;
}
/* A mapping from tree codes to operator name information. */
operator_name_info_t operator_name_info[(int) LAST_CPLUS_TREE_CODE];
/* Similar, but for assignment operators. */
@ -492,7 +459,6 @@ cxx_init (filename)
TREE_TYPE (null_node) = c_common_type_for_size (POINTER_SIZE, 0);
ridpointers[RID_NULL] = null_node;
token_count = init_cpp_parse ();
interface_unknown = 1;
filename = c_common_init (filename);
@ -506,92 +472,6 @@ cxx_init (filename)
return filename;
}
#if defined(GATHER_STATISTICS) && defined(REDUCE_LENGTH)
static int *reduce_count;
#endif
int *token_count;
#if 0
#define REDUCE_LENGTH ARRAY_SIZE (yyr2)
#define TOKEN_LENGTH (256 + ARRAY_SIZE (yytname))
#endif
#ifdef GATHER_STATISTICS
#ifdef REDUCE_LENGTH
void
yyhook (yyn)
int yyn;
{
reduce_count[yyn] += 1;
}
static int
reduce_cmp (p, q)
int *p, *q;
{
return reduce_count[*q] - reduce_count[*p];
}
static int
token_cmp (p, q)
int *p, *q;
{
return token_count[*q] - token_count[*p];
}
#endif
#endif
void
print_parse_statistics ()
{
#ifdef GATHER_STATISTICS
#ifdef REDUCE_LENGTH
#if YYDEBUG != 0
int i;
int maxlen = REDUCE_LENGTH;
unsigned *sorted;
if (reduce_count[-1] == 0)
return;
if (TOKEN_LENGTH > REDUCE_LENGTH)
maxlen = TOKEN_LENGTH;
sorted = (unsigned *) alloca (sizeof (int) * maxlen);
for (i = 0; i < TOKEN_LENGTH; i++)
sorted[i] = i;
qsort (sorted, TOKEN_LENGTH, sizeof (int), token_cmp);
for (i = 0; i < TOKEN_LENGTH; i++)
{
int idx = sorted[i];
if (token_count[idx] == 0)
break;
if (token_count[idx] < token_count[-1])
break;
fprintf (stderr, "token %d, `%s', count = %d\n",
idx, yytname[YYTRANSLATE (idx)], token_count[idx]);
}
fprintf (stderr, "\n");
for (i = 0; i < REDUCE_LENGTH; i++)
sorted[i] = i;
qsort (sorted, REDUCE_LENGTH, sizeof (int), reduce_cmp);
for (i = 0; i < REDUCE_LENGTH; i++)
{
int idx = sorted[i];
if (reduce_count[idx] == 0)
break;
if (reduce_count[idx] < reduce_count[-1])
break;
fprintf (stderr, "rule %d, line %d, count = %d\n",
idx, yyrline[idx], reduce_count[idx]);
}
fprintf (stderr, "\n");
#endif
#endif
#endif
}
/* Helper function to load global variables with interface
information. */
@ -819,15 +699,6 @@ handle_pragma_java_exceptions (dfile)
choose_personality_routine (lang_java);
}
void
do_pending_lang_change ()
{
for (; pending_lang_change > 0; --pending_lang_change)
push_lang_context (lang_name_c);
for (; pending_lang_change < 0; ++pending_lang_change)
pop_lang_context ();
}
/* Return true if d is in a global scope. */
static int
@ -884,21 +755,13 @@ unqualified_name_lookup_error (tree name)
}
tree
do_identifier (token, parsing, args)
do_identifier (token, args)
register tree token;
int parsing;
tree args;
{
register tree id;
int lexing = (parsing == 1 || parsing == 3);
if (! lexing)
id = lookup_name (token, 0);
else
id = lastiddecl;
if (lexing && id && TREE_DEPRECATED (id))
warn_deprecated_use (id);
id = lookup_name (token, 0);
/* Do Koenig lookup if appropriate (inside templates we build lookup
expressions instead).
@ -910,11 +773,6 @@ do_identifier (token, parsing, args)
if (args && !current_template_parms && (!id || is_global (id)))
id = lookup_arg_dependent (token, id, args);
/* Remember that this name has been used in the class definition, as per
[class.scope0] */
if (id && parsing && parsing != 3)
maybe_note_name_used_in_class (token, id);
if (id == error_mark_node)
{
/* lookup_name quietly returns error_mark_node if we're parsing,

View File

@ -64,20 +64,4 @@ typedef unsigned long RID_BIT_TYPE; /* assumed at least 32 bits */
#define RIDBIT_RESET_ALL(V) do { (V) = 0; } while (0)
#endif
/* the declaration found for the last IDENTIFIER token read in.
yylex must look this up to detect typedefs, which get token type TYPENAME,
so it is left around in case the identifier is not a typedef but is
used in a context which makes it a reference to a variable. */
extern GTY(()) tree lastiddecl;
/* Back-door communication channel to the lexer. */
extern int looking_for_typename;
extern int looking_for_template;
/* Pending language change.
Positive is push count, negative is pop count. */
extern int pending_lang_change;
extern int yylex PARAMS ((void));
#endif /* ! GCC_CP_LEX_H */

File diff suppressed because it is too large Load Diff

View File

@ -1550,20 +1550,6 @@ finish_unary_op_expr (code, expr)
return result;
}
/* Finish an id-expression. */
tree
finish_id_expr (expr)
tree expr;
{
if (TREE_CODE (expr) == IDENTIFIER_NODE)
expr = do_identifier (expr, 1, NULL_TREE);
if (TREE_TYPE (expr) == error_mark_node)
expr = error_mark_node;
return expr;
}
/* Finish a compound-literal expression. TYPE is the type to which
the INITIALIZER_LIST is being cast. */

File diff suppressed because it is too large Load Diff