diff options
author | Fredrik Gustafsson <[email protected]> | 2012-08-14 15:30:03 +0200 |
---|---|---|
committer | Fredrik Gustafsson <[email protected]> | 2012-08-14 15:30:03 +0200 |
commit | 160bf5da0e03f39b468ebba5d39d1658c8a370e6 (patch) | |
tree | e0d7bcbde2f11b6b8def23ad8de6bc6abc3c2290 /lib/compiler/src/compile.erl | |
parent | ce6691c02f5bea8ecb0478edd68a555067de37d2 (diff) | |
parent | 9492bf7abbf5e43a9bdada5b0ace0432ce1f4223 (diff) | |
download | otp-160bf5da0e03f39b468ebba5d39d1658c8a370e6.tar.gz otp-160bf5da0e03f39b468ebba5d39d1658c8a370e6.tar.bz2 otp-160bf5da0e03f39b468ebba5d39d1658c8a370e6.zip |
Merge branch 'maint', remote-tracking branch 'upstream'
Diffstat (limited to 'lib/compiler/src/compile.erl')
-rw-r--r-- | lib/compiler/src/compile.erl | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl index 7365706b94..fbaacc08da 100644 --- a/lib/compiler/src/compile.erl +++ b/lib/compiler/src/compile.erl @@ -41,7 +41,7 @@ -type option() :: atom() | {atom(), term()} | {'d', atom(), term()}. --type err_info() :: {erl_scan:line(), module(), term()}. %% ErrorDescriptor +-type err_info() :: erl_scan:error_info(). %% ErrorDescriptor -type errors() :: [{file:filename(), [err_info()]}]. -type warnings() :: [{file:filename(), [err_info()]}]. -type mod_ret() :: {'ok', module()} @@ -363,7 +363,17 @@ messages_per_file(Ms) -> (_) -> false end, A) end, T, PrioMs), - Prio = lists:sort(fun({_,{L1,_,_}}, {_,{L2,_,_}}) -> L1 =< L2 end, + Prio = lists:sort(fun({_,{As1,_,_}}, {_,{As2,_,_}}) -> + {location, Loc1} = + erl_scan:attributes_info(As1, location), + {location, Loc2} = + erl_scan:attributes_info(As2, location), + case {Loc1, Loc2} of + {{L1, _}, L2} when is_integer(L2) -> L1 < L2; + {L1, {L2, _}} when is_integer(L1) -> L1 =< L2; + {_, _} -> Loc1 =< Loc2 + end + end, lists:append(Prio0)), flatmap(fun mpf/1, [Prio, Rest]). @@ -773,7 +783,8 @@ parse_module(St) -> Opts = St#compile.options, Cwd = ".", IncludePath = [Cwd, St#compile.dir|inc_paths(Opts)], - R = epp:parse_file(St#compile.ifile, IncludePath, pre_defs(Opts)), + AtPos = initial_position(Opts), + R = epp:parse_file(St#compile.ifile, AtPos, IncludePath, pre_defs(Opts)), case R of {ok,Forms} -> {ok,St#compile{code=Forms}}; @@ -1423,7 +1434,7 @@ report_warnings(#compile{options=Opts,warnings=Ws0}) -> end. format_message(F, P, [{{Line,Column}=Loc,Mod,E}|Es]) -> - M = {{F,Loc},io_lib:format("~s:~w:~w ~s~s\n", + M = {{F,Loc},io_lib:format("~s:~w:~w: ~s~s\n", [F,Line,Column,P,Mod:format_error(E)])}, [M|format_message(F, P, Es)]; format_message(F, P, [{Line,Mod,E}|Es]) -> @@ -1479,6 +1490,12 @@ objfile(Base, St) -> tmpfile(Ofile) -> reverse([$#|tl(reverse(Ofile))]). +initial_position(Opts) -> + case lists:member(column, Opts) of + true -> {1, 1}; + false -> 1 + end. + %% pre_defs(Options) %% inc_paths(Options) %% Extract the predefined macros and include paths from the option list. |