re PR c/35441 (pretty-printer cannot handle some expressions)
2012-04-21 Manuel López-Ibáñez <manu@gcc.gnu.org> PR 35441 * c-typeck.c (inform_declaration): New. (build_function_call_vec): Do not pretty-print expressions when caret is enabled. (convert_arguments): Use inform_declaration. cp/ * typeck.c (cp_build_function_call_vec): Do not pretty-print expressions when caret is enabled. testsuite/ * c-c++-common/pr35441.C: New. From-SVN: r186652
This commit is contained in:
parent
aab316c7c9
commit
ae52741c5e
|
@ -1,3 +1,11 @@
|
|||
2012-04-21 Manuel López-Ibáñez <manu@gcc.gnu.org>
|
||||
|
||||
PR 35441
|
||||
* c-typeck.c (inform_declaration): New.
|
||||
(build_function_call_vec): Do not pretty-print
|
||||
expressions when caret is enabled.
|
||||
(convert_arguments): Use inform_declaration.
|
||||
|
||||
2012-04-20 Jim Meyering <meyering@redhat.com>
|
||||
|
||||
* genmodes.c (make_complex_modes): Don't truncate a mode name of
|
||||
|
|
|
@ -2682,6 +2682,14 @@ build_function_call (location_t loc, tree function, tree params)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* Give a note about the location of the declaration of DECL. */
|
||||
|
||||
static void inform_declaration (tree decl)
|
||||
{
|
||||
if (decl && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_BUILT_IN (decl)))
|
||||
inform (DECL_SOURCE_LOCATION (decl), "declared here");
|
||||
}
|
||||
|
||||
/* Build a function call to function FUNCTION with parameters PARAMS.
|
||||
ORIGTYPES, if not NULL, is a vector of types; each element is
|
||||
either NULL or the original type of the corresponding element in
|
||||
|
@ -2744,7 +2752,20 @@ build_function_call_vec (location_t loc, tree function, VEC(tree,gc) *params,
|
|||
if (!(TREE_CODE (fntype) == POINTER_TYPE
|
||||
&& TREE_CODE (TREE_TYPE (fntype)) == FUNCTION_TYPE))
|
||||
{
|
||||
error_at (loc, "called object %qE is not a function", function);
|
||||
if (!flag_diagnostics_show_caret)
|
||||
error_at (loc,
|
||||
"called object %qE is not a function or function pointer",
|
||||
function);
|
||||
else if (DECL_P (function))
|
||||
{
|
||||
error_at (loc,
|
||||
"called object %qD is not a function or function pointer",
|
||||
function);
|
||||
inform_declaration (function);
|
||||
}
|
||||
else
|
||||
error_at (loc,
|
||||
"called object is not a function or function pointer");
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
@ -3034,9 +3055,7 @@ convert_arguments (tree typelist, VEC(tree,gc) *values,
|
|||
else
|
||||
error_at (input_location,
|
||||
"too many arguments to function %qE", function);
|
||||
|
||||
if (fundecl && !DECL_BUILT_IN (fundecl))
|
||||
inform (DECL_SOURCE_LOCATION (fundecl), "declared here");
|
||||
inform_declaration (fundecl);
|
||||
return parmnum;
|
||||
}
|
||||
|
||||
|
@ -3269,8 +3288,7 @@ convert_arguments (tree typelist, VEC(tree,gc) *values,
|
|||
{
|
||||
error_at (input_location,
|
||||
"too few arguments to function %qE", function);
|
||||
if (fundecl && !DECL_BUILT_IN (fundecl))
|
||||
inform (DECL_SOURCE_LOCATION (fundecl), "declared here");
|
||||
inform_declaration (fundecl);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2012-04-21 Manuel López-Ibáñez <manu@gcc.gnu.org>
|
||||
|
||||
PR 35441
|
||||
* typeck.c (cp_build_function_call_vec): Do not pretty-print
|
||||
expressions when caret is enabled.
|
||||
|
||||
2012-04-20 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
PR target/53042
|
||||
|
|
|
@ -3322,7 +3322,18 @@ cp_build_function_call_vec (tree function, VEC(tree,gc) **params,
|
|||
|| TREE_CODE (function) == TEMPLATE_ID_EXPR))
|
||||
{
|
||||
if (complain & tf_error)
|
||||
error ("%qE cannot be used as a function", original);
|
||||
{
|
||||
if (!flag_diagnostics_show_caret)
|
||||
error_at (input_location,
|
||||
"%qE cannot be used as a function", original);
|
||||
else if (DECL_P (original))
|
||||
error_at (input_location,
|
||||
"%qD cannot be used as a function", original);
|
||||
else
|
||||
error_at (input_location,
|
||||
"expression cannot be used as a function");
|
||||
}
|
||||
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2012-04-21 Manuel López-Ibáñez <manu@gcc.gnu.org>
|
||||
|
||||
PR 35441
|
||||
* c-c++-common/pr35441.C: New.
|
||||
|
||||
2012-04-20 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
* go.test/go-test.exp (go-set-goarch): Recognize powerpc*-*-*.
|
||||
|
|
Loading…
Reference in New Issue