From db2ef60f362d4414a4397e3a1e9a195f8670773a Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 20 Jul 2017 13:52:06 -0400 Subject: [PATCH 26/27] FIXME: C WIP: inform_about_return_type --- gcc/c/c-typeck.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 7362246..11841a1 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -6160,6 +6160,18 @@ inform_for_arg (tree fundecl, location_t ploc, int parmnum, expected_type, actual_type); } +/* FIXME. */ + +static void +inform_about_return_type () +{ + blt_node *bltnode = blt_get_node_for_tree (current_function_decl); + if (!bltnode) + return; + debug (bltnode); + inform (UNKNOWN_LOCATION, "would highlight return type here"); +} + /* Convert value RHS to type TYPE as preparation for an assignment to an lvalue of type TYPE. If ORIGTYPE is not NULL_TREE, it is the original type of RHS; this differs from TREE_TYPE (RHS) for enum @@ -6240,7 +6252,8 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type, pedwarn_init (LOCATION, OPT, IN); \ break; \ case ic_return: \ - pedwarn (LOCATION, OPT, RE); \ + if (pedwarn (LOCATION, OPT, RE)) \ + inform_about_return_type (); \ break; \ default: \ gcc_unreachable (); \ @@ -6266,7 +6279,8 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type, pedwarn (LOCATION, OPT, IN, QUALS); \ break; \ case ic_return: \ - pedwarn (LOCATION, OPT, RE, QUALS); \ + if (pedwarn (LOCATION, OPT, RE, QUALS)) \ + inform_about_return_type (); \ break; \ default: \ gcc_unreachable (); \ @@ -6292,7 +6306,8 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type, warning_at (LOCATION, OPT, IN, QUALS); \ break; \ case ic_return: \ - warning_at (LOCATION, OPT, RE, QUALS); \ + if (warning_at (LOCATION, OPT, RE, QUALS)) \ + inform_about_return_type (); \ break; \ default: \ gcc_unreachable (); \ -- 1.8.5.3