From 19e8c9fe7daef8084182b7066269a613d1272000 Mon Sep 17 00:00:00 2001 From: Mikael Pettersson Date: Mon, 9 Sep 2019 17:52:55 +0200 Subject: [PATCH] erlang: add xref checks to compile step --- erlang/Makefile | 2 +- erlang/rebar.config | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/erlang/Makefile b/erlang/Makefile index 5354d9e..fc17b5d 100644 --- a/erlang/Makefile +++ b/erlang/Makefile @@ -26,7 +26,7 @@ PROGRAMS=8to9 ar as nm od readelf default: compile link compile: $(REBAR3) - $(REBAR3) compile + $(REBAR3) do compile, xref link: $(REBAR3) for PROG in $(PROGRAMS); do \ diff --git a/erlang/rebar.config b/erlang/rebar.config index b5bdd1a..781d417 100644 --- a/erlang/rebar.config +++ b/erlang/rebar.config @@ -29,6 +29,40 @@ {deps, []}. +{xref_checks, + [ undefined_function_calls + , undefined_functions + , locals_not_used + , exports_not_used + , deprecated_function_calls + , deprecated_functions + ]}. + +%% silence xref unsed export warnings +{xref_ignores, + [ %% escript entry points (rebar ought to know about these) + {'8to9', main, 1} + , {ar, main, 1} + , {as, main, 1} + , {nm, main, 1} + , {od, main, 1} + , {readelf, main, 1} + %% indirect calls to Module:format_error/1 + , {assemble, format_error, 1} + , {getopt, format_error, 1} + , {input, format_error, 1} + , {output, format_error, 1} + , {parse, format_error, 1} + , {pdp10_elf36, format_error, 1} + , {pdp10_stdio, format_error, 1} + , {scan, format_error, 1} + , {scan_state, format_error, 1} + , {strtol, format_error, 1} + %% actual unused exports + , {pdp10_opcodes, cpu_device_from_name, 2} + , {pdp10_opcodes, models_from_name, 1} + ]}. + {escript_emu_args, "%%! +sbtu +A1 +Bd -noshell -smp auto\n"}. {profiles,