diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 2000-11-01 03:22:21 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 2000-11-01 03:22:21 +0000 |
commit | 78e7629e9f2b78c8ade485fb2e209427d2696300 (patch) | |
tree | e4e757584dc941d8bee942e484a6fd8344b8fa09 /gcc/c-common.c | |
parent | 9f56c00431885c8a5dd23d872beb232546e00a9c (diff) | |
download | gcc-78e7629e9f2b78c8ade485fb2e209427d2696300.zip gcc-78e7629e9f2b78c8ade485fb2e209427d2696300.tar.gz gcc-78e7629e9f2b78c8ade485fb2e209427d2696300.tar.bz2 |
builtins.c (expand_builtin_strstr): New function.
* builtins.c (expand_builtin_strstr): New function.
(expand_builtin): Handle BUILT_IN_STRSTR and BUILT_IN_STRCHR.
* builtins.def (BUILT_IN_STRSTR, BUILT_IN_STRCHR): New entries.
* c-common.c (c_common_nodes_and_builtins): Declare builtin strstr
and builtin strchr.
From-SVN: r37181
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index e9ce259..03875fa 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -4819,6 +4819,7 @@ c_common_nodes_and_builtins () tree float_ftype_float, ldouble_ftype_ldouble; tree int_ftype_cptr_cptr_sizet; tree int_ftype_string_string, string_ftype_ptr_ptr; + tree string_ftype_string_int, string_ftype_string_string; tree long_ftype_long; tree longlong_ftype_longlong; /* Either char* or void*. */ @@ -4933,6 +4934,22 @@ c_common_nodes_and_builtins () const_string_type_node, endlink))); + /* Prototype for strstr, etc. */ + string_ftype_string_string + = build_function_type (string_type_node, + tree_cons (NULL_TREE, const_string_type_node, + tree_cons (NULL_TREE, + const_string_type_node, + endlink))); + + /* Prototype for strchr. */ + string_ftype_string_int + = build_function_type (string_type_node, + tree_cons (NULL_TREE, const_string_type_node, + tree_cons (NULL_TREE, + integer_type_node, + endlink))); + /* Prototype for strlen. */ strlen_ftype = build_function_type (traditional_len_type_node, @@ -5154,6 +5171,11 @@ c_common_nodes_and_builtins () BUILT_IN_BCMP, BUILT_IN_NORMAL, "bcmp"); builtin_function ("__builtin_strcmp", int_ftype_string_string, BUILT_IN_STRCMP, BUILT_IN_NORMAL, "strcmp"); + builtin_function ("__builtin_strstr", string_ftype_string_string, + BUILT_IN_STRSTR, BUILT_IN_NORMAL, "strstr"); + built_in_decls[BUILT_IN_STRCHR] = + builtin_function ("__builtin_strchr", string_ftype_string_int, + BUILT_IN_STRCHR, BUILT_IN_NORMAL, "strchr"); builtin_function ("__builtin_strcpy", string_ftype_ptr_ptr, BUILT_IN_STRCPY, BUILT_IN_NORMAL, "strcpy"); builtin_function ("__builtin_strlen", strlen_ftype, @@ -5222,6 +5244,8 @@ c_common_nodes_and_builtins () BUILT_IN_NORMAL, NULL_PTR); builtin_function ("strcmp", int_ftype_string_string, BUILT_IN_STRCMP, BUILT_IN_NORMAL, NULL_PTR); + builtin_function ("strstr", string_ftype_string_string, BUILT_IN_STRSTR, + BUILT_IN_NORMAL, NULL_PTR); builtin_function ("strcpy", string_ftype_ptr_ptr, BUILT_IN_STRCPY, BUILT_IN_NORMAL, NULL_PTR); builtin_function ("strlen", strlen_ftype, BUILT_IN_STRLEN, |