Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
a1c65f9f
Commit
a1c65f9f
authored
Sep 13, 2002
by
Kazu Hirata
Committed by
Kazu Hirata
Sep 13, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decl.c: Fix comment formatting.
* decl.c: Fix comment formatting. * decl2.c: Likewise. From-SVN: r57104
parent
4456530d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
141 additions
and
136 deletions
+141
-136
gcc/cp/ChangeLog
+5
-0
gcc/cp/decl.c
+73
-73
gcc/cp/decl2.c
+63
-63
No files found.
gcc/cp/ChangeLog
View file @
a1c65f9f
2002-09-13 Kazu Hirata <kazu@cs.umass.edu>
* decl.c: Fix comment formatting.
* decl2.c: Likewise.
2002-09-12 Kazu Hirata <kazu@cs.umass.edu>
2002-09-12 Kazu Hirata <kazu@cs.umass.edu>
* call.c: Fix comment formatting.
* call.c: Fix comment formatting.
...
...
gcc/cp/decl.c
View file @
a1c65f9f
...
@@ -203,7 +203,7 @@ tree cp_global_trees[CPTI_MAX];
...
@@ -203,7 +203,7 @@ tree cp_global_trees[CPTI_MAX];
static
GTY
(())
tree
global_type_node
;
static
GTY
(())
tree
global_type_node
;
/* Expect only namespace names now. */
/* Expect only namespace names now.
*/
static
int
only_namespace_names
;
static
int
only_namespace_names
;
/* Used only for jumps to as-yet undefined labels, since jumps to
/* Used only for jumps to as-yet undefined labels, since jumps to
...
@@ -329,11 +329,11 @@ struct cp_binding_level GTY(())
...
@@ -329,11 +329,11 @@ struct cp_binding_level GTY(())
component_bindings. */
component_bindings. */
tree
tags
;
tree
tags
;
/* A list of USING_DECL nodes. */
/* A list of USING_DECL nodes.
*/
tree
usings
;
tree
usings
;
/* A list of used namespaces. PURPOSE is the namespace,
/* A list of used namespaces. PURPOSE is the namespace,
VALUE the common ancestor with this binding_level's namespace. */
VALUE the common ancestor with this binding_level's namespace.
*/
tree
using_directives
;
tree
using_directives
;
/* If this binding level is the binding level for a class, then
/* If this binding level is the binding level for a class, then
...
@@ -576,7 +576,7 @@ resume_binding_level (b)
...
@@ -576,7 +576,7 @@ resume_binding_level (b)
struct
cp_binding_level
*
b
;
struct
cp_binding_level
*
b
;
{
{
/* Resuming binding levels is meant only for namespaces,
/* Resuming binding levels is meant only for namespaces,
and those cannot nest into classes. */
and those cannot nest into classes.
*/
my_friendly_assert
(
!
class_binding_level
,
386
);
my_friendly_assert
(
!
class_binding_level
,
386
);
/* Also, resuming a non-directly nested namespace is a no-no. */
/* Also, resuming a non-directly nested namespace is a no-no. */
my_friendly_assert
(
b
->
level_chain
==
current_binding_level
,
386
);
my_friendly_assert
(
b
->
level_chain
==
current_binding_level
,
386
);
...
@@ -2053,11 +2053,11 @@ print_binding_stack ()
...
@@ -2053,11 +2053,11 @@ print_binding_stack ()
/* Namespace binding access routines: The namespace_bindings field of
/* Namespace binding access routines: The namespace_bindings field of
the identifier is polymorphic, with three possible values:
the identifier is polymorphic, with three possible values:
NULL_TREE, a list of CPLUS_BINDINGS, or any other tree_node
NULL_TREE, a list of CPLUS_BINDINGS, or any other tree_node
indicating the BINDING_VALUE of global_namespace. */
indicating the BINDING_VALUE of global_namespace.
*/
/* Check whether the a binding for the name to scope is known.
/* Check whether the a binding for the name to scope is known.
Assumes that the bindings of the name are already a list
Assumes that the bindings of the name are already a list
of bindings. Returns the binding found, or NULL_TREE. */
of bindings. Returns the binding found, or NULL_TREE.
*/
static
tree
static
tree
find_binding
(
name
,
scope
)
find_binding
(
name
,
scope
)
...
@@ -2075,7 +2075,7 @@ find_binding (name, scope)
...
@@ -2075,7 +2075,7 @@ find_binding (name, scope)
if
(
BINDING_SCOPE
(
iter
)
==
scope
)
if
(
BINDING_SCOPE
(
iter
)
==
scope
)
{
{
/* Move binding found to the front of the list, so
/* Move binding found to the front of the list, so
subsequent lookups will find it faster. */
subsequent lookups will find it faster.
*/
if
(
prev
)
if
(
prev
)
{
{
TREE_CHAIN
(
prev
)
=
TREE_CHAIN
(
iter
);
TREE_CHAIN
(
prev
)
=
TREE_CHAIN
(
iter
);
...
@@ -2091,7 +2091,7 @@ find_binding (name, scope)
...
@@ -2091,7 +2091,7 @@ find_binding (name, scope)
/* Always returns a binding for name in scope. If the
/* Always returns a binding for name in scope. If the
namespace_bindings is not a list, convert it to one first.
namespace_bindings is not a list, convert it to one first.
If no binding is found, make a new one. */
If no binding is found, make a new one.
*/
tree
tree
binding_for_name
(
name
,
scope
)
binding_for_name
(
name
,
scope
)
...
@@ -2105,14 +2105,14 @@ binding_for_name (name, scope)
...
@@ -2105,14 +2105,14 @@ binding_for_name (name, scope)
if
(
b
&&
TREE_CODE
(
b
)
!=
CPLUS_BINDING
)
if
(
b
&&
TREE_CODE
(
b
)
!=
CPLUS_BINDING
)
{
{
/* Get rid of optimization for global scope. */
/* Get rid of optimization for global scope.
*/
IDENTIFIER_NAMESPACE_BINDINGS
(
name
)
=
NULL_TREE
;
IDENTIFIER_NAMESPACE_BINDINGS
(
name
)
=
NULL_TREE
;
BINDING_VALUE
(
binding_for_name
(
name
,
global_namespace
))
=
b
;
BINDING_VALUE
(
binding_for_name
(
name
,
global_namespace
))
=
b
;
b
=
IDENTIFIER_NAMESPACE_BINDINGS
(
name
);
b
=
IDENTIFIER_NAMESPACE_BINDINGS
(
name
);
}
}
if
(
b
&&
(
result
=
find_binding
(
name
,
scope
)))
if
(
b
&&
(
result
=
find_binding
(
name
,
scope
)))
return
result
;
return
result
;
/* Not found, make a new one. */
/* Not found, make a new one.
*/
result
=
make_node
(
CPLUS_BINDING
);
result
=
make_node
(
CPLUS_BINDING
);
TREE_CHAIN
(
result
)
=
b
;
TREE_CHAIN
(
result
)
=
b
;
IDENTIFIER_NAMESPACE_BINDINGS
(
name
)
=
result
;
IDENTIFIER_NAMESPACE_BINDINGS
(
name
)
=
result
;
...
@@ -2123,7 +2123,7 @@ binding_for_name (name, scope)
...
@@ -2123,7 +2123,7 @@ binding_for_name (name, scope)
}
}
/* Return the binding value for name in scope, considering that
/* Return the binding value for name in scope, considering that
namespace_binding may or may not be a list of CPLUS_BINDINGS. */
namespace_binding may or may not be a list of CPLUS_BINDINGS.
*/
tree
tree
namespace_binding
(
name
,
scope
)
namespace_binding
(
name
,
scope
)
...
@@ -2144,7 +2144,7 @@ namespace_binding (name, scope)
...
@@ -2144,7 +2144,7 @@ namespace_binding (name, scope)
}
}
/* Set the binding value for name in scope. If modifying the binding
/* Set the binding value for name in scope. If modifying the binding
of global_namespace is attempted, try to optimize it. */
of global_namespace is attempted, try to optimize it.
*/
void
void
set_namespace_binding
(
name
,
scope
,
val
)
set_namespace_binding
(
name
,
scope
,
val
)
...
@@ -2183,7 +2183,7 @@ push_namespace (name)
...
@@ -2183,7 +2183,7 @@ push_namespace (name)
int
global
=
0
;
int
global
=
0
;
if
(
!
global_namespace
)
if
(
!
global_namespace
)
{
{
/* This must be ::. */
/* This must be ::.
*/
my_friendly_assert
(
name
==
get_identifier
(
"::"
),
377
);
my_friendly_assert
(
name
==
get_identifier
(
"::"
),
377
);
global
=
1
;
global
=
1
;
}
}
...
@@ -2202,7 +2202,7 @@ push_namespace (name)
...
@@ -2202,7 +2202,7 @@ push_namespace (name)
}
}
else
else
{
{
/* Check whether this is an extended namespace definition. */
/* Check whether this is an extended namespace definition.
*/
d
=
IDENTIFIER_NAMESPACE_VALUE
(
name
);
d
=
IDENTIFIER_NAMESPACE_VALUE
(
name
);
if
(
d
!=
NULL_TREE
&&
TREE_CODE
(
d
)
==
NAMESPACE_DECL
)
if
(
d
!=
NULL_TREE
&&
TREE_CODE
(
d
)
==
NAMESPACE_DECL
)
{
{
...
@@ -2218,7 +2218,7 @@ push_namespace (name)
...
@@ -2218,7 +2218,7 @@ push_namespace (name)
if
(
need_new
)
if
(
need_new
)
{
{
/* Make a new namespace, binding the name to it. */
/* Make a new namespace, binding the name to it.
*/
d
=
build_lang_decl
(
NAMESPACE_DECL
,
name
,
void_type_node
);
d
=
build_lang_decl
(
NAMESPACE_DECL
,
name
,
void_type_node
);
/* The global namespace is not pushed, and the global binding
/* The global namespace is not pushed, and the global binding
level is set elsewhere. */
level is set elsewhere. */
...
@@ -2236,7 +2236,7 @@ push_namespace (name)
...
@@ -2236,7 +2236,7 @@ push_namespace (name)
if
(
implicit_use
)
if
(
implicit_use
)
do_using_directive
(
d
);
do_using_directive
(
d
);
/* Enter the name space. */
/* Enter the name space.
*/
current_namespace
=
d
;
current_namespace
=
d
;
}
}
...
@@ -2455,7 +2455,7 @@ set_identifier_type_value_with_scope (id, type, b)
...
@@ -2455,7 +2455,7 @@ set_identifier_type_value_with_scope (id, type, b)
if
(
!
b
->
namespace_p
)
if
(
!
b
->
namespace_p
)
{
{
/* Shadow the marker, not the real thing, so that the marker
/* Shadow the marker, not the real thing, so that the marker
gets restored later. */
gets restored later.
*/
tree
old_type_value
=
REAL_IDENTIFIER_TYPE_VALUE
(
id
);
tree
old_type_value
=
REAL_IDENTIFIER_TYPE_VALUE
(
id
);
b
->
type_shadowed
b
->
type_shadowed
=
tree_cons
(
id
,
old_type_value
,
b
->
type_shadowed
);
=
tree_cons
(
id
,
old_type_value
,
b
->
type_shadowed
);
...
@@ -2464,7 +2464,7 @@ set_identifier_type_value_with_scope (id, type, b)
...
@@ -2464,7 +2464,7 @@ set_identifier_type_value_with_scope (id, type, b)
{
{
tree
binding
=
binding_for_name
(
id
,
current_namespace
);
tree
binding
=
binding_for_name
(
id
,
current_namespace
);
BINDING_TYPE
(
binding
)
=
type
;
BINDING_TYPE
(
binding
)
=
type
;
/* Store marker instead of real type. */
/* Store marker instead of real type.
*/
type
=
global_type_node
;
type
=
global_type_node
;
}
}
SET_IDENTIFIER_TYPE_VALUE
(
id
,
type
);
SET_IDENTIFIER_TYPE_VALUE
(
id
,
type
);
...
@@ -2480,20 +2480,20 @@ set_identifier_type_value (id, type)
...
@@ -2480,20 +2480,20 @@ set_identifier_type_value (id, type)
set_identifier_type_value_with_scope
(
id
,
type
,
current_binding_level
);
set_identifier_type_value_with_scope
(
id
,
type
,
current_binding_level
);
}
}
/* Return the type associated with id. */
/* Return the type associated with id.
*/
tree
tree
identifier_type_value
(
id
)
identifier_type_value
(
id
)
tree
id
;
tree
id
;
{
{
/* There is no type with that name, anywhere. */
/* There is no type with that name, anywhere.
*/
if
(
REAL_IDENTIFIER_TYPE_VALUE
(
id
)
==
NULL_TREE
)
if
(
REAL_IDENTIFIER_TYPE_VALUE
(
id
)
==
NULL_TREE
)
return
NULL_TREE
;
return
NULL_TREE
;
/* This is not the type marker, but the real thing. */
/* This is not the type marker, but the real thing.
*/
if
(
REAL_IDENTIFIER_TYPE_VALUE
(
id
)
!=
global_type_node
)
if
(
REAL_IDENTIFIER_TYPE_VALUE
(
id
)
!=
global_type_node
)
return
REAL_IDENTIFIER_TYPE_VALUE
(
id
);
return
REAL_IDENTIFIER_TYPE_VALUE
(
id
);
/* Have to search for it. It must be on the global level, now.
/* Have to search for it. It must be on the global level, now.
Ask lookup_name not to return non-types. */
Ask lookup_name not to return non-types.
*/
id
=
lookup_name_real
(
id
,
2
,
1
,
0
);
id
=
lookup_name_real
(
id
,
2
,
1
,
0
);
if
(
id
)
if
(
id
)
return
TREE_TYPE
(
id
);
return
TREE_TYPE
(
id
);
...
@@ -2666,7 +2666,7 @@ pushtag (name, type, globalize)
...
@@ -2666,7 +2666,7 @@ pushtag (name, type, globalize)
/* We may be defining a new type in the initializer
/* We may be defining a new type in the initializer
of a static member variable. We allow this when
of a static member variable. We allow this when
not pedantic, and it is particularly useful for
not pedantic, and it is particularly useful for
type punning via an anonymous union. */
type punning via an anonymous union.
*/
||
COMPLETE_TYPE_P
(
b
->
this_class
))))
||
COMPLETE_TYPE_P
(
b
->
this_class
))))
b
=
b
->
level_chain
;
b
=
b
->
level_chain
;
...
@@ -3025,7 +3025,7 @@ duplicate_decls (newdecl, olddecl)
...
@@ -3025,7 +3025,7 @@ duplicate_decls (newdecl, olddecl)
}
}
}
}
/* Check for redeclaration and other discrepancies. */
/* Check for redeclaration and other discrepancies.
*/
if
(
TREE_CODE
(
olddecl
)
==
FUNCTION_DECL
if
(
TREE_CODE
(
olddecl
)
==
FUNCTION_DECL
&&
DECL_ARTIFICIAL
(
olddecl
))
&&
DECL_ARTIFICIAL
(
olddecl
))
{
{
...
@@ -3227,7 +3227,7 @@ duplicate_decls (newdecl, olddecl)
...
@@ -3227,7 +3227,7 @@ duplicate_decls (newdecl, olddecl)
else
if
(
TREE_CODE
(
newdecl
)
==
NAMESPACE_DECL
else
if
(
TREE_CODE
(
newdecl
)
==
NAMESPACE_DECL
&&
DECL_NAMESPACE_ALIAS
(
newdecl
)
&&
DECL_NAMESPACE_ALIAS
(
newdecl
)
&&
DECL_NAMESPACE_ALIAS
(
newdecl
)
==
DECL_NAMESPACE_ALIAS
(
olddecl
))
&&
DECL_NAMESPACE_ALIAS
(
newdecl
)
==
DECL_NAMESPACE_ALIAS
(
olddecl
))
/* Redeclaration of namespace alias, ignore it. */
/* Redeclaration of namespace alias, ignore it.
*/
return
1
;
return
1
;
else
else
{
{
...
@@ -3357,9 +3357,9 @@ duplicate_decls (newdecl, olddecl)
...
@@ -3357,9 +3357,9 @@ duplicate_decls (newdecl, olddecl)
definition. */
definition. */
if
(
warn_redundant_decls
&&
!
DECL_ARTIFICIAL
(
olddecl
)
if
(
warn_redundant_decls
&&
!
DECL_ARTIFICIAL
(
olddecl
)
&&
!
(
new_defines_function
&&
DECL_INITIAL
(
olddecl
)
==
NULL_TREE
)
&&
!
(
new_defines_function
&&
DECL_INITIAL
(
olddecl
)
==
NULL_TREE
)
/* Don't warn about extern decl followed by definition. */
/* Don't warn about extern decl followed by definition.
*/
&&
!
(
DECL_EXTERNAL
(
olddecl
)
&&
!
DECL_EXTERNAL
(
newdecl
))
&&
!
(
DECL_EXTERNAL
(
olddecl
)
&&
!
DECL_EXTERNAL
(
newdecl
))
/* Don't warn about friends, let add_friend take care of it. */
/* Don't warn about friends, let add_friend take care of it.
*/
&&
!
(
DECL_FRIEND_P
(
newdecl
)
||
DECL_FRIEND_P
(
olddecl
)))
&&
!
(
DECL_FRIEND_P
(
newdecl
)
||
DECL_FRIEND_P
(
olddecl
)))
{
{
warning
(
"redundant redeclaration of `%D' in same scope"
,
newdecl
);
warning
(
"redundant redeclaration of `%D' in same scope"
,
newdecl
);
...
@@ -3860,7 +3860,7 @@ pushdecl (x)
...
@@ -3860,7 +3860,7 @@ pushdecl (x)
else
if
((
DECL_EXTERN_C_FUNCTION_P
(
x
)
else
if
((
DECL_EXTERN_C_FUNCTION_P
(
x
)
||
DECL_FUNCTION_TEMPLATE_P
(
x
))
||
DECL_FUNCTION_TEMPLATE_P
(
x
))
&&
is_overloaded_fn
(
t
))
&&
is_overloaded_fn
(
t
))
/* Don't do anything just yet. */
;
/* Don't do anything just yet.
*/
;
else
if
(
t
==
wchar_decl_node
)
else
if
(
t
==
wchar_decl_node
)
{
{
if
(
pedantic
&&
!
DECL_IN_SYSTEM_HEADER
(
x
))
if
(
pedantic
&&
!
DECL_IN_SYSTEM_HEADER
(
x
))
...
@@ -3931,7 +3931,7 @@ pushdecl (x)
...
@@ -3931,7 +3931,7 @@ pushdecl (x)
/* If declaring a type as a typedef, copy the type (unless we're
/* If declaring a type as a typedef, copy the type (unless we're
at line 0), and install this TYPE_DECL as the new type's typedef
at line 0), and install this TYPE_DECL as the new type's typedef
name. See the extensive comment in ../c-decl.c (pushdecl). */
name. See the extensive comment in ../c-decl.c (pushdecl).
*/
if
(
TREE_CODE
(
x
)
==
TYPE_DECL
)
if
(
TREE_CODE
(
x
)
==
TYPE_DECL
)
{
{
tree
type
=
TREE_TYPE
(
x
);
tree
type
=
TREE_TYPE
(
x
);
...
@@ -4301,7 +4301,7 @@ maybe_push_decl (decl)
...
@@ -4301,7 +4301,7 @@ maybe_push_decl (decl)
||
(
TREE_CODE
(
decl
)
!=
PARM_DECL
||
(
TREE_CODE
(
decl
)
!=
PARM_DECL
&&
DECL_CONTEXT
(
decl
)
!=
NULL_TREE
&&
DECL_CONTEXT
(
decl
)
!=
NULL_TREE
/* Definitions of namespace members outside their namespace are
/* Definitions of namespace members outside their namespace are
possible. */
possible.
*/
&&
TREE_CODE
(
DECL_CONTEXT
(
decl
))
!=
NAMESPACE_DECL
)
&&
TREE_CODE
(
DECL_CONTEXT
(
decl
))
!=
NAMESPACE_DECL
)
||
(
TREE_CODE
(
decl
)
==
TEMPLATE_DECL
&&
!
namespace_bindings_p
())
||
(
TREE_CODE
(
decl
)
==
TEMPLATE_DECL
&&
!
namespace_bindings_p
())
||
TREE_CODE
(
type
)
==
UNKNOWN_TYPE
||
TREE_CODE
(
type
)
==
UNKNOWN_TYPE
...
@@ -4431,11 +4431,11 @@ push_using_directive (used)
...
@@ -4431,11 +4431,11 @@ push_using_directive (used)
tree
ud
=
current_binding_level
->
using_directives
;
tree
ud
=
current_binding_level
->
using_directives
;
tree
iter
,
ancestor
;
tree
iter
,
ancestor
;
/* Check if we already have this. */
/* Check if we already have this.
*/
if
(
purpose_member
(
used
,
ud
)
!=
NULL_TREE
)
if
(
purpose_member
(
used
,
ud
)
!=
NULL_TREE
)
return
NULL_TREE
;
return
NULL_TREE
;
/* Recursively add all namespaces used. */
/* Recursively add all namespaces used.
*/
for
(
iter
=
DECL_NAMESPACE_USING
(
used
);
iter
;
iter
=
TREE_CHAIN
(
iter
))
for
(
iter
=
DECL_NAMESPACE_USING
(
used
);
iter
;
iter
=
TREE_CHAIN
(
iter
))
push_using_directive
(
TREE_PURPOSE
(
iter
));
push_using_directive
(
TREE_PURPOSE
(
iter
));
...
@@ -4643,7 +4643,7 @@ redeclaration_error_message (newdecl, olddecl)
...
@@ -4643,7 +4643,7 @@ redeclaration_error_message (newdecl, olddecl)
return
0
;
return
0
;
/* If both functions come from different namespaces, this is not
/* If both functions come from different namespaces, this is not
a redeclaration - this is a conflict with a used function. */
a redeclaration - this is a conflict with a used function.
*/
if
(
DECL_NAMESPACE_SCOPE_P
(
olddecl
)
if
(
DECL_NAMESPACE_SCOPE_P
(
olddecl
)
&&
DECL_CONTEXT
(
olddecl
)
!=
DECL_CONTEXT
(
newdecl
))
&&
DECL_CONTEXT
(
olddecl
)
!=
DECL_CONTEXT
(
newdecl
))
return
"`%D' conflicts with used function"
;
return
"`%D' conflicts with used function"
;
...
@@ -5273,7 +5273,7 @@ lookup_tag (form, name, binding_level, thislevel_only)
...
@@ -5273,7 +5273,7 @@ lookup_tag (form, name, binding_level, thislevel_only)
return
TREE_VALUE
(
tail
);
return
TREE_VALUE
(
tail
);
}
}
else
if
(
level
->
namespace_p
)
else
if
(
level
->
namespace_p
)
/* Do namespace lookup. */
/* Do namespace lookup.
*/
for
(
tail
=
current_namespace
;
1
;
tail
=
CP_DECL_CONTEXT
(
tail
))
for
(
tail
=
current_namespace
;
1
;
tail
=
CP_DECL_CONTEXT
(
tail
))
{
{
tree
old
=
binding_for_name
(
name
,
tail
);
tree
old
=
binding_for_name
(
name
,
tail
);
...
@@ -5402,7 +5402,7 @@ lookup_namespace_name (namespace, name)
...
@@ -5402,7 +5402,7 @@ lookup_namespace_name (namespace, name)
my_friendly_assert
(
TREE_CODE
(
namespace
)
==
NAMESPACE_DECL
,
370
);
my_friendly_assert
(
TREE_CODE
(
namespace
)
==
NAMESPACE_DECL
,
370
);
if
(
TREE_CODE
(
name
)
==
NAMESPACE_DECL
)
if
(
TREE_CODE
(
name
)
==
NAMESPACE_DECL
)
/* This happens for A::B<int> when B is a namespace. */
/* This happens for A::B<int> when B is a namespace.
*/
return
name
;
return
name
;
else
if
(
TREE_CODE
(
name
)
==
TEMPLATE_DECL
)
else
if
(
TREE_CODE
(
name
)
==
TEMPLATE_DECL
)
{
{
...
@@ -5750,7 +5750,7 @@ make_unbound_class_template (context, name, complain)
...
@@ -5750,7 +5750,7 @@ make_unbound_class_template (context, name, complain)
return
t
;
return
t
;
}
}
/* Select the right _DECL from multiple choices. */
/* Select the right _DECL from multiple choices.
*/
static
tree
static
tree
select_decl
(
binding
,
flags
)
select_decl
(
binding
,
flags
)
...
@@ -5762,7 +5762,7 @@ select_decl (binding, flags)
...
@@ -5762,7 +5762,7 @@ select_decl (binding, flags)
if
(
LOOKUP_NAMESPACES_ONLY
(
flags
))
if
(
LOOKUP_NAMESPACES_ONLY
(
flags
))
{
{
/* We are not interested in types. */
/* We are not interested in types.
*/
if
(
val
&&
TREE_CODE
(
val
)
==
NAMESPACE_DECL
)
if
(
val
&&
TREE_CODE
(
val
)
==
NAMESPACE_DECL
)
return
val
;
return
val
;
return
NULL_TREE
;
return
NULL_TREE
;
...
@@ -5774,7 +5774,7 @@ select_decl (binding, flags)
...
@@ -5774,7 +5774,7 @@ select_decl (binding, flags)
&&
(
!
val
||
((
flags
&
LOOKUP_PREFER_TYPES
)
&&
(
!
val
||
((
flags
&
LOOKUP_PREFER_TYPES
)
&&
TREE_CODE
(
val
)
!=
TYPE_DECL
)))
&&
TREE_CODE
(
val
)
!=
TYPE_DECL
)))
val
=
TYPE_STUB_DECL
(
BINDING_TYPE
(
binding
));
val
=
TYPE_STUB_DECL
(
BINDING_TYPE
(
binding
));
/* Don't return non-types if we really prefer types. */
/* Don't return non-types if we really prefer types.
*/
else
if
(
val
&&
LOOKUP_TYPES_ONLY
(
flags
)
&&
TREE_CODE
(
val
)
!=
TYPE_DECL
else
if
(
val
&&
LOOKUP_TYPES_ONLY
(
flags
)
&&
TREE_CODE
(
val
)
!=
TYPE_DECL
&&
(
TREE_CODE
(
val
)
!=
TEMPLATE_DECL
&&
(
TREE_CODE
(
val
)
!=
TEMPLATE_DECL
||
!
DECL_CLASS_TEMPLATE_P
(
val
)))
||
!
DECL_CLASS_TEMPLATE_P
(
val
)))
...
@@ -5820,28 +5820,28 @@ unqualified_namespace_lookup (name, flags, spacesp)
...
@@ -5820,28 +5820,28 @@ unqualified_namespace_lookup (name, flags, spacesp)
}
}
else
else
{
{
/* Initialize binding for this context. */
/* Initialize binding for this context.
*/
BINDING_VALUE
(
b
)
=
BINDING_VALUE
(
val
);
BINDING_VALUE
(
b
)
=
BINDING_VALUE
(
val
);
BINDING_TYPE
(
b
)
=
BINDING_TYPE
(
val
);
BINDING_TYPE
(
b
)
=
BINDING_TYPE
(
val
);
}
}
/* Add all _DECLs seen through local using-directives. */
/* Add all _DECLs seen through local using-directives.
*/
for
(
level
=
current_binding_level
;
for
(
level
=
current_binding_level
;
!
level
->
namespace_p
;
!
level
->
namespace_p
;
level
=
level
->
level_chain
)
level
=
level
->
level_chain
)
if
(
!
lookup_using_namespace
(
name
,
b
,
level
->
using_directives
,
if
(
!
lookup_using_namespace
(
name
,
b
,
level
->
using_directives
,
scope
,
flags
,
spacesp
))
scope
,
flags
,
spacesp
))
/* Give up because of error. */
/* Give up because of error.
*/
return
error_mark_node
;
return
error_mark_node
;
/* Add all _DECLs seen through global using-directives. */
/* Add all _DECLs seen through global using-directives.
*/
/* XXX local and global using lists should work equally. */
/* XXX local and global using lists should work equally.
*/
siter
=
initial
;
siter
=
initial
;
while
(
1
)
while
(
1
)
{
{
if
(
!
lookup_using_namespace
(
name
,
b
,
DECL_NAMESPACE_USING
(
siter
),
if
(
!
lookup_using_namespace
(
name
,
b
,
DECL_NAMESPACE_USING
(
siter
),
scope
,
flags
,
spacesp
))
scope
,
flags
,
spacesp
))
/* Give up because of error. */
/* Give up because of error.
*/
return
error_mark_node
;
return
error_mark_node
;
if
(
siter
==
scope
)
break
;
if
(
siter
==
scope
)
break
;
siter
=
CP_DECL_CONTEXT
(
siter
);
siter
=
CP_DECL_CONTEXT
(
siter
);
...
@@ -6002,7 +6002,7 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
...
@@ -6002,7 +6002,7 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
int
flags
;
int
flags
;
int
val_is_implicit_typename
=
0
;
int
val_is_implicit_typename
=
0
;
/* Hack: copy flag set by parser, if set. */
/* Hack: copy flag set by parser, if set.
*/
if
(
only_namespace_names
)
if
(
only_namespace_names
)
namespaces_only
=
1
;
namespaces_only
=
1
;
...
@@ -6015,7 +6015,7 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
...
@@ -6015,7 +6015,7 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
prefer_type
=
looking_for_typename
;
prefer_type
=
looking_for_typename
;
flags
=
lookup_flags
(
prefer_type
,
namespaces_only
);
flags
=
lookup_flags
(
prefer_type
,
namespaces_only
);
/* If the next thing is '<', class templates are types. */
/* If the next thing is '<', class templates are types.
*/
if
(
looking_for_template
)
if
(
looking_for_template
)
flags
|=
LOOKUP_TEMPLATES_EXPECTED
;
flags
|=
LOOKUP_TEMPLATES_EXPECTED
;
...
@@ -6086,7 +6086,7 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
...
@@ -6086,7 +6086,7 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
else
else
{
{
flags
=
lookup_flags
(
prefer_type
,
namespaces_only
);
flags
=
lookup_flags
(
prefer_type
,
namespaces_only
);
/* If we're not parsing, we need to complain. */
/* If we're not parsing, we need to complain.
*/
flags
|=
LOOKUP_COMPLAIN
;
flags
|=
LOOKUP_COMPLAIN
;
}
}
...
@@ -6310,7 +6310,7 @@ record_builtin_type (rid_index, name, type)
...
@@ -6310,7 +6310,7 @@ record_builtin_type (rid_index, name, type)
tdecl
=
pushdecl
(
build_decl
(
TYPE_DECL
,
tname
,
type
));
tdecl
=
pushdecl
(
build_decl
(
TYPE_DECL
,
tname
,
type
));
set_identifier_type_value
(
tname
,
NULL_TREE
);
set_identifier_type_value
(
tname
,
NULL_TREE
);
if
((
int
)
rid_index
<
(
int
)
RID_MAX
)
if
((
int
)
rid_index
<
(
int
)
RID_MAX
)
/* Built-in types live in the global namespace. */
/* Built-in types live in the global namespace.
*/
SET_IDENTIFIER_GLOBAL_VALUE
(
tname
,
tdecl
);
SET_IDENTIFIER_GLOBAL_VALUE
(
tname
,
tdecl
);
}
}
if
(
rname
!=
NULL_TREE
)
if
(
rname
!=
NULL_TREE
)
...
@@ -6342,12 +6342,12 @@ record_builtin_java_type (name, size)
...
@@ -6342,12 +6342,12 @@ record_builtin_java_type (name, size)
if
(
size
>
0
)
if
(
size
>
0
)
type
=
make_signed_type
(
size
);
type
=
make_signed_type
(
size
);
else
if
(
size
>
-
32
)
else
if
(
size
>
-
32
)
{
/* "__java_char" or ""__java_boolean". */
{
/* "__java_char" or ""__java_boolean".
*/
type
=
make_unsigned_type
(
-
size
);
type
=
make_unsigned_type
(
-
size
);
/*if (size == -1) TREE_SET_CODE (type, BOOLEAN_TYPE);*/
/*if (size == -1) TREE_SET_CODE (type, BOOLEAN_TYPE);*/
}
}
else
else
{
/* "__java_float" or ""__java_double". */
{
/* "__java_float" or ""__java_double".
*/
type
=
make_node
(
REAL_TYPE
);
type
=
make_node
(
REAL_TYPE
);
TYPE_PRECISION
(
type
)
=
-
size
;
TYPE_PRECISION
(
type
)
=
-
size
;
layout_type
(
type
);
layout_type
(
type
);
...
@@ -6357,14 +6357,14 @@ record_builtin_java_type (name, size)
...
@@ -6357,14 +6357,14 @@ record_builtin_java_type (name, size)
/* Suppress generate debug symbol entries for these types,
/* Suppress generate debug symbol entries for these types,
since for normal C++ they are just clutter.
since for normal C++ they are just clutter.
However, push_lang_context undoes this if extern "Java" is seen. */
However, push_lang_context undoes this if extern "Java" is seen.
*/
DECL_IGNORED_P
(
decl
)
=
1
;
DECL_IGNORED_P
(
decl
)
=
1
;
TYPE_FOR_JAVA
(
type
)
=
1
;
TYPE_FOR_JAVA
(
type
)
=
1
;
return
type
;
return
type
;
}
}
/* Push a type into the namespace so that the back-ends ignore it. */
/* Push a type into the namespace so that the back-ends ignore it.
*/
static
void
static
void
record_unknown_type
(
type
,
name
)
record_unknown_type
(
type
,
name
)
...
@@ -6452,7 +6452,7 @@ cxx_init_decl_processing ()
...
@@ -6452,7 +6452,7 @@ cxx_init_decl_processing ()
/* Create the global variables. */
/* Create the global variables. */
push_to_top_level
();
push_to_top_level
();
/* Enter the global namespace. */
/* Enter the global namespace.
*/
my_friendly_assert
(
global_namespace
==
NULL_TREE
,
375
);
my_friendly_assert
(
global_namespace
==
NULL_TREE
,
375
);
push_namespace
(
get_identifier
(
"::"
));
push_namespace
(
get_identifier
(
"::"
));
global_namespace
=
current_namespace
;
global_namespace
=
current_namespace
;
...
@@ -6637,7 +6637,7 @@ cxx_init_decl_processing ()
...
@@ -6637,7 +6637,7 @@ cxx_init_decl_processing ()
/* Generate an initializer for a function naming variable from
/* Generate an initializer for a function naming variable from
NAME. NAME may be NULL, in which case we generate a special
NAME. NAME may be NULL, in which case we generate a special
ERROR_MARK node which should be replaced later. */
ERROR_MARK node which should be replaced later.
*/
tree
tree
cp_fname_init
(
name
)
cp_fname_init
(
name
)
...
@@ -6662,7 +6662,7 @@ cp_fname_init (name)
...
@@ -6662,7 +6662,7 @@ cp_fname_init (name)
TREE_TYPE
(
init
)
=
type
;
TREE_TYPE
(
init
)
=
type
;
else
else
/* We don't know the value until instantiation time. Make
/* We don't know the value until instantiation time. Make
something which will be digested now, but replaced later. */
something which will be digested now, but replaced later.
*/
init
=
build
(
ERROR_MARK
,
type
);
init
=
build
(
ERROR_MARK
,
type
);
return
init
;
return
init
;
...
@@ -6684,7 +6684,7 @@ cp_make_fname_decl (id, type_dep)
...
@@ -6684,7 +6684,7 @@ cp_make_fname_decl (id, type_dep)
tree
init
=
cp_fname_init
(
name
);
tree
init
=
cp_fname_init
(
name
);
tree
decl
=
build_decl
(
VAR_DECL
,
id
,
TREE_TYPE
(
init
));
tree
decl
=
build_decl
(
VAR_DECL
,
id
,
TREE_TYPE
(
init
));
/* As we don't push the decl here, we must set the context. */
/* As we don't push the decl here, we must set the context.
*/
DECL_CONTEXT
(
decl
)
=
current_function_decl
;
DECL_CONTEXT
(
decl
)
=
current_function_decl
;
DECL_PRETTY_FUNCTION_P
(
decl
)
=
type_dep
;
DECL_PRETTY_FUNCTION_P
(
decl
)
=
type_dep
;
...
@@ -7231,11 +7231,11 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
...
@@ -7231,11 +7231,11 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
&&
context
!=
current_namespace
&&
TREE_CODE
(
decl
)
==
VAR_DECL
)
&&
context
!=
current_namespace
&&
TREE_CODE
(
decl
)
==
VAR_DECL
)
{
{
/* When parsing the initializer, lookup should use the object's
/* When parsing the initializer, lookup should use the object's
namespace. */
namespace.
*/
push_decl_namespace
(
context
);
push_decl_namespace
(
context
);
}
}
/* We are only interested in class contexts, later. */
/* We are only interested in class contexts, later.
*/
if
(
context
&&
TREE_CODE
(
context
)
==
NAMESPACE_DECL
)
if
(
context
&&
TREE_CODE
(
context
)
==
NAMESPACE_DECL
)
context
=
NULL_TREE
;
context
=
NULL_TREE
;
...
@@ -8141,7 +8141,7 @@ cp_finish_decl (decl, init, asmspec_tree, flags)
...
@@ -8141,7 +8141,7 @@ cp_finish_decl (decl, init, asmspec_tree, flags)
&&
DECL_CONTEXT
(
decl
)
!=
current_namespace
&&
DECL_CONTEXT
(
decl
)
!=
current_namespace
&&
init
)
&&
init
)
{
{
/* Leave the namespace of the object. */
/* Leave the namespace of the object.
*/
pop_decl_namespace
();
pop_decl_namespace
();
}
}
...
@@ -8874,7 +8874,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
...
@@ -8874,7 +8874,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
type
=
build_exception_variant
(
type
,
raises
);
type
=
build_exception_variant
(
type
,
raises
);
decl
=
build_lang_decl
(
FUNCTION_DECL
,
declarator
,
type
);
decl
=
build_lang_decl
(
FUNCTION_DECL
,
declarator
,
type
);
/* Propagate volatile out from type to decl. */
/* Propagate volatile out from type to decl.
*/
if
(
TYPE_VOLATILE
(
type
))
if
(
TYPE_VOLATILE
(
type
))
TREE_THIS_VOLATILE
(
decl
)
=
1
;
TREE_THIS_VOLATILE
(
decl
)
=
1
;
...
@@ -9025,7 +9025,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
...
@@ -9025,7 +9025,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
/* Due to bison parser ickiness, we will have already looked
/* Due to bison parser ickiness, we will have already looked
up an operator_name or PFUNCNAME within the current class
up an operator_name or PFUNCNAME within the current class
(see template_id in parse.y). If the current class contains
(see template_id in parse.y). If the current class contains
such a name, we'll get a COMPONENT_REF here. Undo that. */
such a name, we'll get a COMPONENT_REF here. Undo that.
*/
my_friendly_assert
(
TREE_TYPE
(
TREE_OPERAND
(
fns
,
0
))
my_friendly_assert
(
TREE_TYPE
(
TREE_OPERAND
(
fns
,
0
))
==
current_class_type
,
20001120
);
==
current_class_type
,
20001120
);
...
@@ -9400,7 +9400,7 @@ compute_array_index_type (name, size)
...
@@ -9400,7 +9400,7 @@ compute_array_index_type (name, size)
size
,
integer_one_node
));
size
,
integer_one_node
));
}
}
/* The size might be the result of a cast. */
/* The size might be the result of a cast.
*/
STRIP_TYPE_NOPS
(
size
);
STRIP_TYPE_NOPS
(
size
);
/* It might be a const variable or enumeration constant. */
/* It might be a const variable or enumeration constant. */
...
@@ -9805,7 +9805,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
...
@@ -9805,7 +9805,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
break
;
break
;
case
ADDR_EXPR
:
/* C++ reference declaration */
case
ADDR_EXPR
:
/* C++ reference declaration */
/* Fall through. */
/* Fall through.
*/
case
ARRAY_REF
:
case
ARRAY_REF
:
case
INDIRECT_REF
:
case
INDIRECT_REF
:
ctype
=
NULL_TREE
;
ctype
=
NULL_TREE
;
...
@@ -9893,7 +9893,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
...
@@ -9893,7 +9893,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
dname
=
DECL_NAME
(
get_first_fn
(
dname
));
dname
=
DECL_NAME
(
get_first_fn
(
dname
));
}
}
}
}
/* Fall through. */
/* Fall through.
*/
case
IDENTIFIER_NODE
:
case
IDENTIFIER_NODE
:
if
(
TREE_CODE
(
decl
)
==
IDENTIFIER_NODE
)
if
(
TREE_CODE
(
decl
)
==
IDENTIFIER_NODE
)
...
@@ -10692,7 +10692,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
...
@@ -10692,7 +10692,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
type
=
create_array_type_for_decl
(
dname
,
type
,
size
);
type
=
create_array_type_for_decl
(
dname
,
type
,
size
);
/* VLAs never work as fields. */
/* VLAs never work as fields.
*/
if
(
decl_context
==
FIELD
&&
!
processing_template_decl
if
(
decl_context
==
FIELD
&&
!
processing_template_decl
&&
TREE_CODE
(
type
)
==
ARRAY_TYPE
&&
TREE_CODE
(
type
)
==
ARRAY_TYPE
&&
TYPE_DOMAIN
(
type
)
!=
NULL_TREE
&&
TYPE_DOMAIN
(
type
)
!=
NULL_TREE
...
@@ -10700,7 +10700,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
...
@@ -10700,7 +10700,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
{
{
error
(
"size of member `%D' is not constant"
,
dname
);
error
(
"size of member `%D' is not constant"
,
dname
);
/* Proceed with arbitrary constant size, so that offset
/* Proceed with arbitrary constant size, so that offset
computations don't get confused. */
computations don't get confused.
*/
type
=
create_array_type_for_decl
(
dname
,
TREE_TYPE
(
type
),
type
=
create_array_type_for_decl
(
dname
,
TREE_TYPE
(
type
),
integer_one_node
);
integer_one_node
);
}
}
...
@@ -11009,7 +11009,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
...
@@ -11009,7 +11009,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
/* This needs to be here, in case we are called
/* This needs to be here, in case we are called
multiple times. */
;
multiple times. */
;
else
if
(
TREE_COMPLEXITY
(
declarator
)
==
-
1
)
else
if
(
TREE_COMPLEXITY
(
declarator
)
==
-
1
)
/* Namespace member. */
/* Namespace member.
*/
pop_decl_namespace
();
pop_decl_namespace
();
else
if
(
friendp
&&
(
TREE_COMPLEXITY
(
declarator
)
<
2
))
else
if
(
friendp
&&
(
TREE_COMPLEXITY
(
declarator
)
<
2
))
/* Don't fall out into global scope. Hides real bug? --eichin */
;
/* Don't fall out into global scope. Hides real bug? --eichin */
;
...
@@ -12168,7 +12168,7 @@ grokparms (first_parm)
...
@@ -12168,7 +12168,7 @@ grokparms (first_parm)
TREE_TYPE
(
decl
)
=
type
;
TREE_TYPE
(
decl
)
=
type
;
}
}
else
if
(
abstract_virtuals_error
(
decl
,
type
))
else
if
(
abstract_virtuals_error
(
decl
,
type
))
any_error
=
1
;
/* Seems like a good idea. */
any_error
=
1
;
/* Seems like a good idea.
*/
else
if
(
POINTER_TYPE_P
(
type
))
else
if
(
POINTER_TYPE_P
(
type
))
{
{
/* [dcl.fct]/6, parameter types cannot contain pointers
/* [dcl.fct]/6, parameter types cannot contain pointers
...
@@ -12531,7 +12531,7 @@ grok_op_properties (decl, friendp)
...
@@ -12531,7 +12531,7 @@ grok_op_properties (decl, friendp)
}
}
if
(
operator_code
==
CALL_EXPR
)
if
(
operator_code
==
CALL_EXPR
)
return
;
/* No restrictions on args. */
return
;
/* No restrictions on args.
*/
if
(
IDENTIFIER_TYPENAME_P
(
name
)
&&
!
DECL_TEMPLATE_INFO
(
decl
))
if
(
IDENTIFIER_TYPENAME_P
(
name
)
&&
!
DECL_TEMPLATE_INFO
(
decl
))
{
{
...
@@ -12795,7 +12795,7 @@ xref_tag (enum tag_types tag_code, tree name, tree attributes,
...
@@ -12795,7 +12795,7 @@ xref_tag (enum tag_types tag_code, tree name, tree attributes,
TYPE_IDENTIFIER
(
t
));
TYPE_IDENTIFIER
(
t
));
/* We need to remove the class scope binding for the
/* We need to remove the class scope binding for the
TYPENAME_TYPE as otherwise poplevel_class gets confused. */
TYPENAME_TYPE as otherwise poplevel_class gets confused.
*/
for
(
shadowed
=
b
->
class_shadowed
;
for
(
shadowed
=
b
->
class_shadowed
;
shadowed
;
shadowed
;
shadowed
=
TREE_CHAIN
(
shadowed
))
shadowed
=
TREE_CHAIN
(
shadowed
))
...
@@ -13356,7 +13356,7 @@ build_enumerator (name, value, enumtype)
...
@@ -13356,7 +13356,7 @@ build_enumerator (name, value, enumtype)
if
(
TYPE_VALUES
(
enumtype
))
if
(
TYPE_VALUES
(
enumtype
))
{
{
/* The next value is the previous value ... */
/* The next value is the previous value ...
*/
prev_value
=
DECL_INITIAL
(
TREE_VALUE
(
TYPE_VALUES
(
enumtype
)));
prev_value
=
DECL_INITIAL
(
TREE_VALUE
(
TYPE_VALUES
(
enumtype
)));
/* ... plus one. */
/* ... plus one. */
value
=
cp_build_binary_op
(
PLUS_EXPR
,
value
=
cp_build_binary_op
(
PLUS_EXPR
,
...
@@ -13406,7 +13406,7 @@ build_enumerator (name, value, enumtype)
...
@@ -13406,7 +13406,7 @@ build_enumerator (name, value, enumtype)
initializing value.
initializing value.
In finish_enum we will reset the type. Of course, if we're
In finish_enum we will reset the type. Of course, if we're
processing a template, there may be no value.
*/
processing a template, there may be no value. */
type
=
value
?
TREE_TYPE
(
value
)
:
NULL_TREE
;
type
=
value
?
TREE_TYPE
(
value
)
:
NULL_TREE
;
if
(
context
&&
context
==
current_class_type
)
if
(
context
&&
context
==
current_class_type
)
...
@@ -13715,7 +13715,7 @@ start_function (declspecs, declarator, attrs, flags)
...
@@ -13715,7 +13715,7 @@ start_function (declspecs, declarator, attrs, flags)
decl1
=
pushdecl
(
decl1
);
decl1
=
pushdecl
(
decl1
);
else
else
{
{
/* We need to set the DECL_CONTEXT. */
/* We need to set the DECL_CONTEXT.
*/
if
(
!
DECL_CONTEXT
(
decl1
)
&&
DECL_TEMPLATE_INFO
(
decl1
))
if
(
!
DECL_CONTEXT
(
decl1
)
&&
DECL_TEMPLATE_INFO
(
decl1
))
DECL_CONTEXT
(
decl1
)
=
DECL_CONTEXT
(
DECL_TI_TEMPLATE
(
decl1
));
DECL_CONTEXT
(
decl1
)
=
DECL_CONTEXT
(
DECL_TI_TEMPLATE
(
decl1
));
/* And make sure we have enough default args. */
/* And make sure we have enough default args. */
...
...
gcc/cp/decl2.c
View file @
a1c65f9f
...
@@ -117,7 +117,7 @@ int at_eof;
...
@@ -117,7 +117,7 @@ int at_eof;
tree
static_ctors
;
tree
static_ctors
;
tree
static_dtors
;
tree
static_dtors
;
/* The :: namespace. */
/* The :: namespace.
*/
tree
global_namespace
;
tree
global_namespace
;
...
@@ -580,7 +580,7 @@ check_member_template (tmpl)
...
@@ -580,7 +580,7 @@ check_member_template (tmpl)
if
(
current_function_decl
)
if
(
current_function_decl
)
/* 14.5.2.2 [temp.mem]
/* 14.5.2.2 [temp.mem]
A local class shall not have member templates. */
A local class shall not have member templates.
*/
error
(
"invalid declaration of member template `%#D' in local class"
,
error
(
"invalid declaration of member template `%#D' in local class"
,
decl
);
decl
);
...
@@ -603,7 +603,7 @@ check_member_template (tmpl)
...
@@ -603,7 +603,7 @@ check_member_template (tmpl)
error
(
"template declaration of `%#D'"
,
decl
);
error
(
"template declaration of `%#D'"
,
decl
);
}
}
/* Return true iff TYPE is a valid Java parameter or return type. */
/* Return true iff TYPE is a valid Java parameter or return type.
*/
static
int
static
int
acceptable_java_type
(
type
)
acceptable_java_type
(
type
)
...
@@ -1370,7 +1370,7 @@ finish_anon_union (anon_union_decl)
...
@@ -1370,7 +1370,7 @@ finish_anon_union (anon_union_decl)
int
static_p
=
TREE_STATIC
(
anon_union_decl
);
int
static_p
=
TREE_STATIC
(
anon_union_decl
);
int
external_p
=
DECL_EXTERNAL
(
anon_union_decl
);
int
external_p
=
DECL_EXTERNAL
(
anon_union_decl
);
/* The VAR_DECL's context is the same as the TYPE's context. */
/* The VAR_DECL's context is the same as the TYPE's context.
*/
DECL_CONTEXT
(
anon_union_decl
)
=
DECL_CONTEXT
(
TYPE_NAME
(
type
));
DECL_CONTEXT
(
anon_union_decl
)
=
DECL_CONTEXT
(
TYPE_NAME
(
type
));
if
(
TYPE_FIELDS
(
type
)
==
NULL_TREE
)
if
(
TYPE_FIELDS
(
type
)
==
NULL_TREE
)
...
@@ -1611,7 +1611,7 @@ maybe_make_one_only (decl)
...
@@ -1611,7 +1611,7 @@ maybe_make_one_only (decl)
one. However, that's not actually the case in SVR4; a strong definition
one. However, that's not actually the case in SVR4; a strong definition
after a weak one is an error. Also, not making explicit
after a weak one is an error. Also, not making explicit
instantiations one_only means that we can end up with two copies of
instantiations one_only means that we can end up with two copies of
some template instantiations. */
some template instantiations.
*/
if
(
!
flag_weak
)
if
(
!
flag_weak
)
return
;
return
;
...
@@ -1981,7 +1981,7 @@ import_export_tinfo (decl, type, is_in_library)
...
@@ -1981,7 +1981,7 @@ import_export_tinfo (decl, type, is_in_library)
DECL_COMDAT
(
decl
)
=
1
;
DECL_COMDAT
(
decl
)
=
1
;
}
}
/* Now override some cases. */
/* Now override some cases.
*/
if
(
flag_weak
)
if
(
flag_weak
)
DECL_COMDAT
(
decl
)
=
1
;
DECL_COMDAT
(
decl
)
=
1
;
else
if
(
is_in_library
)
else
if
(
is_in_library
)
...
@@ -2031,7 +2031,7 @@ get_guard (decl)
...
@@ -2031,7 +2031,7 @@ get_guard (decl)
guard_type
=
long_long_integer_type_node
;
guard_type
=
long_long_integer_type_node
;
guard
=
build_decl
(
VAR_DECL
,
sname
,
guard_type
);
guard
=
build_decl
(
VAR_DECL
,
sname
,
guard_type
);
/* The guard should have the same linkage as what it guards. */
/* The guard should have the same linkage as what it guards.
*/
TREE_PUBLIC
(
guard
)
=
TREE_PUBLIC
(
decl
);
TREE_PUBLIC
(
guard
)
=
TREE_PUBLIC
(
decl
);
TREE_STATIC
(
guard
)
=
TREE_STATIC
(
decl
);
TREE_STATIC
(
guard
)
=
TREE_STATIC
(
decl
);
DECL_COMMON
(
guard
)
=
DECL_COMMON
(
decl
);
DECL_COMMON
(
guard
)
=
DECL_COMMON
(
decl
);
...
@@ -2275,7 +2275,7 @@ start_static_storage_duration_function ()
...
@@ -2275,7 +2275,7 @@ start_static_storage_duration_function ()
VARRAY_TREE_INIT
(
ssdf_decls
,
32
,
"ssdf_decls"
);
VARRAY_TREE_INIT
(
ssdf_decls
,
32
,
"ssdf_decls"
);
/* Take this opportunity to initialize the map from priority
/* Take this opportunity to initialize the map from priority
numbers to information about that priority level. */
numbers to information about that priority level.
*/
priority_info_map
=
splay_tree_new
(
splay_tree_compare_ints
,
priority_info_map
=
splay_tree_new
(
splay_tree_compare_ints
,
/*delete_key_fn=*/
0
,
/*delete_key_fn=*/
0
,
/*delete_value_fn=*/
/*delete_value_fn=*/
...
@@ -2868,7 +2868,7 @@ finish_file ()
...
@@ -2868,7 +2868,7 @@ finish_file ()
This is done in a separate for cycle, because if some deferred
This is done in a separate for cycle, because if some deferred
function is contained in another deferred function later in
function is contained in another deferred function later in
deferred_fns varray, rest_of_compilation would skip this
deferred_fns varray, rest_of_compilation would skip this
function and we really cannot expand the same function twice. */
function and we really cannot expand the same function twice.
*/
for
(
i
=
0
;
i
<
deferred_fns_used
;
++
i
)
for
(
i
=
0
;
i
<
deferred_fns_used
;
++
i
)
{
{
tree
decl
=
VARRAY_TREE
(
deferred_fns
,
i
);
tree
decl
=
VARRAY_TREE
(
deferred_fns
,
i
);
...
@@ -2972,7 +2972,7 @@ finish_file ()
...
@@ -2972,7 +2972,7 @@ finish_file ()
finish_repo
();
finish_repo
();
/* The entire file is now complete. If requested, dump everything
/* The entire file is now complete. If requested, dump everything
to a file.
*/
to a file. */
{
{
int
flags
;
int
flags
;
FILE
*
stream
=
dump_begin
(
TDI_all
,
&
flags
);
FILE
*
stream
=
dump_begin
(
TDI_all
,
&
flags
);
...
@@ -3317,7 +3317,7 @@ build_expr_from_tree (t)
...
@@ -3317,7 +3317,7 @@ build_expr_from_tree (t)
&&
(
!
current_class_type
&&
(
!
current_class_type
||
!
lookup_member
(
current_class_type
,
id
,
0
,
0
)))
||
!
lookup_member
(
current_class_type
,
id
,
0
,
0
)))
{
{
/* Do Koenig lookup if there are no class members. */
/* Do Koenig lookup if there are no class members.
*/
name
=
do_identifier
(
id
,
0
,
args
);
name
=
do_identifier
(
id
,
0
,
args
);
}
}
else
if
(
TREE_CODE
(
name
)
==
TEMPLATE_ID_EXPR
else
if
(
TREE_CODE
(
name
)
==
TEMPLATE_ID_EXPR
...
@@ -3588,7 +3588,7 @@ finish_decl_parsing (decl)
...
@@ -3588,7 +3588,7 @@ finish_decl_parsing (decl)
}
}
}
}
/* Return 1 if root encloses child. */
/* Return 1 if root encloses child.
*/
static
int
static
int
is_namespace_ancestor
(
root
,
child
)
is_namespace_ancestor
(
root
,
child
)
...
@@ -3605,7 +3605,7 @@ is_namespace_ancestor (root, child)
...
@@ -3605,7 +3605,7 @@ is_namespace_ancestor (root, child)
/* Return the namespace that is the common ancestor
/* Return the namespace that is the common ancestor
of two given namespaces. */
of two given namespaces.
*/
tree
tree
namespace_ancestor
(
ns1
,
ns2
)
namespace_ancestor
(
ns1
,
ns2
)
...
@@ -3626,38 +3626,38 @@ add_using_namespace (user, used, indirect)
...
@@ -3626,38 +3626,38 @@ add_using_namespace (user, used, indirect)
int
indirect
;
int
indirect
;
{
{
tree
t
;
tree
t
;
/* Using oneself is a no-op. */
/* Using oneself is a no-op.
*/
if
(
user
==
used
)
if
(
user
==
used
)
return
;
return
;
my_friendly_assert
(
TREE_CODE
(
user
)
==
NAMESPACE_DECL
,
380
);
my_friendly_assert
(
TREE_CODE
(
user
)
==
NAMESPACE_DECL
,
380
);
my_friendly_assert
(
TREE_CODE
(
used
)
==
NAMESPACE_DECL
,
380
);
my_friendly_assert
(
TREE_CODE
(
used
)
==
NAMESPACE_DECL
,
380
);
/* Check if we already have this. */
/* Check if we already have this.
*/
t
=
purpose_member
(
used
,
DECL_NAMESPACE_USING
(
user
));
t
=
purpose_member
(
used
,
DECL_NAMESPACE_USING
(
user
));
if
(
t
!=
NULL_TREE
)
if
(
t
!=
NULL_TREE
)
{
{
if
(
!
indirect
)
if
(
!
indirect
)
/* Promote to direct usage. */
/* Promote to direct usage.
*/
TREE_INDIRECT_USING
(
t
)
=
0
;
TREE_INDIRECT_USING
(
t
)
=
0
;
return
;
return
;
}
}
/* Add used to the user's using list. */
/* Add used to the user's using list.
*/
DECL_NAMESPACE_USING
(
user
)
DECL_NAMESPACE_USING
(
user
)
=
tree_cons
(
used
,
namespace_ancestor
(
user
,
used
),
=
tree_cons
(
used
,
namespace_ancestor
(
user
,
used
),
DECL_NAMESPACE_USING
(
user
));
DECL_NAMESPACE_USING
(
user
));
TREE_INDIRECT_USING
(
DECL_NAMESPACE_USING
(
user
))
=
indirect
;
TREE_INDIRECT_USING
(
DECL_NAMESPACE_USING
(
user
))
=
indirect
;
/* Add user to the used's users list. */
/* Add user to the used's users list.
*/
DECL_NAMESPACE_USERS
(
used
)
DECL_NAMESPACE_USERS
(
used
)
=
tree_cons
(
user
,
0
,
DECL_NAMESPACE_USERS
(
used
));
=
tree_cons
(
user
,
0
,
DECL_NAMESPACE_USERS
(
used
));
/* Recursively add all namespaces used. */
/* Recursively add all namespaces used.
*/
for
(
t
=
DECL_NAMESPACE_USING
(
used
);
t
;
t
=
TREE_CHAIN
(
t
))
for
(
t
=
DECL_NAMESPACE_USING
(
used
);
t
;
t
=
TREE_CHAIN
(
t
))
/* indirect usage */
/* indirect usage */
add_using_namespace
(
user
,
TREE_PURPOSE
(
t
),
1
);
add_using_namespace
(
user
,
TREE_PURPOSE
(
t
),
1
);
/* Tell everyone using us about the new used namespaces. */
/* Tell everyone using us about the new used namespaces.
*/
for
(
t
=
DECL_NAMESPACE_USERS
(
user
);
t
;
t
=
TREE_CHAIN
(
t
))
for
(
t
=
DECL_NAMESPACE_USERS
(
user
);
t
;
t
=
TREE_CHAIN
(
t
))
add_using_namespace
(
TREE_PURPOSE
(
t
),
used
,
1
);
add_using_namespace
(
TREE_PURPOSE
(
t
),
used
,
1
);
}
}
...
@@ -3717,14 +3717,14 @@ ambiguous_decl (name, old, new, flags)
...
@@ -3717,14 +3717,14 @@ ambiguous_decl (name, old, new, flags)
{
{
tree
val
,
type
;
tree
val
,
type
;
my_friendly_assert
(
old
!=
NULL_TREE
,
393
);
my_friendly_assert
(
old
!=
NULL_TREE
,
393
);
/* Copy the value. */
/* Copy the value.
*/
val
=
BINDING_VALUE
(
new
);
val
=
BINDING_VALUE
(
new
);
if
(
val
)
if
(
val
)
switch
(
TREE_CODE
(
val
))
switch
(
TREE_CODE
(
val
))
{
{
case
TEMPLATE_DECL
:
case
TEMPLATE_DECL
:
/* If we expect types or namespaces, and not templates,
/* If we expect types or namespaces, and not templates,
or this is not a template class. */
or this is not a template class.
*/
if
(
LOOKUP_QUALIFIERS_ONLY
(
flags
)
if
(
LOOKUP_QUALIFIERS_ONLY
(
flags
)
&&
!
DECL_CLASS_TEMPLATE_P
(
val
))
&&
!
DECL_CLASS_TEMPLATE_P
(
val
))
val
=
NULL_TREE
;
val
=
NULL_TREE
;
...
@@ -3759,7 +3759,7 @@ ambiguous_decl (name, old, new, flags)
...
@@ -3759,7 +3759,7 @@ ambiguous_decl (name, old, new, flags)
}
}
else
else
{
{
/* Some declarations are functions, some are not. */
/* Some declarations are functions, some are not.
*/
if
(
flags
&
LOOKUP_COMPLAIN
)
if
(
flags
&
LOOKUP_COMPLAIN
)
{
{
/* If we've already given this error for this lookup,
/* If we've already given this error for this lookup,
...
@@ -3776,7 +3776,7 @@ ambiguous_decl (name, old, new, flags)
...
@@ -3776,7 +3776,7 @@ ambiguous_decl (name, old, new, flags)
BINDING_VALUE
(
old
)
=
error_mark_node
;
BINDING_VALUE
(
old
)
=
error_mark_node
;
}
}
}
}
/* ... and copy the type. */
/* ... and copy the type.
*/
type
=
BINDING_TYPE
(
new
);
type
=
BINDING_TYPE
(
new
);
if
(
LOOKUP_NAMESPACES_ONLY
(
flags
))
if
(
LOOKUP_NAMESPACES_ONLY
(
flags
))
type
=
NULL_TREE
;
type
=
NULL_TREE
;
...
@@ -3799,7 +3799,7 @@ ambiguous_decl (name, old, new, flags)
...
@@ -3799,7 +3799,7 @@ ambiguous_decl (name, old, new, flags)
We are currently looking for names in namespace SCOPE, so we
We are currently looking for names in namespace SCOPE, so we
look through USINGS for using-directives of namespaces
look through USINGS for using-directives of namespaces
which have SCOPE as a common ancestor with the current scope.
which have SCOPE as a common ancestor with the current scope.
Returns zero on errors. */
Returns zero on errors.
*/
int
int
lookup_using_namespace
(
name
,
val
,
usings
,
scope
,
flags
,
spacesp
)
lookup_using_namespace
(
name
,
val
,
usings
,
scope
,
flags
,
spacesp
)
...
@@ -3810,7 +3810,7 @@ lookup_using_namespace (name, val, usings, scope, flags, spacesp)
...
@@ -3810,7 +3810,7 @@ lookup_using_namespace (name, val, usings, scope, flags, spacesp)
tree
iter
;
tree
iter
;
tree
val1
;
tree
val1
;
/* Iterate over all used namespaces in current, searching for using
/* Iterate over all used namespaces in current, searching for using
directives of scope. */
directives of scope.
*/
for
(
iter
=
usings
;
iter
;
iter
=
TREE_CHAIN
(
iter
))
for
(
iter
=
usings
;
iter
;
iter
=
TREE_CHAIN
(
iter
))
if
(
TREE_VALUE
(
iter
)
==
scope
)
if
(
TREE_VALUE
(
iter
)
==
scope
)
{
{
...
@@ -3818,7 +3818,7 @@ lookup_using_namespace (name, val, usings, scope, flags, spacesp)
...
@@ -3818,7 +3818,7 @@ lookup_using_namespace (name, val, usings, scope, flags, spacesp)
*
spacesp
=
tree_cons
(
TREE_PURPOSE
(
iter
),
NULL_TREE
,
*
spacesp
=
tree_cons
(
TREE_PURPOSE
(
iter
),
NULL_TREE
,
*
spacesp
);
*
spacesp
);
val1
=
binding_for_name
(
name
,
TREE_PURPOSE
(
iter
));
val1
=
binding_for_name
(
name
,
TREE_PURPOSE
(
iter
));
/* Resolve ambiguities. */
/* Resolve ambiguities.
*/
val
=
ambiguous_decl
(
name
,
val
,
val1
,
flags
);
val
=
ambiguous_decl
(
name
,
val
,
val1
,
flags
);
}
}
return
BINDING_VALUE
(
val
)
!=
error_mark_node
;
return
BINDING_VALUE
(
val
)
!=
error_mark_node
;
...
@@ -3827,7 +3827,7 @@ lookup_using_namespace (name, val, usings, scope, flags, spacesp)
...
@@ -3827,7 +3827,7 @@ lookup_using_namespace (name, val, usings, scope, flags, spacesp)
/* [namespace.qual]
/* [namespace.qual]
Accepts the NAME to lookup and its qualifying SCOPE.
Accepts the NAME to lookup and its qualifying SCOPE.
Returns the name/type pair found into the CPLUS_BINDING RESULT,
Returns the name/type pair found into the CPLUS_BINDING RESULT,
or 0 on error. */
or 0 on error.
*/
int
int
qualified_lookup_using_namespace
(
name
,
scope
,
result
,
flags
)
qualified_lookup_using_namespace
(
name
,
scope
,
result
,
flags
)
...
@@ -3836,9 +3836,9 @@ qualified_lookup_using_namespace (name, scope, result, flags)
...
@@ -3836,9 +3836,9 @@ qualified_lookup_using_namespace (name, scope, result, flags)
tree
result
;
tree
result
;
int
flags
;
int
flags
;
{
{
/* Maintain a list of namespaces visited... */
/* Maintain a list of namespaces visited...
*/
tree
seen
=
NULL_TREE
;
tree
seen
=
NULL_TREE
;
/* ... and a list of namespace yet to see. */
/* ... and a list of namespace yet to see.
*/
tree
todo
=
NULL_TREE
;
tree
todo
=
NULL_TREE
;
tree
usings
;
tree
usings
;
/* Look through namespace aliases. */
/* Look through namespace aliases. */
...
@@ -3849,10 +3849,10 @@ qualified_lookup_using_namespace (name, scope, result, flags)
...
@@ -3849,10 +3849,10 @@ qualified_lookup_using_namespace (name, scope, result, flags)
result
=
ambiguous_decl
(
name
,
result
,
result
=
ambiguous_decl
(
name
,
result
,
binding_for_name
(
name
,
scope
),
flags
);
binding_for_name
(
name
,
scope
),
flags
);
if
(
!
BINDING_VALUE
(
result
)
&&
!
BINDING_TYPE
(
result
))
if
(
!
BINDING_VALUE
(
result
)
&&
!
BINDING_TYPE
(
result
))
/* Consider using directives. */
/* Consider using directives.
*/
for
(
usings
=
DECL_NAMESPACE_USING
(
scope
);
usings
;
for
(
usings
=
DECL_NAMESPACE_USING
(
scope
);
usings
;
usings
=
TREE_CHAIN
(
usings
))
usings
=
TREE_CHAIN
(
usings
))
/* If this was a real directive, and we have not seen it. */
/* If this was a real directive, and we have not seen it.
*/
if
(
!
TREE_INDIRECT_USING
(
usings
)
if
(
!
TREE_INDIRECT_USING
(
usings
)
&&
!
purpose_member
(
TREE_PURPOSE
(
usings
),
seen
))
&&
!
purpose_member
(
TREE_PURPOSE
(
usings
),
seen
))
todo
=
tree_cons
(
TREE_PURPOSE
(
usings
),
NULL_TREE
,
todo
);
todo
=
tree_cons
(
TREE_PURPOSE
(
usings
),
NULL_TREE
,
todo
);
...
@@ -3862,7 +3862,7 @@ qualified_lookup_using_namespace (name, scope, result, flags)
...
@@ -3862,7 +3862,7 @@ qualified_lookup_using_namespace (name, scope, result, flags)
todo
=
TREE_CHAIN
(
todo
);
todo
=
TREE_CHAIN
(
todo
);
}
}
else
else
scope
=
NULL_TREE
;
/* If there never was a todo list. */
scope
=
NULL_TREE
;
/* If there never was a todo list.
*/
}
}
return
result
!=
error_mark_node
;
return
result
!=
error_mark_node
;
}
}
...
@@ -3870,7 +3870,7 @@ qualified_lookup_using_namespace (name, scope, result, flags)
...
@@ -3870,7 +3870,7 @@ qualified_lookup_using_namespace (name, scope, result, flags)
/* [namespace.memdef]/2 */
/* [namespace.memdef]/2 */
/* Set the context of a declaration to scope. Complain if we are not
/* Set the context of a declaration to scope. Complain if we are not
outside scope. */
outside scope.
*/
void
void
set_decl_namespace
(
decl
,
scope
,
friendp
)
set_decl_namespace
(
decl
,
scope
,
friendp
)
...
@@ -3880,7 +3880,7 @@ set_decl_namespace (decl, scope, friendp)
...
@@ -3880,7 +3880,7 @@ set_decl_namespace (decl, scope, friendp)
{
{
tree
old
;
tree
old
;
/* Get rid of namespace aliases. */
/* Get rid of namespace aliases.
*/
scope
=
ORIGINAL_NAMESPACE
(
scope
);
scope
=
ORIGINAL_NAMESPACE
(
scope
);
/* It is ok for friends to be qualified in parallel space. */
/* It is ok for friends to be qualified in parallel space. */
...
@@ -3890,10 +3890,10 @@ set_decl_namespace (decl, scope, friendp)
...
@@ -3890,10 +3890,10 @@ set_decl_namespace (decl, scope, friendp)
DECL_CONTEXT
(
decl
)
=
FROB_CONTEXT
(
scope
);
DECL_CONTEXT
(
decl
)
=
FROB_CONTEXT
(
scope
);
if
(
scope
!=
current_namespace
)
if
(
scope
!=
current_namespace
)
{
{
/* See whether this has been declared in the namespace. */
/* See whether this has been declared in the namespace.
*/
old
=
namespace_binding
(
DECL_NAME
(
decl
),
scope
);
old
=
namespace_binding
(
DECL_NAME
(
decl
),
scope
);
if
(
!
old
)
if
(
!
old
)
/* No old declaration at all. */
/* No old declaration at all.
*/
goto
complain
;
goto
complain
;
/* A template can be explicitly specialized in any namespace. */
/* A template can be explicitly specialized in any namespace. */
if
(
processing_explicit_instantiation
)
if
(
processing_explicit_instantiation
)
...
@@ -3903,7 +3903,7 @@ set_decl_namespace (decl, scope, friendp)
...
@@ -3903,7 +3903,7 @@ set_decl_namespace (decl, scope, friendp)
since it can't check for the correct constness at this
since it can't check for the correct constness at this
point. pushdecl will find those errors later. */
point. pushdecl will find those errors later. */
return
;
return
;
/* Since decl is a function, old should contain a function decl. */
/* Since decl is a function, old should contain a function decl.
*/
if
(
!
is_overloaded_fn
(
old
))
if
(
!
is_overloaded_fn
(
old
))
goto
complain
;
goto
complain
;
if
(
processing_template_decl
||
processing_specialization
)
if
(
processing_template_decl
||
processing_specialization
)
...
@@ -3923,7 +3923,7 @@ set_decl_namespace (decl, scope, friendp)
...
@@ -3923,7 +3923,7 @@ set_decl_namespace (decl, scope, friendp)
decl
,
scope
);
decl
,
scope
);
}
}
/* Compute the namespace where a declaration is defined. */
/* Compute the namespace where a declaration is defined.
*/
static
tree
static
tree
decl_namespace
(
decl
)
decl_namespace
(
decl
)
...
@@ -3944,13 +3944,13 @@ decl_namespace (decl)
...
@@ -3944,13 +3944,13 @@ decl_namespace (decl)
return
global_namespace
;
return
global_namespace
;
}
}
/* Return the namespace where the current declaration is declared. */
/* Return the namespace where the current declaration is declared.
*/
tree
tree
current_decl_namespace
()
current_decl_namespace
()
{
{
tree
result
;
tree
result
;
/* If we have been pushed into a different namespace, use it. */
/* If we have been pushed into a different namespace, use it.
*/
if
(
decl_namespace_list
)
if
(
decl_namespace_list
)
return
TREE_PURPOSE
(
decl_namespace_list
);
return
TREE_PURPOSE
(
decl_namespace_list
);
...
@@ -3963,7 +3963,7 @@ current_decl_namespace ()
...
@@ -3963,7 +3963,7 @@ current_decl_namespace ()
return
result
;
return
result
;
}
}
/* Temporarily set the namespace for the current declaration. */
/* Temporarily set the namespace for the current declaration.
*/
void
void
push_decl_namespace
(
decl
)
push_decl_namespace
(
decl
)
...
@@ -3981,7 +3981,7 @@ pop_decl_namespace ()
...
@@ -3981,7 +3981,7 @@ pop_decl_namespace ()
decl_namespace_list
=
TREE_CHAIN
(
decl_namespace_list
);
decl_namespace_list
=
TREE_CHAIN
(
decl_namespace_list
);
}
}
/* Enter a class or namespace scope. */
/* Enter a class or namespace scope.
*/
void
void
push_scope
(
t
)
push_scope
(
t
)
...
@@ -3993,7 +3993,7 @@ push_scope (t)
...
@@ -3993,7 +3993,7 @@ push_scope (t)
pushclass
(
t
,
2
);
pushclass
(
t
,
2
);
}
}
/* Leave scope pushed by push_scope. */
/* Leave scope pushed by push_scope.
*/
void
void
pop_scope
(
t
)
pop_scope
(
t
)
...
@@ -4039,7 +4039,7 @@ add_function (k, fn)
...
@@ -4039,7 +4039,7 @@ add_function (k, fn)
total number of functions being compared, which should usually be the
total number of functions being compared, which should usually be the
case. */
case. */
/* We must find only functions, or exactly one non-function. */
/* We must find only functions, or exactly one non-function.
*/
if
(
!
k
->
functions
)
if
(
!
k
->
functions
)
k
->
functions
=
fn
;
k
->
functions
=
fn
;
else
if
(
is_overloaded_fn
(
k
->
functions
)
&&
is_overloaded_fn
(
fn
))
else
if
(
is_overloaded_fn
(
k
->
functions
)
&&
is_overloaded_fn
(
fn
))
...
@@ -4153,19 +4153,19 @@ arg_assoc_class (k, type)
...
@@ -4153,19 +4153,19 @@ arg_assoc_class (k, type)
if
(
arg_assoc_namespace
(
k
,
context
))
if
(
arg_assoc_namespace
(
k
,
context
))
return
1
;
return
1
;
/* Process baseclasses. */
/* Process baseclasses.
*/
for
(
i
=
0
;
i
<
CLASSTYPE_N_BASECLASSES
(
type
);
i
++
)
for
(
i
=
0
;
i
<
CLASSTYPE_N_BASECLASSES
(
type
);
i
++
)
if
(
arg_assoc_class
(
k
,
TYPE_BINFO_BASETYPE
(
type
,
i
)))
if
(
arg_assoc_class
(
k
,
TYPE_BINFO_BASETYPE
(
type
,
i
)))
return
1
;
return
1
;
/* Process friends. */
/* Process friends.
*/
for
(
list
=
DECL_FRIENDLIST
(
TYPE_MAIN_DECL
(
type
));
list
;
for
(
list
=
DECL_FRIENDLIST
(
TYPE_MAIN_DECL
(
type
));
list
;
list
=
TREE_CHAIN
(
list
))
list
=
TREE_CHAIN
(
list
))
if
(
k
->
name
==
TREE_PURPOSE
(
list
))
if
(
k
->
name
==
TREE_PURPOSE
(
list
))
for
(
friends
=
TREE_VALUE
(
list
);
friends
;
for
(
friends
=
TREE_VALUE
(
list
);
friends
;
friends
=
TREE_CHAIN
(
friends
))
friends
=
TREE_CHAIN
(
friends
))
/* Only interested in global functions with potentially hidden
/* Only interested in global functions with potentially hidden
(i.e. unqualified) declarations. */
(i.e. unqualified) declarations.
*/
if
(
TREE_PURPOSE
(
friends
)
==
error_mark_node
&&
TREE_VALUE
(
friends
)
if
(
TREE_PURPOSE
(
friends
)
==
error_mark_node
&&
TREE_VALUE
(
friends
)
&&
decl_namespace
(
TREE_VALUE
(
friends
))
==
context
)
&&
decl_namespace
(
TREE_VALUE
(
friends
))
==
context
)
if
(
add_function
(
k
,
TREE_VALUE
(
friends
)))
if
(
add_function
(
k
,
TREE_VALUE
(
friends
)))
...
@@ -4212,7 +4212,7 @@ arg_assoc_type (k, type)
...
@@ -4212,7 +4212,7 @@ arg_assoc_type (k, type)
case
ENUMERAL_TYPE
:
case
ENUMERAL_TYPE
:
return
arg_assoc_namespace
(
k
,
decl_namespace
(
TYPE_MAIN_DECL
(
type
)));
return
arg_assoc_namespace
(
k
,
decl_namespace
(
TYPE_MAIN_DECL
(
type
)));
case
OFFSET_TYPE
:
case
OFFSET_TYPE
:
/* Pointer to member: associate class type and value type. */
/* Pointer to member: associate class type and value type.
*/
if
(
arg_assoc_type
(
k
,
TYPE_OFFSET_BASETYPE
(
type
)))
if
(
arg_assoc_type
(
k
,
TYPE_OFFSET_BASETYPE
(
type
)))
return
1
;
return
1
;
return
arg_assoc_type
(
k
,
TREE_TYPE
(
type
));
return
arg_assoc_type
(
k
,
TREE_TYPE
(
type
));
...
@@ -4220,10 +4220,10 @@ arg_assoc_type (k, type)
...
@@ -4220,10 +4220,10 @@ arg_assoc_type (k, type)
/* The basetype is referenced in the first arg type, so just
/* The basetype is referenced in the first arg type, so just
fall through. */
fall through. */
case
FUNCTION_TYPE
:
case
FUNCTION_TYPE
:
/* Associate the parameter types. */
/* Associate the parameter types.
*/
if
(
arg_assoc_args
(
k
,
TYPE_ARG_TYPES
(
type
)))
if
(
arg_assoc_args
(
k
,
TYPE_ARG_TYPES
(
type
)))
return
1
;
return
1
;
/* Associate the return type. */
/* Associate the return type.
*/
return
arg_assoc_type
(
k
,
TREE_TYPE
(
type
));
return
arg_assoc_type
(
k
,
TREE_TYPE
(
type
));
case
TEMPLATE_TYPE_PARM
:
case
TEMPLATE_TYPE_PARM
:
case
BOUND_TEMPLATE_TEMPLATE_PARM
:
case
BOUND_TEMPLATE_TEMPLATE_PARM
:
...
@@ -4332,7 +4332,7 @@ arg_assoc (k, n)
...
@@ -4332,7 +4332,7 @@ arg_assoc (k, n)
}
}
/* Performs Koenig lookup depending on arguments, where fns
/* Performs Koenig lookup depending on arguments, where fns
are the functions found in normal lookup. */
are the functions found in normal lookup.
*/
tree
tree
lookup_arg_dependent
(
name
,
fns
,
args
)
lookup_arg_dependent
(
name
,
fns
,
args
)
...
@@ -4360,7 +4360,7 @@ lookup_arg_dependent (name, fns, args)
...
@@ -4360,7 +4360,7 @@ lookup_arg_dependent (name, fns, args)
return
k
.
functions
;
return
k
.
functions
;
}
}
/* Process a namespace-alias declaration. */
/* Process a namespace-alias declaration.
*/
void
void
do_namespace_alias
(
alias
,
namespace
)
do_namespace_alias
(
alias
,
namespace
)
...
@@ -4368,21 +4368,21 @@ do_namespace_alias (alias, namespace)
...
@@ -4368,21 +4368,21 @@ do_namespace_alias (alias, namespace)
{
{
if
(
TREE_CODE
(
namespace
)
!=
NAMESPACE_DECL
)
if
(
TREE_CODE
(
namespace
)
!=
NAMESPACE_DECL
)
{
{
/* The parser did not find it, so it's not there. */
/* The parser did not find it, so it's not there.
*/
error
(
"unknown namespace `%D'"
,
namespace
);
error
(
"unknown namespace `%D'"
,
namespace
);
return
;
return
;
}
}
namespace
=
ORIGINAL_NAMESPACE
(
namespace
);
namespace
=
ORIGINAL_NAMESPACE
(
namespace
);
/* Build the alias. */
/* Build the alias.
*/
alias
=
build_lang_decl
(
NAMESPACE_DECL
,
alias
,
void_type_node
);
alias
=
build_lang_decl
(
NAMESPACE_DECL
,
alias
,
void_type_node
);
DECL_NAMESPACE_ALIAS
(
alias
)
=
namespace
;
DECL_NAMESPACE_ALIAS
(
alias
)
=
namespace
;
pushdecl
(
alias
);
pushdecl
(
alias
);
}
}
/* Check a non-member using-declaration. Return the name and scope
/* Check a non-member using-declaration. Return the name and scope
being used, and the USING_DECL, or NULL_TREE on failure. */
being used, and the USING_DECL, or NULL_TREE on failure.
*/
static
tree
static
tree
validate_nonmember_using_decl
(
decl
,
scope
,
name
)
validate_nonmember_using_decl
(
decl
,
scope
,
name
)
...
@@ -4435,11 +4435,11 @@ validate_nonmember_using_decl (decl, scope, name)
...
@@ -4435,11 +4435,11 @@ validate_nonmember_using_decl (decl, scope, name)
abort
();
abort
();
if
(
DECL_P
(
*
name
))
if
(
DECL_P
(
*
name
))
*
name
=
DECL_NAME
(
*
name
);
*
name
=
DECL_NAME
(
*
name
);
/* Make a USING_DECL. */
/* Make a USING_DECL.
*/
return
push_using_decl
(
*
scope
,
*
name
);
return
push_using_decl
(
*
scope
,
*
name
);
}
}
/* Process local and global using-declarations. */
/* Process local and global using-declarations.
*/
static
void
static
void
do_nonmember_using_decl
(
scope
,
name
,
oldval
,
oldtype
,
newval
,
newtype
)
do_nonmember_using_decl
(
scope
,
name
,
oldval
,
oldtype
,
newval
,
newtype
)
...
@@ -4461,7 +4461,7 @@ do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype)
...
@@ -4461,7 +4461,7 @@ do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype)
return
;
return
;
}
}
/* Check for using functions. */
/* Check for using functions.
*/
if
(
BINDING_VALUE
(
decls
)
&&
is_overloaded_fn
(
BINDING_VALUE
(
decls
)))
if
(
BINDING_VALUE
(
decls
)
&&
is_overloaded_fn
(
BINDING_VALUE
(
decls
)))
{
{
tree
tmp
,
tmp1
;
tree
tmp
,
tmp1
;
...
@@ -4541,7 +4541,7 @@ do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype)
...
@@ -4541,7 +4541,7 @@ do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype)
}
}
}
}
/* Process a using-declaration not appearing in class or local scope. */
/* Process a using-declaration not appearing in class or local scope.
*/
void
void
do_toplevel_using_decl
(
decl
)
do_toplevel_using_decl
(
decl
)
...
@@ -4561,7 +4561,7 @@ do_toplevel_using_decl (decl)
...
@@ -4561,7 +4561,7 @@ do_toplevel_using_decl (decl)
do_nonmember_using_decl
(
scope
,
name
,
oldval
,
oldtype
,
&
newval
,
&
newtype
);
do_nonmember_using_decl
(
scope
,
name
,
oldval
,
oldtype
,
&
newval
,
&
newtype
);
/* Copy declarations found. */
/* Copy declarations found.
*/
if
(
newval
)
if
(
newval
)
BINDING_VALUE
(
binding
)
=
newval
;
BINDING_VALUE
(
binding
)
=
newval
;
if
(
newtype
)
if
(
newtype
)
...
@@ -4658,7 +4658,7 @@ do_class_using_decl (decl)
...
@@ -4658,7 +4658,7 @@ do_class_using_decl (decl)
return
value
;
return
value
;
}
}
/* Process a using-directive. */
/* Process a using-directive.
*/
void
void
do_using_directive
(
namespace
)
do_using_directive
(
namespace
)
...
@@ -4672,7 +4672,7 @@ do_using_directive (namespace)
...
@@ -4672,7 +4672,7 @@ do_using_directive (namespace)
namespace
=
TREE_OPERAND
(
namespace
,
1
);
namespace
=
TREE_OPERAND
(
namespace
,
1
);
if
(
TREE_CODE
(
namespace
)
==
IDENTIFIER_NODE
)
if
(
TREE_CODE
(
namespace
)
==
IDENTIFIER_NODE
)
{
{
/* Lookup in lexer did not find a namespace. */
/* Lookup in lexer did not find a namespace.
*/
if
(
!
processing_template_decl
)
if
(
!
processing_template_decl
)
error
(
"namespace `%T' undeclared"
,
namespace
);
error
(
"namespace `%T' undeclared"
,
namespace
);
return
;
return
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment