diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 2002-01-25 15:45:48 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2002-01-25 15:45:48 -0500 |
commit | 995b5904391de6b8060e74e21654ed2ec5c8cd76 (patch) | |
tree | fb797ef05d7fb0f2a9ed54868b4bbdb2d6901c3b /gcc/builtins.c | |
parent | 75eefe3fe069dc5affd43dd51acfff6c5a974f2d (diff) | |
download | gcc-995b5904391de6b8060e74e21654ed2ec5c8cd76.zip gcc-995b5904391de6b8060e74e21654ed2ec5c8cd76.tar.gz gcc-995b5904391de6b8060e74e21654ed2ec5c8cd76.tar.bz2 |
builtins.c (expand_builtin_strncpy): Use integer_zerop instead of compare_tree_int.
* builtins.c (expand_builtin_strncpy): Use integer_zerop instead
of compare_tree_int.
(expand_builtin_strncat): Likewise.
* c-decl.c (finish_struct): Use tree_low_cst.
* tree.h (compare_tree_int): Arg is unsigned HOST_WIDE_INT.
* tree.c (compare_tree_int): Likewise.
From-SVN: r49222
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 9d308ae..0747806 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -2062,7 +2062,7 @@ expand_builtin_strncpy (arglist, target, mode) return 0; /* If the len parameter is zero, return the dst parameter. */ - if (compare_tree_int (len, 0) == 0) + if (integer_zerop (len)) { /* Evaluate and ignore the src argument in case it has side-effects. */ @@ -2279,10 +2279,11 @@ expand_builtin_memcmp (exp, arglist, target, mode) /* If all arguments are constant, and the value of len is not greater than the lengths of arg1 and arg2, evaluate at compile-time. */ if (host_integerp (len, 1) && p1 && p2 - && compare_tree_int (len, strlen (p1)+1) <= 0 - && compare_tree_int (len, strlen (p2)+1) <= 0) + && compare_tree_int (len, strlen (p1) + 1) <= 0 + && compare_tree_int (len, strlen (p2) + 1) <= 0) { const int r = memcmp (p1, p2, tree_low_cst (len, 1)); + return (r < 0 ? constm1_rtx : (r > 0 ? const1_rtx : const0_rtx)); } @@ -2607,7 +2608,7 @@ expand_builtin_strncat (arglist, target, mode) /* If the requested length is zero, or the src parameter string length is zero, return the dst parameter. */ - if ((TREE_CODE (len) == INTEGER_CST && compare_tree_int (len, 0) == 0) + if ((TREE_CODE (len) == INTEGER_CST && integer_zerop (len)) || (p && *p == '\0')) { /* Evaluate and ignore the src and len parameters in case @@ -2622,9 +2623,9 @@ expand_builtin_strncat (arglist, target, mode) if (TREE_CODE (len) == INTEGER_CST && p && compare_tree_int (len, strlen (p)) >= 0) { - tree newarglist = - tree_cons (NULL_TREE, dst, build_tree_list (NULL_TREE, src)), - fn = built_in_decls[BUILT_IN_STRCAT]; + tree newarglist + = tree_cons (NULL_TREE, dst, build_tree_list (NULL_TREE, src)); + tree fn = built_in_decls[BUILT_IN_STRCAT]; /* If the replacement _DECL isn't initialized, don't do the transformation. */ |