summaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2010-02-22 22:30:45 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2010-02-22 22:30:45 +0000
commit60cce4727af9707a37b1eace97e7c07f07f0d60f (patch)
tree83af312d2bb69101bf71d922763360c32afd84cf /gcc/c-common.c
parent98759f795880f7652676a0fe7bf18b60311769b9 (diff)
downloadgcc-60cce4727af9707a37b1eace97e7c07f07f0d60f.tar.gz
2010-02-22 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c++/43126 * c-typeck.c (convert_arguments): Print declaration location. * c-common.c (validate_nargs): Rename as builtin_function_validate_nargs. (check_builtin_function_arguments): Update. cp/ * typeck.c (convert_arguments): Update error message. testsuite/ * gcc.dg/cleanup-1.c: Update. * gcc.dg/func-args-1.c: Update. * gcc.dg/format/sentinel-1.c: Update. * g++.old-deja/g++.jason/scoping10.C: Update. * g++.old-deja/g++.ns/lookup5.C: Update. * g++.dg/ext/cleanup-1.C: Update. * g++.dg/parse/varmod1.C: Update. * g++.dg/parse/error33.C: Update. * g++.dg/expr/call3.C: Update. * g++.dg/func-args-1.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156979 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 1039e24e0d4..0bee9376b04 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -7980,21 +7980,24 @@ check_function_arguments_recurse (void (*callback)
(*callback) (ctx, param, param_num);
}
-/* Checks the number of arguments NARGS against the required number
- REQUIRED and issues an error if there is a mismatch. Returns true
- if the number of arguments is correct, otherwise false. */
+/* Checks for a builtin function FNDECL that the number of arguments
+ NARGS against the required number REQUIRED and issues an error if
+ there is a mismatch. Returns true if the number of arguments is
+ correct, otherwise false. */
static bool
-validate_nargs (tree fndecl, int nargs, int required)
+builtin_function_validate_nargs (tree fndecl, int nargs, int required)
{
if (nargs < required)
{
- error ("not enough arguments to function %qE", fndecl);
+ error_at (input_location,
+ "not enough arguments to function %qE", fndecl);
return false;
}
else if (nargs > required)
{
- error ("too many arguments to function %qE", fndecl);
+ error_at (input_location,
+ "too many arguments to function %qE", fndecl);
return false;
}
return true;
@@ -8013,14 +8016,14 @@ check_builtin_function_arguments (tree fndecl, int nargs, tree *args)
switch (DECL_FUNCTION_CODE (fndecl))
{
case BUILT_IN_CONSTANT_P:
- return validate_nargs (fndecl, nargs, 1);
+ return builtin_function_validate_nargs (fndecl, nargs, 1);
case BUILT_IN_ISFINITE:
case BUILT_IN_ISINF:
case BUILT_IN_ISINF_SIGN:
case BUILT_IN_ISNAN:
case BUILT_IN_ISNORMAL:
- if (validate_nargs (fndecl, nargs, 1))
+ if (builtin_function_validate_nargs (fndecl, nargs, 1))
{
if (TREE_CODE (TREE_TYPE (args[0])) != REAL_TYPE)
{
@@ -8038,7 +8041,7 @@ check_builtin_function_arguments (tree fndecl, int nargs, tree *args)
case BUILT_IN_ISLESSEQUAL:
case BUILT_IN_ISLESSGREATER:
case BUILT_IN_ISUNORDERED:
- if (validate_nargs (fndecl, nargs, 2))
+ if (builtin_function_validate_nargs (fndecl, nargs, 2))
{
enum tree_code code0, code1;
code0 = TREE_CODE (TREE_TYPE (args[0]));
@@ -8056,7 +8059,7 @@ check_builtin_function_arguments (tree fndecl, int nargs, tree *args)
return false;
case BUILT_IN_FPCLASSIFY:
- if (validate_nargs (fndecl, nargs, 6))
+ if (builtin_function_validate_nargs (fndecl, nargs, 6))
{
unsigned i;