diff options
author | Björn Gustavsson <[email protected]> | 2011-11-28 15:05:23 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2011-11-28 15:05:23 +0100 |
commit | aa6824a16ba83c35ad35f9dde40c5a198c7002a2 (patch) | |
tree | cbd05ba751d4ea69f3b5caec2fdae0c9ba68265e /lib/stdlib/src | |
parent | 5c3dbd080f27f683f2d30c9c7072547c68d715b3 (diff) | |
parent | 9ac7e19e35b02c02e15abd3abc4e7b5c8b62752d (diff) | |
download | otp-aa6824a16ba83c35ad35f9dde40c5a198c7002a2.tar.gz otp-aa6824a16ba83c35ad35f9dde40c5a198c7002a2.tar.bz2 otp-aa6824a16ba83c35ad35f9dde40c5a198c7002a2.zip |
Merge branch 'bjorn/compiler/options/OTP-9752'
* bjorn/compiler/options/OTP-9752:
filename documentation: Recommend against using filename:find_src/1,2
Teach filename:find_src/1,2 to handle slim or stripped BEAM files
filename: Eliminate failing call to Mod:module_info(source_file)
filename.erl:filter_options/1: Remove handling of dead options
compiler: Don't include {cwd,_} in module_info(compile)
compiler: Don't include source code options in module_info(compile)
hipe: Teach hipe to handle slim or stripped BEAM files
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/filename.erl | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/lib/stdlib/src/filename.erl b/lib/stdlib/src/filename.erl index 2fc9128e4e..dbfcbea4f7 100644 --- a/lib/stdlib/src/filename.erl +++ b/lib/stdlib/src/filename.erl @@ -836,16 +836,18 @@ try_file(undefined, ObjFilename, Mod, Rules) -> Error -> Error end; try_file(Src, _ObjFilename, Mod, _Rules) -> - List = Mod:module_info(compile), - {options, Options} = lists:keyfind(options, 1, List), + List = case Mod:module_info(compile) of + none -> []; + List0 -> List0 + end, + Options = proplists:get_value(options, List, []), {ok, Cwd} = file:get_cwd(), AbsPath = make_abs_path(Cwd, Src), {AbsPath, filter_options(dirname(AbsPath), Options, [])}. %% Filters the options. %% -%% 1) Remove options that have no effect on the generated code, -%% such as report and verbose. +%% 1) Only keep options that have any effect on code generation. %% %% 2) The paths found in {i, Path} and {outdir, Path} are converted %% to absolute paths. When doing this, it is assumed that relatives @@ -857,14 +859,10 @@ filter_options(Base, [{outdir, Path}|Rest], Result) -> filter_options(Base, Rest, [{outdir, make_abs_path(Base, Path)}|Result]); filter_options(Base, [{i, Path}|Rest], Result) -> filter_options(Base, Rest, [{i, make_abs_path(Base, Path)}|Result]); -filter_options(Base, [Option|Rest], Result) when Option =:= trace -> - filter_options(Base, Rest, [Option|Result]); filter_options(Base, [Option|Rest], Result) when Option =:= export_all -> filter_options(Base, Rest, [Option|Result]); filter_options(Base, [Option|Rest], Result) when Option =:= binary -> filter_options(Base, Rest, [Option|Result]); -filter_options(Base, [Option|Rest], Result) when Option =:= fast -> - filter_options(Base, Rest, [Option|Result]); filter_options(Base, [Tuple|Rest], Result) when element(1, Tuple) =:= d -> filter_options(Base, Rest, [Tuple|Result]); filter_options(Base, [Tuple|Rest], Result) @@ -878,12 +876,7 @@ filter_options(_Base, [], Result) -> %% Gets the source file given path of object code and module name. get_source_file(Obj, Mod, Rules) -> - case catch Mod:module_info(source_file) of - {'EXIT', _Reason} -> - source_by_rules(dirname(Obj), packages:last(Mod), Rules); - File -> - {ok, File} - end. + source_by_rules(dirname(Obj), packages:last(Mod), Rules). source_by_rules(Dir, Base, [{From, To}|Rest]) -> case try_rule(Dir, Base, From, To) of |