Commit 86ac0575 by Nathan Sidwell Committed by Nathan Sidwell

search.c: ANSIfy function declarations and definitions.

	* search.c: ANSIfy function declarations and definitions.
	* cp-tree.h (lookup_field, lookup_member): Last parameter is a bool.
	* call.c (build_method_call, resolve_scoped_fn_name,
	build_java_interface_fn_ref): Adjust lookup_field, lookup_member
	calls.
	* class.c (handle_using_decl): Likewise.
	* decl.c (make_typename_type, make_unmound_class_template,
	start_decl, compute_array_index_type): Likewise.
	* decl2.c (build_expr_from_tree, build_call_from_tree): Likewise.
	* init.c (expand_member_init, build_member_call): Likewise.
	* pt.c (tsubst_copy, tsubst_copy_and_build, do_decl_instantiation,
	resolve_typename_type): Likewise.
	* typeck.c (lookup_destructor, finish_class_member_access_exprm
	build_prememfunc_access_expr): Likewise.

From-SVN: r62939
parent 6ff741aa
2003-02-14 Nathan Sidwell <nathan@codesourcery.com>
* search.c: ANSIfy function declarations and definitions.
* cp-tree.h (lookup_field, lookup_member): Last parameter is a bool.
* call.c (build_method_call, resolve_scoped_fn_name,
build_java_interface_fn_ref): Adjust lookup_field, lookup_member
calls.
* class.c (handle_using_decl): Likewise.
* decl.c (make_typename_type, make_unmound_class_template,
start_decl, compute_array_index_type): Likewise.
* decl2.c (build_expr_from_tree, build_call_from_tree): Likewise.
* init.c (expand_member_init, build_member_call): Likewise.
* pt.c (tsubst_copy, tsubst_copy_and_build, do_decl_instantiation,
resolve_typename_type): Likewise.
* typeck.c (lookup_destructor, finish_class_member_access_exprm
build_prememfunc_access_expr): Likewise.
2003-02-13 Gabriel Dos Reis <gdr@integrable-solutions.net> 2003-02-13 Gabriel Dos Reis <gdr@integrable-solutions.net>
* decl2.c: Include "timevar.h". * decl2.c: Include "timevar.h".
......
...@@ -524,7 +524,7 @@ build_method_call (tree instance, tree name, tree parms, ...@@ -524,7 +524,7 @@ build_method_call (tree instance, tree name, tree parms,
if (has_template_args) if (has_template_args)
fn = lookup_fnfields (object_type, name, /*protect=*/2); fn = lookup_fnfields (object_type, name, /*protect=*/2);
else else
fn = lookup_member (object_type, name, /*protect=*/2, /*want_type=*/0); fn = lookup_member (object_type, name, /*protect=*/2, /*want_type=*/false);
if (fn && TREE_CODE (fn) == TREE_LIST && !BASELINK_P (fn)) if (fn && TREE_CODE (fn) == TREE_LIST && !BASELINK_P (fn))
{ {
...@@ -2623,7 +2623,7 @@ resolve_scoped_fn_name (tree scope, tree name) ...@@ -2623,7 +2623,7 @@ resolve_scoped_fn_name (tree scope, tree name)
if (BASELINK_P (name)) if (BASELINK_P (name))
fn = name; fn = name;
else else
fn = lookup_member (scope, name, /*protect=*/1, /*prefer_type=*/0); fn = lookup_member (scope, name, /*protect=*/1, /*want_type=*/false);
if (fn && current_class_type) if (fn && current_class_type)
fn = (adjust_result_of_qualified_name_lookup fn = (adjust_result_of_qualified_name_lookup
(fn, scope, current_class_type)); (fn, scope, current_class_type));
...@@ -4529,7 +4529,7 @@ build_java_interface_fn_ref (tree fn, tree instance) ...@@ -4529,7 +4529,7 @@ build_java_interface_fn_ref (tree fn, tree instance)
/* Get the java.lang.Class pointer for the interface being called. */ /* Get the java.lang.Class pointer for the interface being called. */
iface = DECL_CONTEXT (fn); iface = DECL_CONTEXT (fn);
iface_ref = lookup_field (iface, get_identifier ("class$"), 0, 0); iface_ref = lookup_field (iface, get_identifier ("class$"), 0, false);
if (!iface_ref || TREE_CODE (iface_ref) != VAR_DECL if (!iface_ref || TREE_CODE (iface_ref) != VAR_DECL
|| DECL_CONTEXT (iface_ref) != iface) || DECL_CONTEXT (iface_ref) != iface)
{ {
......
...@@ -1122,7 +1122,7 @@ handle_using_decl (tree using_decl, tree t) ...@@ -1122,7 +1122,7 @@ handle_using_decl (tree using_decl, tree t)
return; return;
} }
fdecl = lookup_member (binfo, name, 0, 0); fdecl = lookup_member (binfo, name, 0, false);
if (!fdecl) if (!fdecl)
{ {
......
...@@ -4121,10 +4121,10 @@ extern int types_overlap_p (tree, tree); ...@@ -4121,10 +4121,10 @@ extern int types_overlap_p (tree, tree);
extern tree get_vbase (tree, tree); extern tree get_vbase (tree, tree);
extern tree get_dynamic_cast_base_type (tree, tree); extern tree get_dynamic_cast_base_type (tree, tree);
extern int accessible_p (tree, tree); extern int accessible_p (tree, tree);
extern tree lookup_field (tree, tree, int, int); extern tree lookup_field (tree, tree, int, bool);
extern int lookup_fnfields_1 (tree, tree); extern int lookup_fnfields_1 (tree, tree);
extern tree lookup_fnfields (tree, tree, int); extern tree lookup_fnfields (tree, tree, int);
extern tree lookup_member (tree, tree, int, int); extern tree lookup_member (tree, tree, int, bool);
extern int look_for_overrides (tree, tree); extern int look_for_overrides (tree, tree);
extern void get_pure_virtuals (tree); extern void get_pure_virtuals (tree);
extern void get_vbase_types (tree); extern void get_vbase_types (tree);
......
...@@ -5560,7 +5560,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain) ...@@ -5560,7 +5560,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain)
{ {
tree tmpl = NULL_TREE; tree tmpl = NULL_TREE;
if (IS_AGGR_TYPE (context)) if (IS_AGGR_TYPE (context))
tmpl = lookup_field (context, name, 0, 0); tmpl = lookup_field (context, name, 0, false);
if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl)) if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl))
{ {
if (complain & tf_error) if (complain & tf_error)
...@@ -5594,7 +5594,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain) ...@@ -5594,7 +5594,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain)
return error_mark_node; return error_mark_node;
} }
t = lookup_field (context, name, 0, 1); t = lookup_field (context, name, 0, true);
if (t) if (t)
{ {
if (TREE_CODE (t) != TYPE_DECL) if (TREE_CODE (t) != TYPE_DECL)
...@@ -5657,7 +5657,7 @@ make_unbound_class_template (tree context, tree name, tsubst_flags_t complain) ...@@ -5657,7 +5657,7 @@ make_unbound_class_template (tree context, tree name, tsubst_flags_t complain)
tree tmpl = NULL_TREE; tree tmpl = NULL_TREE;
if (IS_AGGR_TYPE (context)) if (IS_AGGR_TYPE (context))
tmpl = lookup_field (context, name, 0, 0); tmpl = lookup_field (context, name, 0, false);
if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl)) if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl))
{ {
...@@ -7099,7 +7099,7 @@ start_decl (tree declarator, ...@@ -7099,7 +7099,7 @@ start_decl (tree declarator,
if (TREE_CODE (decl) == VAR_DECL) if (TREE_CODE (decl) == VAR_DECL)
{ {
tree field = lookup_field (context, DECL_NAME (decl), 0, 0); tree field = lookup_field (context, DECL_NAME (decl), 0, false);
if (field == NULL_TREE || TREE_CODE (field) != VAR_DECL) if (field == NULL_TREE || TREE_CODE (field) != VAR_DECL)
error ("`%#D' is not a static member of `%#T'", decl, context); error ("`%#D' is not a static member of `%#T'", decl, context);
else else
...@@ -9378,7 +9378,7 @@ compute_array_index_type (tree name, tree size) ...@@ -9378,7 +9378,7 @@ compute_array_index_type (tree name, tree size)
&& TREE_OPERAND (size, 0) == current_class_type) && TREE_OPERAND (size, 0) == current_class_type)
{ {
tree t = lookup_field (current_class_type, tree t = lookup_field (current_class_type,
TREE_OPERAND (size, 1), 0, 0); TREE_OPERAND (size, 1), 0, false);
if (t) if (t)
size = t; size = t;
} }
......
/* Process declarations and variables for C++ compiler. /* Process declarations and variables for C++ compiler.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002 Free Software Foundation, Inc. 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com) Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC. This file is part of GCC.
...@@ -3087,7 +3087,7 @@ build_expr_from_tree (t) ...@@ -3087,7 +3087,7 @@ build_expr_from_tree (t)
&& !LOOKUP_EXPR_GLOBAL (name) && !LOOKUP_EXPR_GLOBAL (name)
&& TREE_CODE ((id = TREE_OPERAND (name, 0))) == IDENTIFIER_NODE && TREE_CODE ((id = TREE_OPERAND (name, 0))) == IDENTIFIER_NODE
&& (!current_class_type && (!current_class_type
|| !lookup_member (current_class_type, id, 0, 0))) || !lookup_member (current_class_type, id, 0, false)))
{ {
/* Do Koenig lookup if there are no class members. */ /* Do Koenig lookup if there are no class members. */
name = do_identifier (id, args); name = do_identifier (id, args);
...@@ -3325,7 +3325,7 @@ build_call_from_tree (tree fn, tree args, bool disallow_virtual) ...@@ -3325,7 +3325,7 @@ build_call_from_tree (tree fn, tree args, bool disallow_virtual)
&& DECL_FUNCTION_MEMBER_P (f)))) && DECL_FUNCTION_MEMBER_P (f))))
{ {
f = lookup_member (current_class_type, DECL_NAME (f), f = lookup_member (current_class_type, DECL_NAME (f),
/*protect=*/1, /*want_type=*/0); /*protect=*/1, /*want_type=*/false);
if (f) if (f)
fn = f; fn = f;
} }
......
...@@ -1026,7 +1026,7 @@ expand_member_init (tree name, tree init) ...@@ -1026,7 +1026,7 @@ expand_member_init (tree name, tree init)
else else
{ {
if (TREE_CODE (name) == IDENTIFIER_NODE) if (TREE_CODE (name) == IDENTIFIER_NODE)
field = lookup_field (current_class_type, name, 1, 0); field = lookup_field (current_class_type, name, 1, false);
else else
field = name; field = name;
...@@ -1490,7 +1490,7 @@ build_member_call (type, name, parmlist) ...@@ -1490,7 +1490,7 @@ build_member_call (type, name, parmlist)
if (constructor_name_p (method_name, type)) if (constructor_name_p (method_name, type))
return build_functional_cast (type, parmlist); return build_functional_cast (type, parmlist);
if (TREE_CODE (name) == IDENTIFIER_NODE if (TREE_CODE (name) == IDENTIFIER_NODE
&& ((t = lookup_field (TYPE_BINFO (type), name, 1, 0)))) && ((t = lookup_field (TYPE_BINFO (type), name, 1, false))))
{ {
if (t == error_mark_node) if (t == error_mark_node)
return error_mark_node; return error_mark_node;
......
...@@ -7176,7 +7176,7 @@ tsubst_copy (t, args, complain, in_decl) ...@@ -7176,7 +7176,7 @@ tsubst_copy (t, args, complain, in_decl)
ctx = tsubst_aggr_type (DECL_CONTEXT (t), args, complain, in_decl, ctx = tsubst_aggr_type (DECL_CONTEXT (t), args, complain, in_decl,
/*entering_scope=*/1); /*entering_scope=*/1);
if (ctx != DECL_CONTEXT (t)) if (ctx != DECL_CONTEXT (t))
return lookup_field (ctx, DECL_NAME (t), 0, 0); return lookup_field (ctx, DECL_NAME (t), 0, false);
} }
return t; return t;
...@@ -8166,7 +8166,7 @@ tsubst_copy_and_build (t, args, complain, in_decl) ...@@ -8166,7 +8166,7 @@ tsubst_copy_and_build (t, args, complain, in_decl)
&& (TREE_CODE ((id = TREE_OPERAND (name, 0))) && (TREE_CODE ((id = TREE_OPERAND (name, 0)))
== IDENTIFIER_NODE) == IDENTIFIER_NODE)
&& (!current_class_type && (!current_class_type
|| !lookup_member (current_class_type, id, 0, 0))) || !lookup_member (current_class_type, id, 0, false)))
{ {
/* Do Koenig lookup if there are no class members. */ /* Do Koenig lookup if there are no class members. */
name = do_identifier (id, copy_args); name = do_identifier (id, copy_args);
...@@ -10235,7 +10235,7 @@ do_decl_instantiation (tree decl, tree storage) ...@@ -10235,7 +10235,7 @@ do_decl_instantiation (tree decl, tree storage)
VAR_DECLs so we do the lookup here. Probably, grokdeclarator VAR_DECLs so we do the lookup here. Probably, grokdeclarator
should handle VAR_DECLs as it currently handles should handle VAR_DECLs as it currently handles
FUNCTION_DECLs. */ FUNCTION_DECLs. */
result = lookup_field (DECL_CONTEXT (decl), DECL_NAME (decl), 0, 0); result = lookup_field (DECL_CONTEXT (decl), DECL_NAME (decl), 0, false);
if (!result || TREE_CODE (result) != VAR_DECL) if (!result || TREE_CODE (result) != VAR_DECL)
{ {
error ("no matching template for `%D' found", decl); error ("no matching template for `%D' found", decl);
...@@ -11546,7 +11546,7 @@ resolve_typename_type (tree type, bool only_current_p) ...@@ -11546,7 +11546,7 @@ resolve_typename_type (tree type, bool only_current_p)
longer be considered a dependent type. */ longer be considered a dependent type. */
push_scope (scope); push_scope (scope);
/* Look up the declaration. */ /* Look up the declaration. */
decl = lookup_member (scope, name, /*protect=*/0, /*want_type=*/1); decl = lookup_member (scope, name, /*protect=*/0, /*want_type=*/true);
/* Obtain the set of qualifiers applied to the TYPE. */ /* Obtain the set of qualifiers applied to the TYPE. */
quals = cp_type_quals (type); quals = cp_type_quals (type);
/* For a TYPENAME_TYPE like "typename X::template Y<T>", we want to /* For a TYPENAME_TYPE like "typename X::template Y<T>", we want to
......
/* Build expressions with type checking for C++ compiler. /* Build expressions with type checking for C++ compiler.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002 Free Software Foundation, Inc. 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com) Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC. This file is part of GCC.
...@@ -2101,7 +2101,7 @@ lookup_destructor (tree object, tree scope, tree dtor_name) ...@@ -2101,7 +2101,7 @@ lookup_destructor (tree object, tree scope, tree dtor_name)
return build (PSEUDO_DTOR_EXPR, void_type_node, object, scope, return build (PSEUDO_DTOR_EXPR, void_type_node, object, scope,
dtor_type); dtor_type);
return lookup_member (object_type, complete_dtor_identifier, return lookup_member (object_type, complete_dtor_identifier,
/*protect=*/1, /*want_type=*/0); /*protect=*/1, /*want_type=*/false);
} }
/* This function is called by the parser to process a class member /* This function is called by the parser to process a class member
...@@ -2205,7 +2205,7 @@ finish_class_member_access_expr (tree object, tree name) ...@@ -2205,7 +2205,7 @@ finish_class_member_access_expr (tree object, tree name)
{ {
/* Look up the member. */ /* Look up the member. */
member = lookup_member (access_path, name, /*protect=*/1, member = lookup_member (access_path, name, /*protect=*/1,
/*want_type=*/0); /*want_type=*/false);
if (member == NULL_TREE) if (member == NULL_TREE)
{ {
error ("'%D' has no member named '%E'", object_type, name); error ("'%D' has no member named '%E'", object_type, name);
...@@ -2221,7 +2221,7 @@ finish_class_member_access_expr (tree object, tree name) ...@@ -2221,7 +2221,7 @@ finish_class_member_access_expr (tree object, tree name)
{ {
/* An unqualified name. */ /* An unqualified name. */
member = lookup_member (object_type, name, /*protect=*/1, member = lookup_member (object_type, name, /*protect=*/1,
/*want_type=*/0); /*want_type=*/false);
if (member == NULL_TREE) if (member == NULL_TREE)
{ {
error ("'%D' has no member named '%E'", object_type, name); error ("'%D' has no member named '%E'", object_type, name);
...@@ -2285,7 +2285,7 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree member_name) ...@@ -2285,7 +2285,7 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree member_name)
ptrmem_type = TREE_TYPE (ptrmem); ptrmem_type = TREE_TYPE (ptrmem);
my_friendly_assert (TYPE_PTRMEMFUNC_P (ptrmem_type), 20020804); my_friendly_assert (TYPE_PTRMEMFUNC_P (ptrmem_type), 20020804);
member = lookup_member (ptrmem_type, member_name, /*protect=*/0, member = lookup_member (ptrmem_type, member_name, /*protect=*/0,
/*want_type=*/0); /*want_type=*/false);
member_type = cp_build_qualified_type (TREE_TYPE (member), member_type = cp_build_qualified_type (TREE_TYPE (member),
cp_type_quals (ptrmem_type)); cp_type_quals (ptrmem_type));
return fold (build (COMPONENT_REF, member_type, ptrmem, member)); return fold (build (COMPONENT_REF, member_type, ptrmem, member));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment