[erlang-questions] fail_on_warnings, has it ever worked?

Tuncer Ayaz tuncer.ayaz@REDACTED
Thu Oct 9 11:23:18 CEST 2014

On Thu, Oct 9, 2014 at 1:16 AM, Sam Tavakoli wrote:
> Hi
> Today I saw a project where the erl_opts in rebar.config had
> fail_on_warning instead of warnings_as_errors. Since I've never seen
> fail_on_warning before I googled it and among other results I found
> http://stackoverflow.com/questions/9343630. Where someone comments
> that fail_on_warning is deprecated in R16. I checked the R15B03-1
> code and couldn't find anything related to fail_on_warning. I also
> tried it out in the shell but it didn't fail a compilation with
> warnings.
> The second interesting link I found is
> http://erlang.org/pipermail/erlang-questions/2011-March/057130.html
> where fail_on_warning is shown again in a different example and R14B
> is mentioned. I tried it out on R14B but it doesn't work either.
> So my question is, has fail_on_warning ever worked?

As Steve said, fail_on_warning was a rebar specific option which was
replaced with the standard warnings_as_errors. That means, if you use
an old enough rebar version, it'll work as expected for Erlang

> If so, which release introduced it and when was it removed?

fail_on_warning was added in 2009 and replaced with
warnings_as_errors in 2011.

Christopher Faulet added the -Werror (warnings_as_errors) option to
erlc for .erl (compile:file/2) in R13B04 (2009).

While replacing rebar's fail_on_warning with warnings_as_errors, I've
refined compile:file/2's warnings_as_errors implementation to work the
same as gcc/clang and also implemented the option in asn1ct, snmpc,
yecc, leex, and systools. This was included in R14B04 (2011).

So, while you could use an old rebar version for fail_on_warning, I'd
suggest to use warnings_as_errors, as it works more like what you're
used to from $CC and is supported for more than .erl files.

Two OTP compilers still don't support -Werror:

* Diameter was new and I was advised against adding support. Also,
  diameter isn't wired into stdlib/src/erl_compile.erl anyway.

* I never got around to adding support to ic:compile (.idl files), and
  I suppose it's used seldom enough that nobody missed it yet.

There are also three non-OTP compilers which could/should support
warnings_as_errors, as rebar bundles compiler plugins for them:

(status unknown)

(status unknown)

(maybe supported?)

More information about the erlang-questions mailing list