[PATCH] allow user specified compiler options in cover.erl

Tobias Schlager tobias.schlager@REDACTED
Fri Sep 17 15:22:15 CEST 2010


Sorry for that, here's the patch from git format-patch

 From b09fe86d1e7eb1603b3c18e409361342a8d41548 Mon Sep 17 00:00:00 2001
From: Tobias Schlager <tobias.schlager@REDACTED>
Date: Fri, 17 Sep 2010 15:05:20 +0200
Subject: [PATCH] allow user specified compiler options in cover.erl

---
  lib/tools/src/cover.erl |    9 +++++----
  1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/tools/src/cover.erl b/lib/tools/src/cover.erl
index c4d1bd1..b8884fe 100644
--- a/lib/tools/src/cover.erl
+++ b/lib/tools/src/cover.erl
@@ -229,6 +229,7 @@ compile_modules(Files,Options) ->
  					{i, Dir} when is_list(Dir) -> true;
  					{d, _Macro} -> true;
  					{d, _Macro, _Value} -> true;
+					export_all -> true;
  					_ -> false
  				    end
  			    end,
@@ -569,7 +570,7 @@ main_process_loop(State) ->
  	    case get_beam_file(Module,BeamFile0,Compiled0) of
  		{ok,BeamFile} ->
  		    {Reply,Compiled} =
-			case do_compile_beam(Module,BeamFile) of
+			case do_compile_beam(Module,BeamFile,[]) of
  			    {ok, Module} ->
  				remote_load_compiled(State#main_state.nodes,
  						     [{Module,BeamFile}]),
@@ -1227,13 +1228,13 @@ do_compile(File, UserOptions) ->
      Options = [debug_info,binary,report_errors,report_warnings] ++ 
UserOptions,
      case compile:file(File, Options) of
  	{ok, Module, Binary} ->
-	    do_compile_beam(Module,Binary);
+	    do_compile_beam(Module,Binary,UserOptions);
  	error ->
  	    error
      end.

  %% Beam is a binary or a .beam file name
-do_compile_beam(Module,Beam) ->
+do_compile_beam(Module,Beam,UserOptions) ->
      %% Clear database
      do_clear(Module),

@@ -1253,7 +1254,7 @@ do_compile_beam(Module,Beam) ->
  	    %% Compile and load the result
  	    %% It's necessary to check the result of loading since it may
  	    %% fail, for example if Module resides in a sticky directory
-	    {ok, Module, Binary} = compile:forms(Forms, []),
+	    {ok, Module, Binary} = compile:forms(Forms, UserOptions),
  	    case code:load_binary(Module, ?TAG, Binary) of
  		{module, Module} ->
  		
-- 
1.7.0.4

Regards
Tobias Schlager

Am 17.09.2010 11:01, schrieb Björn Gustavsson:
> On Thu, Sep 16, 2010 at 9:56 AM, Tobias Schlager
> <tobias.schlager@REDACTED>  wrote:
>> I would like to propose a small patch of the cover.erl module.
>
> Please see
>
> http://github.com/erlang/otp/wiki/Submitting-patches
>
> and specially "Sending the patch".
>
> We do allow in-line patches, provided that they are generated
> by "git format-patch" (or are formatted in the same way) and
> that they are not white-space damaged by your email program
> (allowing us to use "git am" to apply and commit them).
>


More information about the erlang-patches mailing list