Re: -Wall

[email protected]
Newsgroups gmane.comp.lib.newlib
Organization Systematic Software
Message-ID <[email protected]>
On 2024-01-20 11:17, [email protected] wrote:
> On 2024-01-19 05:55, Corinna Vinschen wrote:
>> if you saw my today's pushes, you're aware that I only found a bug
>> because I used -Wall.  I fixed the bug and a few less crucial warnings.
>> I did NOT fix the warnings in code we took verbatim from some BSDs,
>> which often contain unused variables, or in some cases expressions which
>> are deemed to profit from extra paranthesis, e. g.
>>    if (a >= 0 ^ b == 0)
>> For that reason, I'd like to suggest to add -Wall by default to the
>> build flags for newlib, just as it is already for ages in the Cygwin
>> tree.
>> Anybody having a strong opinion, pro or contra?

> ++
> I also like:
>      -Wextra -Wformat=2 -Wformat-overflow=2 -Werror=format-security
> to get more useful warnings, and error if there are security issues like totally 
> variable format strings; use `info gcc W...` for descriptions; YL/100kmMV
> I have also found the following work well for development with recent gcc:
>      -fanalyzer -fsanitize-recover=all
>      -fstack-check -fstack-protector-all
>      --param=ssp-buffer-size=4
> but may be inappropriate for production builds; use `info gcc f...` for 
> descriptions.

Linux added -Wstringop-overflow to diagnose provable buffer overflows, except 
with GCC == 11 which mishandles the test:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=610347effc2ecb5ededf5037e82240b151f883ab

For extra Linux warning flags W=1/2/3 available see:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/Makefile.extrawarn

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.