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

Sam Tavakoli sam@REDACTED
Thu Oct 9 21:28:20 CEST 2014


On 2014-10-09 10:23, Tuncer Ayaz wrote:
> 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
> sources.
>
>> 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)
> https://github.com/seancribbs/neotoma/issues/14
>
> (status unknown)
> https://github.com/nygge/abnfc/issues/3
>
> (maybe supported?)
> https://github.com/basho/erlang_protobuffs/issues/16

Thanks for the answers and update on what more warnings_as_errors do.

I didn't dig enough in the commit history of rebar to find the
fail_on_warning, I ruled it out to quick :)
It will definitely be changed be changed since the rebar version used
isn't old enough to have the deprecated flag.

This is the mentioned commit which removes it:
https://github.com/rebar/rebar/commit/3a8b4d5e8fdd1155e15844e8a46dc2e6ccff9e38
if there is others who might want to take a peak.

/Sam




More information about the erlang-questions mailing list