On 09/20/2017 12:52 PM, David Malcolm wrote:
When we have a type mismatch in a C++ function call, e.g.

whereas underlining the mismatching things would make the messages
easier to comprehend:

   test.c: In function 'int caller(int, int, float)':
   test.c:5:38: error: invalid conversion from 'int' to 'const char*'
   [-fpermissive]
    return callee (first, second, third);
                          ^~~~~~
   test.c:1:12: note:   initializing argument 2 of 'int callee(int,
   const char*, float)'
    extern int callee (int one, const char *two, float three);

Looks nice.  Thanks for addressing what Jason & I said at the summit.

OK for trunk?

A few nits, I think ...


+  location_t param_loc;
+  if (declarator && declarator->id_loc)
+    param_loc = make_location (declarator->id_loc,
+                              decl_spec_token_start->location,
+                              input_location);
+  else
+    param_loc = make_location (decl_spec_token_start->location,
+                              decl_spec_token_start->location,
+                              input_location);

Are you implicitly relying on UNKNOWN_LOCATION being zero? Should the if condition be
  if (declarator && declarator->id_loc != UNKNOWN_LOCATION)
?

The only difference between those 2 calls is the first param. I find such idiom confusing. Can you assign the arg to a temp and then call the function exactly once? No need for re-review on that change.

  /* A collection of calls where argument 2 is of the wrong type.
TODO: we should put the caret and underline for the diagnostic
-   at the second argument, rather than the close paren.
-
-   TODO: we should highlight the second parameter of the callee, rather
-   than its name.  */
+   at the second argument, rather than the close paren.  */

Yay, x-off a TODO!

Looks good otherwise.

nathan

--
Nathan Sidwell

Reply via email to