From 54e3c7c58e020d70c5290f2892461b995798423d Mon Sep 17 00:00:00 2001 From: Steve Vinoski Date: Fri, 26 Apr 2024 10:39:33 -0400 Subject: [PATCH] Dialyzer fixes Add a new yaws_dynopts.erl warning to known_dialyzer_warnings. This change allows dialyzer checking to pass on OTP 25. If dialyzer emits warnings, it exits with status 2, which causes make to fail. Since warnings can often be inconsequential, modify the make yaws.plt rule to change exit status 2 to 0 so that make passes even if warnings occur. --- Makefile.am | 6 +++++- known_dialyzer_warnings | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 46b97aee..c890ac5b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -96,6 +96,9 @@ list-checks: cleantest: $(AM_V_at)( cd test && $(MAKE) clean ) +# If dialyzer exits with status 2, it means it emitted warnings. In +# that case, exit with status 0 instead of failing the build, since +# warnings are typically inconsequential. yaws.plt: $(AM_V_GEN)$(DIALYZER) --build_plt -r ebin --output_plt yaws.plt\ -r $(ERLANG_LIB_DIR_kernel) \ @@ -109,7 +112,8 @@ yaws.plt: -r $$(echo $(ERLANG_LIB_DIR_mnesia) | sed "s/not found//") \ -r $$(echo $(ERLANG_LIB_DIR_inets) | sed "s/not found//") \ -r $$(echo $(ERLANG_LIB_DIR_xmlrpc) | sed "s/not found//") \ - -r $$(echo $(ERLANG_LIB_DIR_erlsom) | sed "s/not found//") + -r $$(echo $(ERLANG_LIB_DIR_erlsom) | sed "s/not found//") ; \ + [ $$? -eq 2 ] && exit 0 || exit $$? dialyzer: all yaws.plt $(AM_V_at)$(DIALYZER) -q --plt yaws.plt -r ebin | \ diff --git a/known_dialyzer_warnings b/known_dialyzer_warnings index a938355a..5804a66d 100644 --- a/known_dialyzer_warnings +++ b/known_dialyzer_warnings @@ -11,4 +11,5 @@ yaws_ctl.erl:\d+(:\d+)?: Function trace/1 has no local return yaws_ctl.erl:\d+(:\d+)?: Function debug_dump/1 has no local return yaws_ctl.erl:\d+(:\d+)?: Function stats/1 has no local return yaws_ctl.erl:\d+(:\d+)?: Function running_config/1 has no local return +yaws_dynopts.erl:\d+(:\d+)?: The pattern 'true' can never match the type 'false' yaws_revproxy.erl:\d+(:\d+)?: The pattern 'true' can never match the type 'false'