From: Mark Mitchell Date: Tue, 3 Feb 1998 23:55:27 +0000 (+0000) Subject: cvt.c (ocp_convert): Obtain the constant values from constant decls even if... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c0d03672f068d9fc7cf3297fbd571f1ff197452;p=platform%2Fupstream%2Fgcc.git 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 --- 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 + + * 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 * 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.