diff options
author | Christopher Faulet <[email protected]> | 2009-12-10 22:21:18 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2010-01-19 16:23:28 +0100 |
commit | 5fdb43ee9adb9081998a2428ba2e5b001c067393 (patch) | |
tree | df6b18ad387be8e0743cfa9ce2b85bbf86b0671b /lib/compiler/src | |
parent | fb499f15b8b372c8eeb5cf0c4b4af0e109a51ceb (diff) | |
download | otp-5fdb43ee9adb9081998a2428ba2e5b001c067393.tar.gz otp-5fdb43ee9adb9081998a2428ba2e5b001c067393.tar.bz2 otp-5fdb43ee9adb9081998a2428ba2e5b001c067393.zip |
compile: add flag warnings_as_errors to treat warnings as errors
With this flag, warnings are treated as errors, like gcc flag '-Werror'.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/compile.erl | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl index a10c75c9da..8dd7cea38c 100644 --- a/lib/compiler/src/compile.erl +++ b/lib/compiler/src/compile.erl @@ -318,17 +318,30 @@ run_tc({Name,Fun}, St) -> Val. comp_ret_ok(#compile{code=Code,warnings=Warn0,module=Mod,options=Opts}=St) -> - Warn = messages_per_file(Warn0), - report_warnings(St#compile{warnings = Warn}), - Ret1 = case member(binary, Opts) andalso not member(no_code_generation, Opts) of - true -> [Code]; - false -> [] - end, - Ret2 = case member(return_warnings, Opts) of - true -> Ret1 ++ [Warn]; - false -> Ret1 - end, - list_to_tuple([ok,Mod|Ret2]). + case member(warnings_as_errors, Opts) andalso length(Warn0) > 0 of + true -> + case member(report_warnings, Opts) of + true -> + io:format("~p: warnings being treated as errors\n", + [?MODULE]); + false -> + ok + end, + comp_ret_err(St); + false -> + Warn = messages_per_file(Warn0), + report_warnings(St#compile{warnings = Warn}), + Ret1 = case member(binary, Opts) andalso + not member(no_code_generation, Opts) of + true -> [Code]; + false -> [] + end, + Ret2 = case member(return_warnings, Opts) of + true -> Ret1 ++ [Warn]; + false -> Ret1 + end, + list_to_tuple([ok,Mod|Ret2]) + end. comp_ret_err(#compile{warnings=Warn0,errors=Err0,options=Opts}=St) -> Warn = messages_per_file(Warn0), |