Thousands of warnings...

Polytropon freebsd at
Fri Jun 13 16:11:25 UTC 2014

On Fri, 13 Jun 2014 08:36:49 -0400, Rick Miller wrote:
> Hi all,
> During execution of to build FreeBSD releng/10.0 I see several
> thousand warnings and conflicts.  I am unsure whether or not these are
> warnings and conflicts that I need to address somehow.  I'd be most
> appreciative of those that take a look at the logs and help me decipher
> them.

I had a short look at some of the warnings and would like
to make the following claim: The compiler in use is in
"maximum warnings mode", so it issues valid warnings about
everything that might be a result of sloppy programming.
Many warnings originate from GNU contributions, but also
things ported from Solaris contain warnings.

For example, the compiler questions if the precedence of
|| and && has been properly understood by the programmer,
and suggests that he should use () to explicitely indicate
what he wants; simplified:

	if (a && b || c && d) ...

Is this

	if ((a && b) || (c && d)) ...

as we would "intuitively" read it, or

	if (a && (b || c) && d) ...

The evaluation (according to the C specification) for &&
and || is left to right, with && binding stronger than ||,
so it's _clear_ that the first interpretation is correct.
Still the compiler suggests using means to make this "more
explicit". (Maybe there's even a C compiler that does not
work as intended and interprets it in the 2nd way?)

Similar warnings are printed for formatting strings that
might not match the variable types associated with them,
as well as "string + char" operations. In the same manner,
the compiler wants to help by addresssing if-then-else
topics, like

	if (x)
	else for (y, ...)

Also type casting "irregularities" are being warned about. There
are many other kinds of "possibly unintended" program code that
the compiler considers worth a warning.

I think it's common to ignore compiler warnings. If you compile
ports, you will see a lot of them, especially when you compile
ported software. You will furthermore see warnings when you run
that software. Take a look at most X-related software and see
how your ~/.xsession-errors fills with warnings and errors
nobody seems to care about.

There are other programmers who intendedly use -Wall or check
for individual warning types to clean their code prior to any
contribution or publication. They make sure no warnings are
issued. I have no idea where those have gone. :-)

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list