diff options
author | Henrik Nord <[email protected]> | 2011-09-13 12:02:19 +0200 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2011-09-13 12:02:23 +0200 |
commit | e9e118a25ee822e4568d785844d249e083cd88cf (patch) | |
tree | 636bddf9f6d41aefdf36cd6821560df4a66d249b /lib/asn1/src/asn1ct.erl | |
parent | a40655461a03f6b075a1140810f020f5b2bf35b1 (diff) | |
parent | bbdc6a3c0fac080af7b60e6cf7d9732532027939 (diff) | |
download | otp-e9e118a25ee822e4568d785844d249e083cd88cf.tar.gz otp-e9e118a25ee822e4568d785844d249e083cd88cf.tar.bz2 otp-e9e118a25ee822e4568d785844d249e083cd88cf.zip |
Merge branch 'ta/werror' into dev
* ta/werror:
snmp: extend warnings_as_errors test
systools: add warnings_as_errors option
asn1ct: add warnings_as_errors option
leex: optimize werror/1
yecc: optimize werror/1
yecc: use more descriptive name: 'werror'
leex: use more descriptive name: 'werror'
compile: optimize werror/1
compile: log warnings as errors if -Werror is enabled
yecc: log warnings as errors if -Werror is enabled
leex: log warnings as errors if -Werror is enabled
yecc: honour -Werror passed from erlc
leex: honour -Werror passed from erlc
Do not write beam file if Werr and warnings /= []
parsetools: test if warnings_as_errors writes file
OTP-9536
Diffstat (limited to 'lib/asn1/src/asn1ct.erl')
-rw-r--r-- | lib/asn1/src/asn1ct.erl | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/lib/asn1/src/asn1ct.erl b/lib/asn1/src/asn1ct.erl index a167d27f82..e26fadd160 100644 --- a/lib/asn1/src/asn1ct.erl +++ b/lib/asn1/src/asn1ct.erl @@ -39,7 +39,7 @@ add_tobe_refed_func/1,add_generated_refed_func/1, maybe_rename_function/3,latest_sindex/0,current_sindex/0, set_current_sindex/1,next_sindex/0,maybe_saved_sindex/2, - parse_and_save/2,verbose/3,warning/3,error/3]). + parse_and_save/2,verbose/3,warning/3,warning/4,error/3]). -include("asn1_records.hrl"). -include_lib("stdlib/include/erl_compile.hrl"). @@ -825,10 +825,13 @@ generate({true,{M,_Module,GenTOrV}},OutFile,EncodingRule,Options) -> case catch specialized_decode_prepare(EncodingRule,M,GenTOrV,Options) of {error, enoent} -> ok; {error, Reason} -> warning("Error in configuration " - "file: ~n~p~n",[Reason],Options); + "file: ~n~p~n",[Reason],Options, + "Error in configuration file"); {'EXIT',Reason} -> warning("Internal error when " "analyzing configuration " - "file: ~n~p~n",[Reason],Options); + "file: ~n~p~n",[Reason],Options, + "Internal error when " + "analyzing configuration"); _ -> ok end, @@ -2524,14 +2527,14 @@ type_check(#'Externaltypereference'{}) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Report functions. %% -%% Errors messages are controlled with the 'errors' compiler option +%% Error messages are controlled with the 'errors' compiler option %% Warning messages are controlled with the 'warnings' compiler option %% Verbose messages are controlled with the 'verbose' compiler option error(Format, Args, S) -> case is_error(S) of true -> - io:format("Error: " ++ Format, Args); + io:format(Format, Args); false -> ok end. @@ -2544,6 +2547,17 @@ warning(Format, Args, S) -> ok end. +warning(Format, Args, S, Reason) -> + case {is_werr(S), is_error(S), is_warning(S)} of + {true, true, _} -> + io:format(Format, Args), + throw({error, Reason}); + {false, _, true} -> + io:format(Format, Args); + _ -> + ok + end. + verbose(Format, Args, S) -> case is_verbose(S) of true -> @@ -2566,3 +2580,8 @@ is_verbose(S) when is_record(S, state) -> is_verbose(S#state.options); is_verbose(O) -> lists:member(verbose, O). + +is_werr(S) when is_record(S, state) -> + is_werr(S#state.options); +is_werr(O) -> + lists:member(warnings_as_errors, O). |