Ping: https://gcc.gnu.org/ml/gcc-patches/2018-05/msg01671.html
(In IRC last week Franz reported successfully testing the patch.
Thanks again.)
On 05/29/2018 01:21 PM, Martin Sebor wrote:
To make review and testing easier (thank you, Franz), attached
is an updated patch rebased on top of today's trunk.
(Note that the patch intentionally doesn't suppress the warning
for the submitted test case without adding the nonstring attribute.)
On 05/25/2018 02:59 PM, Martin Sebor wrote:
Ping:
https://gcc.gnu.org/ml/gcc-patches/2018-05/msg00869.html
On 05/17/2018 08:01 PM, Martin Sebor wrote:
The -Wstringop-truncation and -Wsizeof-pointer-memaccess warnings
I added and enhanced, respectively, in GCC 8 are arguably overly
strict for source arguments declared with the nonstring attribute.
For example, -Wsizeof-pointer-memaccess triggers for the strncat
call below:
__attribute__ ((nonstring)) char nonstr[8];
extern char *d;
strncat (d, nonstr, sizeof nonstr);
even though it's still a fairly common (if unsafe) idiom from
the early UNIX days (V7 from 1979 to be exact) where strncat
was introduced. (This use case, modulo the attribute, was
reduced from coreutils.)
Simialrly, -Wstringop-truncation warns for some strcat calls that
are actually safe, such as in:
strcpy (nonstr, "123");
strncat (d, nonstr, 32);
To help with the adoption of the warnings and the attribute and
avoid unnecessary churn the attached patch relaxes both warnings
to accept code like this without diagnostics.
The patch doesn't add any new warnings so I'd like it considered
for GCC 8 in addition to trunk.
Thanks
Martin