skip_typeref().
authorChristoph Mallon <christoph.mallon@gmx.de>
Fri, 12 Sep 2008 06:25:37 +0000 (06:25 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Fri, 12 Sep 2008 06:25:37 +0000 (06:25 +0000)
[r21880]

parser.c

index 7fb6c97..ced2ef6 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -5224,11 +5224,10 @@ static void parse_external_declaration(void)
                return;
        }
 
-       if (warning.aggregate_return) {
-               const type_t *return_type = type->function.return_type;
-               if (is_type_compound(return_type))
-                       warningf(HERE, "function '%Y' returns an aggregate",
-                                ndeclaration->symbol);
+       if (warning.aggregate_return &&
+           is_type_compound(skip_typeref(type->function.return_type))) {
+               warningf(HERE, "function '%Y' returns an aggregate",
+                        ndeclaration->symbol);
        }
 
        /* ยง 6.7.5.3 (14) a function definition with () means no
@@ -6873,10 +6872,10 @@ static expression_t *parse_call_expression(unsigned precedence,
 
        check_format(&result->call);
 
-       if (warning.aggregate_return) {
-               const type_t *return_type = function_type->return_type;
-               if (is_type_compound(return_type))
-                       warningf(&result->base.source_position, "function call has aggregate value");
+       if (warning.aggregate_return &&
+           is_type_compound(skip_typeref(function_type->return_type))) {
+               warningf(&result->base.source_position,
+                        "function call has aggregate value");
        }
 
        return result;