anchor.diff:  %% # xref/1
   %%
   %% Ensure that no function in our application calls an undefined function
  -%% or one in an application we haven't specified as a dependency. (Almost.)
  +%% or one in an application we haven't declared as a dependency. (Almost.)
   %% ===========================================================================
   
   xref(Config) ->
       App = fetch(app, Config),
  -    Mods = fetch(modules, App),
  +    Mods = fetch(modules, App),  %% modules listed in the app file
  +
  +    %% List of application names extracted from runtime_dependencies.
  +    Deps = lists:map(fun unversion/1, fetch(runtime_dependencies, App)),
   
       {ok, XRef} = xref:start(make_name(xref_test_name)),
       ok = xref:set_default(XRef, [{verbose, false}, {warnings, false}]),
  
positive.code:     %% TLS security: it's up to a client who wants TLS it to start
      %% ssl.
  
      [] = lists:filter(fun is_bad_dependency/1, Called).
  
  %% It's not strictly necessary that diameter compiler modules not
  %% depend on other diameter modules but it's a simple source of build
  %% errors if not encoded in the makefile (hence the test) so guard
  %% against it.
  is_bad_dependency(Mod) ->
      lists:prefix("diameter", atom_to_list(Mod))
          andalso not lists:member(Mod, ?COMPILER_MODULES).
  
  add_application(XRef, App) ->
      add_application(XRef, App, code:lib_dir(App)).
  
negative.code:                        [?APP, erts | fetch(applications, App)]),
  
      {ok, Undefs} = xref:analyze(XRef, undefined_function_calls),
      {ok, CTdeps} = xref:analyze(XRef, {module_call, ?COMPILER_MODULES}),
      {ok, RTdeps} = xref:analyze(XRef, {module_call, Mods}),
  
      xref:stop(XRef),
  
  