From f4bafbfdc7183b4297b96c884a61545000eb7fbd Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Mon, 24 Feb 2014 08:43:22 +0100 Subject: FIx handling of 'on_load' attribute [pull request from Kostis Sagonas] The handling of functions appearing in an 'on_load' attribute was wrong. Instead of considering the functions specified in these attributes as escaping from the module and performing a full analysis starting from them, the code just bypassed this analysis and only suppressed unused warning messages for these functions. This worked for most of the cases but resulted in functions (directly or indirectly) called by 'on_load' functions being reported as not called by the module. Such a case existed in the code of the 'crypto' application. To solve these issues the initialization code for functions escaping from the module was changed and the test for the on_load functionality was appropriately extended. --- lib/dialyzer/test/small_SUITE_data/src/on_load.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/dialyzer/test/small_SUITE_data') diff --git a/lib/dialyzer/test/small_SUITE_data/src/on_load.erl b/lib/dialyzer/test/small_SUITE_data/src/on_load.erl index 16533a9caa..7242ac2016 100644 --- a/lib/dialyzer/test/small_SUITE_data/src/on_load.erl +++ b/lib/dialyzer/test/small_SUITE_data/src/on_load.erl @@ -1,4 +1,6 @@ %%% This is to ensure that "on_load" functions are never reported as unused. +%%% In addition, all functions called by a function in an on_load attribute +%%% should be considered as called by an entry point of the module. -module(on_load). @@ -8,4 +10,7 @@ foo() -> ok. -bar() -> ok. +bar() -> gazonk(17). + +gazonk(N) when N < 42 -> gazonk(N+1); +gazonk(42) -> ok. -- cgit v1.2.3