aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>1999-06-03 07:16:15 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>1999-06-03 07:16:15 +0000
commitb4f70b3d4214872f1bb55c2f63c0ce030d4f8bb8 (patch)
treedcd1510ff4351574ab43d808d4b1fa7949f61077 /gcc/cp
parent8a8c36562fddd1dcaf5ebc8dee47d7cb20bc7a88 (diff)
downloadgcc-b4f70b3d4214872f1bb55c2f63c0ce030d4f8bb8.zip
gcc-b4f70b3d4214872f1bb55c2f63c0ce030d4f8bb8.tar.gz
gcc-b4f70b3d4214872f1bb55c2f63c0ce030d4f8bb8.tar.bz2
semantics.c (begin_class_definition): Update the struct's location here ...
* semantics.c (begin_class_definition): Update the struct's location here ... * class.c (finish_struct): ... rather than here. * decl.c (make_typename_type): Don't rely on uninitialized variable. From-SVN: r27326
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/class.c17
-rw-r--r--gcc/cp/decl.c10
-rw-r--r--gcc/cp/semantics.c4
4 files changed, 18 insertions, 22 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d145518..49ea8bc 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+1999-06-03 Nathan Sidwell <nathan@acm.org>
+
+ * semantics.c (begin_class_definition): Update the struct's
+ location here ...
+ * class.c (finish_struct): ... rather than here.
+
+ * decl.c (make_typename_type): Don't rely on uninitialized
+ variable.
+
1999-05-31 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.in (ALL_CFLAGS): Add '-W -Wall'.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index c6d6bcc..4fe5353 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -4173,23 +4173,6 @@ finish_struct (t, attributes, warn_anon)
tree t, attributes;
int warn_anon;
{
- tree name = TYPE_NAME (t);
-
- if (TREE_CODE (name) == TYPE_DECL)
- {
- extern int lineno;
-
- DECL_SOURCE_FILE (name) = input_filename;
- /* For TYPE_DECL that are not typedefs (those marked with a line
- number of zero, we don't want to mark them as real typedefs.
- If this fails one needs to make sure real typedefs have a
- previous line number, even if it is wrong, that way the below
- will fill in the right line number. (mrs) */
- if (DECL_SOURCE_LINE (name))
- DECL_SOURCE_LINE (name) = lineno;
- name = DECL_NAME (name);
- }
-
/* Append the fields we need for constructing signature tables. */
if (IS_SIGNATURE (t))
append_signature_fields (t);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index c30fa7c..ac9933c 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5516,7 +5516,6 @@ tree
make_typename_type (context, name)
tree context, name;
{
- tree t;
tree fullname;
if (TREE_CODE_CLASS (TREE_CODE (name)) == 't')
@@ -5576,14 +5575,15 @@ make_typename_type (context, name)
}
else
{
- if (IS_AGGR_TYPE (context))
- t = lookup_field (context, name, 0, 1);
- else
+ tree t;
+
+ if (!IS_AGGR_TYPE (context))
{
cp_error ("no type named `%#T' in `%#T'", name, context);
return error_mark_node;
}
+ t = lookup_field (context, name, 0, 1);
if (t)
return TREE_TYPE (t);
}
@@ -5591,7 +5591,7 @@ make_typename_type (context, name)
/* If the CONTEXT is not a template type, then either the field is
there now or its never going to be. */
- if (!uses_template_parms (context) && !t)
+ if (!uses_template_parms (context))
{
cp_error ("no type named `%#T' in `%#T'", name, context);
return error_mark_node;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 5be0ae1..37fb9da 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1297,6 +1297,10 @@ begin_class_definition (t)
else if (TYPE_SIZE (t))
duplicate_tag_error (t);
+ /* Update the location of the decl. */
+ DECL_SOURCE_FILE (TYPE_NAME (t)) = input_filename;
+ DECL_SOURCE_LINE (TYPE_NAME (t)) = lineno;
+
if (TYPE_BEING_DEFINED (t))
{
t = make_lang_type (TREE_CODE (t));