Re: -Wall

Joel Sherrill <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAF9ehCVa4tt9vm58oDoK=nydiCouDWaMZ2vtXHHj5FOqRPpjBA@mail.gmail.com>
On Fri, Jan 19, 2024 at 9:39 AM Mike Frysinger <[email protected]> wrote:

> On 19 Jan 2024 13: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?
>
> enabling -Wall by default sounds fine.  if you wanted to include any
> -Werror,
> that would require more effort/tooling like putting it all behind a new
> flag
> like --enable-werror.
>

Based on the warnings from BSD code, I hope you think -Werror should be
off by default until the warnings are cleaned up.

For RTEMS, we try not to modify code imported from third parties. We have
a rule that you can only add code inside an ifdef __rtems__. For example,
if
we wanted to eliminate those unused variable warnings, we would likely do
something like this in third party code:

#ifndef __rtems__
  int unused_variable;
#endif

And, if being really diligent, post a patch or ticket to the upstream
project.
Our goal is to make it easier to update these files in the future.

FWIW we have over 1M lines of FreeBSD code in rtems-libbsd which is
a port of the FreeBSD networking, USB, nvme, etc. and the commands
to configure the stack (ifconfig, route, netstat, ping, etc) This has worked
pretty well for us.

--joel


> -mike
>
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.