+2015-09-30 Marek Polacek <polacek@redhat.com>
+
+ PR c/67730
+ * c-typeck.c (c_finish_return): Use the expansion point location for
+ certain "return with value" warnings.
+
2015-09-18 Manuel López-Ibáñez <manu@gcc.gnu.org>
* c-parser.c (pragma_lex): Add loc argument.
bool npc = false;
size_t rank = 0;
+ /* Use the expansion point to handle cases such as returning NULL
+ in a function returning void. */
+ source_location xloc = expansion_point_location_if_in_system_header (loc);
+
if (TREE_THIS_VOLATILE (current_function_decl))
- warning_at (loc, 0,
+ warning_at (xloc, 0,
"function declared %<noreturn%> has a %<return%> statement");
if (flag_cilkplus && contains_array_notation_expr (retval))
{
current_function_returns_null = 1;
if (TREE_CODE (TREE_TYPE (retval)) != VOID_TYPE)
- pedwarn (loc, 0,
+ pedwarn (xloc, 0,
"%<return%> with a value, in function returning void");
else
- pedwarn (loc, OPT_Wpedantic, "ISO C forbids "
+ pedwarn (xloc, OPT_Wpedantic, "ISO C forbids "
"%<return%> with expression, in function returning void");
}
else
+2015-09-30 Marek Polacek <polacek@redhat.com>
+
+ PR c/67730
+ * gcc.dg/pr67730.c: New test.
+
2015-09-30 Marek Polacek <polacek@redhat.com>
PR tree-optimization/67690