C FE: improvements to ranges of bad return values
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Dec 2015 21:25:36 +0000 (21:25 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Dec 2015 21:25:36 +0000 (21:25 +0000)
commitb9f9586abf43c7577a5d9377ae2cba00c28ec879
tree4c095463412043a04cc04af52d434df35a82c396
parent71130ef83b18d2ab7be350b472cfc4f56b9f876b
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231786 138bc75d-0d04-0410-961f-82ee72b054a4
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]