diff options
author | Hans Bolinder <[email protected]> | 2016-10-20 14:19:18 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2016-10-21 09:08:41 +0200 |
commit | 56b3298377c7422345076f342c0d99901aee34fc (patch) | |
tree | 59a350ed57e90914ae88c14fe85f80475bac8403 /lib/dialyzer/src/dialyzer_utils.erl | |
parent | 9a7f521f9d6eba398af2e703863f9975911085a4 (diff) | |
download | otp-56b3298377c7422345076f342c0d99901aee34fc.tar.gz otp-56b3298377c7422345076f342c0d99901aee34fc.tar.bz2 otp-56b3298377c7422345076f342c0d99901aee34fc.zip |
dialyzer: Fix error handling of bad -dialyzer() attributes
If a dialyzer module attribute references an undefined (local)
function an error tuple is thrown but no caught. This leads to a
'nocatch' error and not the intended "clean" error.
Diffstat (limited to 'lib/dialyzer/src/dialyzer_utils.erl')
-rw-r--r-- | lib/dialyzer/src/dialyzer_utils.erl | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/dialyzer/src/dialyzer_utils.erl b/lib/dialyzer/src/dialyzer_utils.erl index 76a5cf3d0b..1f2d3e3aaa 100644 --- a/lib/dialyzer/src/dialyzer_utils.erl +++ b/lib/dialyzer/src/dialyzer_utils.erl @@ -514,16 +514,21 @@ get_spec_info([], SpecDict, CallbackDict, {ok, SpecDict, CallbackDict}. -spec get_fun_meta_info(module(), abstract_code(), [dial_warn_tag()]) -> - dialyzer_codeserver:fun_meta_info(). + dialyzer_codeserver:fun_meta_info() | {'error', string()}. get_fun_meta_info(M, Abs, LegalWarnings) -> - NoWarn = get_nowarn_unused_function(M, Abs), - FuncSupp = get_func_suppressions(M, Abs), - Warnings0 = get_options(Abs, LegalWarnings), - Warnings = ordsets:to_list(Warnings0), - ModuleWarnings = [{M, W} || W <- Warnings], - RawProps = lists:append([NoWarn, FuncSupp, ModuleWarnings]), - process_options(dialyzer_utils:family(RawProps), Warnings0). + try + {get_nowarn_unused_function(M, Abs), get_func_suppressions(M, Abs)} + of + {NoWarn, FuncSupp} -> + Warnings0 = get_options(Abs, LegalWarnings), + Warnings = ordsets:to_list(Warnings0), + ModuleWarnings = [{M, W} || W <- Warnings], + RawProps = lists:append([NoWarn, FuncSupp, ModuleWarnings]), + process_options(dialyzer_utils:family(RawProps), Warnings0) + catch throw:{error, _} = Error -> + Error + end. process_options([{M, _}=Mod|Left], Warnings) when is_atom(M) -> [Mod|process_options(Left, Warnings)]; |