This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: backporting fix for 85602 to GCC 8


Am 2018-07-18 um 01:50 schrieb Martin Sebor:
If there are no objections I'd like to backport the solution
for PR 85602 to avoid a class of unnecessary warnings for
safe uses of nonstring arrays.  With the release coming up
later this week I'll go ahead and commit the patch tomorrow.

https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=261718

Hi Martin,

and please remember the follow-up fix

https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=261751

The patch for PR 85602 makes the extended and enabled-by-Wall string warnings (which I like!) complete. There's a warning for the majority of cases and for the char-array-without-NUL cases there is the nonstring attribute describing it nicely, much better than to turn off the warning around such code. I know that probably not too many codebases will be affected, but for anyone affected the nonstring attribute is a much better way to avoid the warnings than to turn it off (and if they turn off the warnings for gcc-8 they often won't turn it on again for gcc-9+).
The nonstring attribute is also the documented way to silence the warnings.

BTW, while re-reading the documentation I noticed some minor omissions, I attached a patch (untested). Feel free to commit it (I have no access) if you think it's correct.

Franz.


2018-07-12  Franz Sirl  <franz.sirl-kernel@lauterbach.com>

	* invoke.texi (Wstringop-overflow, Wstringop-truncation):
	Mention enabling via -Wall.
	(Wall): Add -Wstringop-overflow02 and -Wstringop-truncation.


Attachment: stringop-doc.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]