C FE: improvements to ranges of bad return values
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 17 Dec 2015 21:25:36 +0000 (21:25 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Thu, 17 Dec 2015 21:25:36 +0000 (21:25 +0000)
commit94c40e19af4ca5fe57c990df7f7abec48f5aa3af
tree4c095463412043a04cc04af52d434df35a82c396
parente357a5e03c2e6f3b1d51bebe3c57322b28950b0f
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
gcc/c/ChangeLog
gcc/c/c-parser.c
gcc/c/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/diagnostic-range-bad-return.c [new file with mode: 0644]