aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc/extend.texi
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2018-06-18 16:32:59 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2018-06-18 10:32:59 -0600
commit781ff3d80e88d7d0df019eb3e82ef2a3fb64429c (patch)
tree01c31801fe48b1c21114b772785de9eefe119e7b /gcc/doc/extend.texi
parent7314856c61938db90d66f4cead8e4df73ea5d3af (diff)
downloadgcc-781ff3d80e88d7d0df019eb3e82ef2a3fb64429c.zip
gcc-781ff3d80e88d7d0df019eb3e82ef2a3fb64429c.tar.gz
gcc-781ff3d80e88d7d0df019eb3e82ef2a3fb64429c.tar.bz2
PR tree-optimization/81384 - built-in form of strnlen missing
gcc/ChangeLog: PR tree-optimization/81384 * builtin-types.def (BT_FN_SIZE_CONST_STRING_SIZE): New. * builtins.c (expand_builtin_strnlen): New function. (expand_builtin): Call it. (fold_builtin_n): Avoid setting TREE_NO_WARNING. * builtins.def (BUILT_IN_STRNLEN): New. * calls.c (maybe_warn_nonstring_arg): Handle BUILT_IN_STRNLEN. Warn for bounds in excess of maximum object size. * tree-ssa-strlen.c (maybe_set_strlen_range): Return tree representing single-value ranges. Handle strnlen. (handle_builtin_strlen): Handle strnlen. (strlen_check_and_optimize_stmt): Same. * doc/extend.texi (Other Builtins): Document strnlen. gcc/testsuite/ChangeLog: PR tree-optimization/81384 * gcc.c-torture/execute/builtins/lib/strnlen.c: New test. * gcc.c-torture/execute/builtins/strnlen-lib.c: New test. * gcc.c-torture/execute/builtins/strnlen.c: New test. * gcc.dg/attr-nonstring-2.c: New test. * gcc.dg/attr-nonstring-3.c: New test. * gcc.dg/attr-nonstring-4.c: New test. * gcc.dg/strlenopt-45.c: New test. * gcc.dg/strlenopt.h (strnlen): Declare. From-SVN: r261705
Diffstat (limited to 'gcc/doc/extend.texi')
-rw-r--r--gcc/doc/extend.texi5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index ca96c08..cf88175 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -11255,6 +11255,7 @@ is called and the @var{flag} argument passed to it.
@findex strncmp
@findex strncpy
@findex strndup
+@findex strnlen
@findex strpbrk
@findex strrchr
@findex strspn
@@ -11338,8 +11339,8 @@ Outside strict ISO C mode (@option{-ansi}, @option{-std=c90},
@code{significandl}, @code{significand}, @code{sincosf},
@code{sincosl}, @code{sincos}, @code{stpcpy}, @code{stpncpy},
@code{strcasecmp}, @code{strdup}, @code{strfmon}, @code{strncasecmp},
-@code{strndup}, @code{toascii}, @code{y0f}, @code{y0l}, @code{y0},
-@code{y1f}, @code{y1l}, @code{y1}, @code{ynf}, @code{ynl} and
+@code{strndup}, @code{strnlen}, @code{toascii}, @code{y0f}, @code{y0l},
+@code{y0}, @code{y1f}, @code{y1l}, @code{y1}, @code{ynf}, @code{ynl} and
@code{yn}
may be handled as built-in functions.
All these functions have corresponding versions