On Monday, 28 March 2016 at 16:21:15 UTC, Johan Engelen wrote:
I just submitted a PR [1] that catagorizes warnings, such that you can do something like this:
dmd -w -Wno-not-reachable
which would error on any warning except the "statement not reachable" warnings (it completely disables that warning).

The motivation for the selective disabling/enabling of warnings was a recent discussion in the Learn forum [2].

Please read about it in detail in the first message of the PR [1].

- Johan

[1]  https://github.com/D-Programming-Language/dmd/pull/5592
[2] http://forum.dlang.org/thread/baupegcfvumouhgau...@forum.dlang.org

I think categorizing warnings could be useful, but must point out that for the "statement not reachable" problem (DMD 14835), specifically, this is not really a good long term solution.

The reason is that Phobos itself contains many statements which are "not reachable" according to the compiler's current flawed definition. (They aren't detected as such only because the constant folding and value range propagation capabilities are rather weak currently.)

If Phobos requires a -Wno-not-reachable switch to compile, then anything that uses Phobos will likely require the switch, also. At that point, it makes more sense to just fix/remove the warning, rather than selectively disabling it for some projects.

Reply via email to