Supercollider: Eliminate all compiler warnings

Created on 8 Jun 2017  路  4Comments  路  Source: supercollider/supercollider

Problem

SuperCollider currently builds with a large number of compiler warnings. Some of these have been disabled, for better or worse, but many simple errors and slip-ups remain in the codebase and make building SC noisy.

Solution

  1. For each build warning, determine if or how it can be avoided. Then, change the code to do so.
  2. For each disabled compiler warning, re-evaluate whether it is necessary or just a quick hack that can be better addressed by fixing code.
  3. For compiler warnings that do need to be silenced, disable the warnings as locally as possible, and not in the global CMake settings.

From _C++ Coding Standards_ by Sutter & Alexandrescu, pp. 4-7:

Your compiler is your friend. If it issues a warning for a certain construct, often there's a potential problem in your code.

Successful builds should be silent (warning-free). If they aren't, you'll quickly get
into the habit of skimming the output, and you will miss real problems.

To get rid of a warning: a) understand it; and then b) rephrase your code to eliminate the warning and make it clearer to both humans and compilers that the code does what you intended.

Do this even when the program seemed to run correctly in the first place. Do this even when you are positive that the warning is benign. Even benign warnings can obscure later warnings pointing to real dangers.

...

Exceptions

Sometimes, a compiler may emit a tedious or even spurious warning (i.e., one that is
mere noise) but offer no way to turn it off, and it might be infeasible or unproductive
busywork to rephrase the code to silence the warning. In these rare cases, as a team
decision, avoid tediously working around a warning that is merely tedious: Disable
that specific warning only, disable it as locally as possible, and write a clear comment
documenting why it was necessary.

build good first issue organizational

Most helpful comment

Down to around 104 now. There are a bunch of deprecation warnings on macOS 10.12 that are fixed in Boost 1.64.0. We should update soon after 3.9 is released.

All 4 comments

That list turning off msvc Windows warnings seems to have no effect, I see exactly those warnings all the time. There must be some bug in the code switching them off ;)

There are a lot of these:

supercollider/external_libraries/nova-simd/vec/vec_sse2.hpp:53:40: warning: ignoring attributes on template argument '__m128d {aka __vector(2) double}' [-Wignored-attributes]
     typedef vec_base<double, __m128d, 2> base;
                                        ^

Some alignment attributes are being ignored. I wonder what are the consequences. related discussion here.

After the PRs referenced above, we are down to 126 warnings with AppleClang, down from 162! A couple of these are coming from external libraries and a bunch (I think 16-20) are coming from a few overloaded functions in IDE code. I haven't quite decided on the way to handle them yet.

Down to around 104 now. There are a bunch of deprecation warnings on macOS 10.12 that are fixed in Boost 1.64.0. We should update soon after 3.9 is released.

Was this page helpful?
0 / 5 - 0 ratings