From: Martin Sebor Date: Wed, 6 Dec 2017 17:51:21 +0000 (+0000) Subject: invoke.texi (-Wstringop-truncation): Mention attribute nonstring. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8a797929f09274ccbf95ee7d8e415d35c1f5b0d1;p=gcc.git invoke.texi (-Wstringop-truncation): Mention attribute nonstring. gcc/ChangeLog: * doc/invoke.texi (-Wstringop-truncation): Mention attribute nonstring. From-SVN: r255447 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5bcc6a9580b..1615acf8a3f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ 2017-12-06 Martin Sebor + * doc/invoke.texi (-Wstringop-truncation): Mention attribute + nonstring. + PR tree-optimization/83075 * tree-ssa-strlen.c (handle_builtin_stxncpy): Avoid assuming strncat/strncpy don't change length of source string. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index b8c8083daa7..3487a62ab28 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -5256,6 +5256,14 @@ void copy (const char *s) @} @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{]} @opindex Wsuggest-attribute= @opindex Wno-suggest-attribute=