diff options
author | Richard Guenther <rguenther@suse.de> | 2008-04-24 16:18:46 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-04-24 16:18:46 +0000 |
commit | 833229510cb13aa643a6005f60882daec616e2b7 (patch) | |
tree | 35dd8b11788bce7a6dab65c4d291872b84068f45 /gcc/builtins.c | |
parent | 194ac52ab4a35f22abafaec46ac22ac303a61ab8 (diff) | |
download | gcc-833229510cb13aa643a6005f60882daec616e2b7.zip gcc-833229510cb13aa643a6005f60882daec616e2b7.tar.gz gcc-833229510cb13aa643a6005f60882daec616e2b7.tar.bz2 |
c-common.h (check_builtin_function_arguments): Declare.
2008-04-24 Richard Guenther <rguenther@suse.de>
* c-common.h (check_builtin_function_arguments): Declare.
* c-common.c (validate_nargs): New function.
(check_builtin_function_arguments): Likewise.
* c-typeck.c (build_function_call): Call
check_builtin_function_arguments.
* builtins.c (fold_builtin_classify): Remove error reporting code.
(fold_builtin_unordered_cmp): Likewise.
(fold_builtin_1): Likewise.
(fold_builtin_n): Likewise.
cp/
* typeck.c (cp_build_function_call): Call
check_builtin_function_arguments.
* gcc.dg/builtin-constant_p-1.c: New testcase.
* gcc.dg/builtin-errors.c: Adjust expected error.
From-SVN: r134635
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 68 |
1 files changed, 1 insertions, 67 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 5b02d8b..54cbde5 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -9645,11 +9645,7 @@ fold_builtin_classify (tree fndecl, tree arg, int builtin_index) REAL_VALUE_TYPE r; if (!validate_arg (arg, REAL_TYPE)) - { - error ("non-floating-point argument to function %qs", - IDENTIFIER_POINTER (DECL_NAME (fndecl))); - return error_mark_node; - } + return NULL_TREE; switch (builtin_index) { @@ -9733,12 +9729,6 @@ fold_builtin_unordered_cmp (tree fndecl, tree arg0, tree arg1, cmp_type = type0; else if (code0 == INTEGER_TYPE && code1 == REAL_TYPE) cmp_type = type1; - else - { - error ("non-floating-point argument to function %qs", - IDENTIFIER_POINTER (DECL_NAME (fndecl))); - return error_mark_node; - } arg0 = fold_convert (cmp_type, arg0); arg1 = fold_convert (cmp_type, arg1); @@ -10087,15 +10077,6 @@ fold_builtin_1 (tree fndecl, tree arg0, bool ignore) case BUILT_IN_ISNAND128: return fold_builtin_classify (fndecl, arg0, BUILT_IN_ISNAN); - case BUILT_IN_ISNORMAL: - if (!validate_arg (arg0, REAL_TYPE)) - { - error ("non-floating-point argument to function %qs", - IDENTIFIER_POINTER (DECL_NAME (fndecl))); - return error_mark_node; - } - break; - case BUILT_IN_PRINTF: case BUILT_IN_PRINTF_UNLOCKED: case BUILT_IN_VPRINTF: @@ -10441,55 +10422,8 @@ fold_builtin_4 (tree fndecl, tree arg0, tree arg1, tree arg2, tree arg3, static tree fold_builtin_n (tree fndecl, tree *args, int nargs, bool ignore) { - enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl); tree ret = NULL_TREE; - /* Verify the number of arguments for type-generic and thus variadic - builtins. */ - switch (fcode) - { - case BUILT_IN_ISFINITE: - case BUILT_IN_ISINF: - case BUILT_IN_ISNAN: - case BUILT_IN_ISNORMAL: - if (nargs < 1) - { - error ("too few arguments to function %qs", - IDENTIFIER_POINTER (DECL_NAME (fndecl))); - return error_mark_node; - } - else if (nargs > 1) - { - error ("too many arguments to function %qs", - IDENTIFIER_POINTER (DECL_NAME (fndecl))); - return error_mark_node; - } - break; - - case BUILT_IN_ISGREATER: - case BUILT_IN_ISGREATEREQUAL: - case BUILT_IN_ISLESS: - case BUILT_IN_ISLESSEQUAL: - case BUILT_IN_ISLESSGREATER: - case BUILT_IN_ISUNORDERED: - if (nargs < 2) - { - error ("too few arguments to function %qs", - IDENTIFIER_POINTER (DECL_NAME (fndecl))); - return error_mark_node; - } - else if (nargs > 2) - { - error ("too many arguments to function %qs", - IDENTIFIER_POINTER (DECL_NAME (fndecl))); - return error_mark_node; - } - break; - - default: - break; - } - switch (nargs) { case 0: |