File 0421-megaco-example-meas-Add-dialyzer-make-targets.patch of Package erlang

From 69deb1ac4855c6f4a33ad25d0c7edc97a46cce3d Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Mon, 11 Jul 2022 17:26:47 +0200
Subject: [PATCH 1/7] [megaco|example|meas] Add dialyzer (make) targets

OTP-18179
---
 lib/megaco/examples/meas/Makefile.in | 47 +++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)

diff --git a/lib/megaco/examples/meas/Makefile.in b/lib/megaco/examples/meas/Makefile.in
index 1dc3361167..7115a791a2 100644
--- a/lib/megaco/examples/meas/Makefile.in
+++ b/lib/megaco/examples/meas/Makefile.in
@@ -86,6 +86,18 @@ ERL_COMPILE_FLAGS += \
 	-pa $(ERL_TOP)/lib/megaco/ebin \
 	-I../include
 
+DIA_PLT      = megaco_example_meas.plt
+DIA_ANALYSIS = $(basename $(DIA_PLT)).dialyzer_analysis
+ifeq ($(DIAW_EH),true)
+DIA_WARNINGS += -Werror_handling
+endif
+ifeq ($(DIAW_US),true)
+DIA_WARNINGS += -Wunderspecs
+endif
+ifeq ($(DIAW_UR),true)
+DIA_WARNINGS += -Wunmatched_returns
+endif
+
 
 # ----------------------------------------------------
 # Special Build Targets
@@ -104,7 +116,7 @@ script_skeletons: $(SCRIPT_SKELETONS)
 
 info:
 	@echo "MODULES   = $(MODULES)"
-	@echo "ERL_FILED = $(ERL_FILES)"
+	@echo "ERL_FILES = $(ERL_FILES)"
 	@echo ""
 	@echo "SCRIPT_SKELETON_SRC = $(SCRIPT_SKELETON_SRC)"
 	@echo "SCRIPT_SKELETONS    = $(SCRIPT_SKELETONS)"
@@ -140,6 +152,39 @@ release_spec: opt
 release_docs_spec:
 
 
+dclean:
+	rm -f $(DIA_PLT)
+	rm -f $(DIA_ANALYSIS)
+
+dialyzer_plt: $(DIA_PLT)
+
+$(DIA_PLT): $(ERL_FILES)
+	@echo "Building ($(basename $(DIA_PLT))) plt file"
+	@dialyzer --build_plt \
+                  --output_plt $@ \
+                  -r . \
+                     ../../ebin \
+                     ../../../../lib/asn1/ebin \
+                     ../../../../lib/et/ebin \
+                     ../../../../lib/kernel/ebin \
+                     ../../../../lib/stdlib/ebin \
+                     ../../../../lib/compiler/ebin \
+                     ../../../../lib/debugger/ebin \
+                     ../../../../lib/runtime_tools/ebin \
+                     ../../../../lib/crypto/ebin \
+                     ../../../../lib/mnesia/ebin \
+                     ../../../../lib/wx/ebin \
+                     ../../../../erts/preloaded/ebin \
+                  --output $(DIA_ANALYSIS) \
+                  --verbose
+
+dialyzer: $(DIA_PLT)
+	@echo "Running dialyzer on $(basename $(DIA_PLT))"
+	@dialyzer --plt $< \
+                  -r ../../ebin \
+                  $(DIA_WARNINGS) \
+                  --verbose
+
 # ----------------------------------------------------
 # Include dependencies
 # ----------------------------------------------------
-- 
2.35.3

openSUSE Build Service is sponsored by