aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>1998-08-24 12:31:38 -0400
committerJason Merrill <jason@gcc.gnu.org>1998-08-24 12:31:38 -0400
commitcce2be438d67e6514c60ce887d0142c9b32dc407 (patch)
tree787f1a2859f32f07454560dbb41cd83af7079dfb /gcc
parent5637343af3448a1e1fbe54c97fa9bccfb0bc5477 (diff)
downloadgcc-cce2be438d67e6514c60ce887d0142c9b32dc407.zip
gcc-cce2be438d67e6514c60ce887d0142c9b32dc407.tar.gz
gcc-cce2be438d67e6514c60ce887d0142c9b32dc407.tar.bz2
decl.c (start_decl): Remove redundant linkage check.
* decl.c (start_decl): Remove redundant linkage check. * typeck.c (c_expand_return): Handle the case that valtype is wider than the functions return type. From-SVN: r21950
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/decl.c25
-rw-r--r--gcc/cp/typeck.c10
3 files changed, 21 insertions, 23 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3297c38..d171e64 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+1998-08-24 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (start_decl): Remove redundant linkage check.
+
+1998-08-24 Gavin Romig-Koch <gavin@cygnus.com>
+
+ * typeck.c (c_expand_return): Handle the case that valtype
+ is wider than the functions return type.
+
1998-08-24 Mark Mitchell <mark@markmitchell.com>
* cp-tree.h (CLASS_TYPE_P): New macro.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 087df2f..8d3d6d9 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6642,26 +6642,6 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
/* Corresponding pop_obstacks is done in `cp_finish_decl'. */
push_obstacks_nochange ();
- /* [basic.link]: A name with no linkage (notably, the name of a class or
- enumeration declared in a local scope) shall not be used to declare an
- entity with linkage.
-
- Only check this for public decls for now. */
- if (TREE_PUBLIC (tem))
- {
- tree t = no_linkage_check (TREE_TYPE (tem));
- if (t)
- {
- if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
- {
- if (TREE_CODE (tem) == FUNCTION_DECL)
- cp_pedwarn ("public decl `%#D' uses anonymous type", tem);
- }
- else
- cp_pedwarn ("non-local decl `%#D' uses local type `%T'", tem, t);
- }
- }
-
#if 0
/* We have no way of knowing whether the initializer will need to be
evaluated at run-time or not until we've parsed it, so let's just put
@@ -7939,9 +7919,10 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
if (t)
{
if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
- cp_pedwarn ("function `%#D' uses anonymous type", decl);
+ cp_pedwarn ("non-local function `%#D' uses anonymous type", decl);
else
- cp_pedwarn ("function `%#D' uses local type `%T'", decl, t);
+ cp_pedwarn ("non-local function `%#D' uses local type `%T'",
+ decl, t);
}
}
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 3bbd6bd..5800f79 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -7362,10 +7362,18 @@ c_expand_return (retval)
}
else
{
+ tree functype = TREE_TYPE (TREE_TYPE (current_function_decl));
+
+ /* First convert the value to the function's return type, then
+ to the type of return value's location to handle the
+ case that functype is thiner than the valtype. */
+
retval = convert_for_initialization
- (NULL_TREE, valtype, retval, LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING,
+ (NULL_TREE, functype, retval, LOOKUP_NORMAL|LOOKUP_ONLYCONVERTING,
"return", NULL_TREE, 0);
+ retval = convert (valtype, retval);
+
if (retval == error_mark_node)
{
/* Avoid warning about control reaching end of function. */