aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-parser.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2015-12-17 21:25:36 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2015-12-17 21:25:36 +0000
commit94c40e19af4ca5fe57c990df7f7abec48f5aa3af (patch)
tree4c095463412043a04cc04af52d434df35a82c396 /gcc/c/c-parser.c
parente357a5e03c2e6f3b1d51bebe3c57322b28950b0f (diff)
downloadgcc-94c40e19af4ca5fe57c990df7f7abec48f5aa3af.zip
gcc-94c40e19af4ca5fe57c990df7f7abec48f5aa3af.tar.gz
gcc-94c40e19af4ca5fe57c990df7f7abec48f5aa3af.tar.bz2
C FE: improvements to ranges of bad return values
gcc/c/ChangeLog: * c-parser.c (c_parser_statement_after_labels): When calling c_finish_return, Use the return expression's location if it has one, falling back to the location of the first token within it. * c-typeck.c (c_finish_return): When issuing warnings about the incorrect presence/absence of a return value, issue a note showing the declaration of the function. gcc/testsuite/ChangeLog: * gcc.dg/diagnostic-range-bad-return.c: New test case. From-SVN: r231786
Diffstat (limited to 'gcc/c/c-parser.c')
-rw-r--r--gcc/c/c-parser.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 43c26ae..353e3da 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -5179,7 +5179,8 @@ c_parser_statement_after_labels (c_parser *parser, vec<tree> *chain)
location_t xloc = c_parser_peek_token (parser)->location;
struct c_expr expr = c_parser_expression_conv (parser);
mark_exp_read (expr.value);
- stmt = c_finish_return (xloc, expr.value, expr.original_type);
+ stmt = c_finish_return (EXPR_LOC_OR_LOC (expr.value, xloc),
+ expr.value, expr.original_type);
goto expect_semicolon;
}
break;