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/cp | |
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/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index af183b9..cb7e422 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2008-04-24 Richard Guenther <rguenther@suse.de> + + * typeck.c (cp_build_function_call): Call + check_builtin_function_arguments. + 2008-04-23 Paolo Bonzini <bonzini@gnu.org> * typeck.c (get_member_function_from_ptrfunc): Don't set TREE_INVARIANT. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 4a5039e..cd733bf 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2889,9 +2889,15 @@ cp_build_function_call (tree function, tree params, tsubst_flags_t complain) if (nargs < 0) return error_mark_node; + /* Check that arguments to builtin functions match the expectations. */ + if (fndecl + && DECL_BUILT_IN (fndecl) + && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL + && !check_builtin_function_arguments (fndecl, nargs, argarray)) + return error_mark_node; + /* Check for errors in format strings and inappropriately null parameters. */ - check_function_arguments (TYPE_ATTRIBUTES (fntype), nargs, argarray, parm_types); |