diff options
author | Martin Sebor <msebor@redhat.com> | 2018-09-14 03:34:19 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2018-09-13 21:34:19 -0600 |
commit | 6ab24ea809555eeb869fe49595f22ed9c8737cc4 (patch) | |
tree | a6a98bb3c25e71934a2ae133c6e5116dcb9349b9 /gcc/builtins.h | |
parent | d01b568a78351beb6b693b613e6b48bcb2475eae (diff) | |
download | gcc-6ab24ea809555eeb869fe49595f22ed9c8737cc4.zip gcc-6ab24ea809555eeb869fe49595f22ed9c8737cc4.tar.gz gcc-6ab24ea809555eeb869fe49595f22ed9c8737cc4.tar.bz2 |
builtins.h (c_srlen): Add argument.
* builtins.h (c_srlen): Add argument.
* builtins.c (warn_string_no_nul): New function.
(c_strlen): Add argument and use it. Update recursive calls.
Pass DECL argument to string_constant to get info on non
terminated strings. Update *NONSTR as needed.
(fold_builtin_strlen): Add argument to calls to c_strlen.
Warn for unterminated arrays.
(warn_string_no_null): Add prototype.
* expr.c (string_constant): Update arguments. Update recursive
calls appropriately. Detect missing NUL terminator and outermost
declaration its missing in.
Improve checks for arrays with nonzero lower bound or elements
that are not a single byte. Simplify offset computation.
Simplify checks for non-NUL terminated strings.
* gimple-fold.c (get_range_strlen): Add argument to c_strlen call.
* gimple-ssa-sprintf.c (get_string_length): Remove unnecessary code.
* gcc.dg/warn-strlen-no-nul.c: New test.
Co-Authored-By: Bernd Edlinger <bernd.edlinger@hotmail.de>
Co-Authored-By: Jeff Law <law@redhat.com>
From-SVN: r264302
Diffstat (limited to 'gcc/builtins.h')
-rw-r--r-- | gcc/builtins.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/builtins.h b/gcc/builtins.h index c3d5ccb..7790c85 100644 --- a/gcc/builtins.h +++ b/gcc/builtins.h @@ -57,7 +57,7 @@ extern bool get_pointer_alignment_1 (tree, unsigned int *, unsigned HOST_WIDE_INT *); extern unsigned int get_pointer_alignment (tree); extern unsigned string_length (const void*, unsigned, unsigned); -extern tree c_strlen (tree, int, unsigned = 1); +extern tree c_strlen (tree, int, tree * = NULL, unsigned = 1); extern void expand_builtin_setjmp_setup (rtx, rtx); extern void expand_builtin_setjmp_receiver (rtx); extern void expand_builtin_update_setjmp_buf (rtx); @@ -103,6 +103,7 @@ extern bool target_char_cst_p (tree t, char *p); extern internal_fn associated_internal_fn (tree); extern internal_fn replacement_internal_fn (gcall *); +extern void warn_string_no_nul (location_t, const char *, tree, tree); extern tree max_object_size (); #endif /* GCC_BUILTINS_H */ |