Commit 8a797929 by Martin Sebor Committed by Martin Sebor

invoke.texi (-Wstringop-truncation): Mention attribute nonstring.

gcc/ChangeLog:

	* doc/invoke.texi (-Wstringop-truncation): Mention attribute
	nonstring.

From-SVN: r255447
parent 25b15e95
2017-12-06 Martin Sebor <msebor@redhat.com> 2017-12-06 Martin Sebor <msebor@redhat.com>
* doc/invoke.texi (-Wstringop-truncation): Mention attribute
nonstring.
PR tree-optimization/83075 PR tree-optimization/83075
* tree-ssa-strlen.c (handle_builtin_stxncpy): Avoid assuming * tree-ssa-strlen.c (handle_builtin_stxncpy): Avoid assuming
strncat/strncpy don't change length of source string. strncat/strncpy don't change length of source string.
...@@ -5256,6 +5256,14 @@ void copy (const char *s) ...@@ -5256,6 +5256,14 @@ void copy (const char *s)
@} @}
@end smallexample @end smallexample
In situations where a character array is intended to store a sequence
of bytes with no terminating @code{NUL} such an array may be annotated
with attribute @code{nonstring} to avoid this warning. Such arrays,
however, are not suitable arguments to functions that expect
@code{NUL}-terminated strings. To help detect accidental misuses of
such arrays GCC issues warnings unless it can prove that the use is
safe. @xref{Common Variable Attributes}.
@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]} @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
@opindex Wsuggest-attribute= @opindex Wsuggest-attribute=
@opindex Wno-suggest-attribute= @opindex Wno-suggest-attribute=
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment