aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mmitchell@usa.net>1998-02-03 23:55:27 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-02-03 18:55:27 -0500
commit9c0d03672f068d9fc7cf3297fbd571f1ff197452 (patch)
tree0c9d2a5e3fd8e4ba0ab743c17c155a9eda0f0241
parentcf7761053226ab90efadc907da7a1ce3664b33a0 (diff)
downloadgcc-9c0d03672f068d9fc7cf3297fbd571f1ff197452.zip
gcc-9c0d03672f068d9fc7cf3297fbd571f1ff197452.tar.gz
gcc-9c0d03672f068d9fc7cf3297fbd571f1ff197452.tar.bz2
cvt.c (ocp_convert): Obtain the constant values from constant decls even if...
* cvt.c (ocp_convert): Obtain the constant values from constant decls even if the destination type is the same as the type of the decl. * decl2.c (finish_file): Make sure that static inlines with definitions are not marked DECL_EXTERNAL before returning. From-SVN: r17653
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/cvt.c8
-rw-r--r--gcc/cp/decl2.c19
3 files changed, 32 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c9b9263..d7086dc 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+Tue Feb 3 23:50:52 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * cvt.c (ocp_convert): Obtain the constant values from constant
+ decls even if the destination type is the same as the type of the
+ decl.
+
+ * decl2.c (finish_file): Make sure that static inlines with
+ definitions are not marked DECL_EXTERNAL before returning.
+
Tue Feb 3 22:43:42 1998 Jason Merrill <jason@yorick.cygnus.com>
* decl.c: Lose arg_looking_for_template.
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index c5a5f93..0fdce85 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -982,6 +982,9 @@ ocp_convert (type, expr, convtype, flags)
|| TREE_TYPE (e) == error_mark_node)
return error_mark_node;
+ if (TREE_READONLY_DECL_P (e))
+ e = decl_constant_value (e);
+
if (IS_AGGR_TYPE (type) && (convtype & CONV_FORCE_TEMP))
/* We need a new temporary; don't take this shortcut. */;
else if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (e)))
@@ -1015,9 +1018,6 @@ ocp_convert (type, expr, convtype, flags)
if (TREE_CODE (e) == OFFSET_REF)
e = resolve_offset_ref (e);
- if (TREE_READONLY_DECL_P (e))
- e = decl_constant_value (e);
-
if (INTEGRAL_CODE_P (code))
{
tree intype = TREE_TYPE (e);
@@ -1186,7 +1186,7 @@ ocp_convert (type, expr, convtype, flags)
}
/* If TYPE or TREE_TYPE (E) is not on the permanent_obstack,
- then the it won't be hashed and hence compare as not equal,
+ then it won't be hashed and hence compare as not equal,
even when it is. */
if (code == ARRAY_TYPE
&& TREE_TYPE (TREE_TYPE (e)) == TREE_TYPE (type)
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index a7eb19b..c9e11f4 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -3286,6 +3286,25 @@ finish_file ()
p = &TREE_CHAIN (*p);
}
}
+
+ /* It's possible that some of the remaining inlines will still be
+ needed. For example, a static inline whose address is used in
+ the initializer for a file-scope static variable will be
+ needed. Code in compile_file will handle this, but we mustn't
+ pretend that there are no definitions for the inlines, or it
+ won't be able to.
+
+ FIXME: This won't catch member functions. We should really
+ unify this stuff with the compile_file stuff. */
+ for (vars = saved_inlines; vars != NULL_TREE; vars = TREE_CHAIN (vars))
+ {
+ tree decl = TREE_VALUE (vars);
+
+ if (DECL_NOT_REALLY_EXTERN (decl)
+ && !DECL_COMDAT (decl)
+ && DECL_INITIAL (decl) != NULL_TREE)
+ DECL_EXTERNAL (decl) = 0;
+ }
}
/* Now delete from the chain of variables all virtual function tables.