From 0994710c308990a04ca1245c894e4e373e55bcec Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 22 Aug 2012 18:09:17 +0200 Subject: Revert "Merge branch 'nox/compile-column-numbers' into maint" Column numbers was merged without understanding all the whole story. See mail on erlang-patches for details. This reverts commit df8e67e203b83f95d1e098fec88ad5d0ad840069, reversing changes made to 0c9d90f314f364e5b1301ec89d762baabc57c7aa. --- lib/compiler/doc/src/compile.xml | 5 ----- lib/compiler/src/compile.erl | 25 ++++--------------------- lib/compiler/test/error_SUITE.erl | 15 ++------------- 3 files changed, 6 insertions(+), 39 deletions(-) (limited to 'lib/compiler') diff --git a/lib/compiler/doc/src/compile.xml b/lib/compiler/doc/src/compile.xml index b87e32a3d9..be9eb1cd75 100644 --- a/lib/compiler/doc/src/compile.xml +++ b/lib/compiler/doc/src/compile.xml @@ -108,11 +108,6 @@ See the Efficiency Guide for further information.

- column - -

The compiler will keep the column numbers while parsing.

-
- compressed

The compiler will compress the generated object code, diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl index fbaacc08da..7365706b94 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:error_info(). %% ErrorDescriptor +-type err_info() :: {erl_scan:line(), module(), term()}. %% ErrorDescriptor -type errors() :: [{file:filename(), [err_info()]}]. -type warnings() :: [{file:filename(), [err_info()]}]. -type mod_ret() :: {'ok', module()} @@ -363,17 +363,7 @@ messages_per_file(Ms) -> (_) -> false end, A) end, T, PrioMs), - 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, + Prio = lists:sort(fun({_,{L1,_,_}}, {_,{L2,_,_}}) -> L1 =< L2 end, lists:append(Prio0)), flatmap(fun mpf/1, [Prio, Rest]). @@ -783,8 +773,7 @@ parse_module(St) -> Opts = St#compile.options, Cwd = ".", IncludePath = [Cwd, St#compile.dir|inc_paths(Opts)], - AtPos = initial_position(Opts), - R = epp:parse_file(St#compile.ifile, AtPos, IncludePath, pre_defs(Opts)), + R = epp:parse_file(St#compile.ifile, IncludePath, pre_defs(Opts)), case R of {ok,Forms} -> {ok,St#compile{code=Forms}}; @@ -1434,7 +1423,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]) -> @@ -1490,12 +1479,6 @@ 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. diff --git a/lib/compiler/test/error_SUITE.erl b/lib/compiler/test/error_SUITE.erl index 47698ecdb7..eb5e50818e 100644 --- a/lib/compiler/test/error_SUITE.erl +++ b/lib/compiler/test/error_SUITE.erl @@ -22,15 +22,13 @@ -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, - head_mismatch_line/1,warnings_as_errors/1, bif_clashes/1, - column_number/1 - ]). + head_mismatch_line/1,warnings_as_errors/1, bif_clashes/1]). suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> test_lib:recompile(?MODULE), - [head_mismatch_line, warnings_as_errors, bif_clashes, column_number]. + [head_mismatch_line, warnings_as_errors, bif_clashes]. groups() -> []. @@ -168,15 +166,6 @@ bif_clashes(Config) when is_list(Config) -> -%% Tests that messages are correctly reported with column numbers -%% if the column option is set. -column_number(Config) when is_list(Config) -> - Ts1 = [{column_number_warning, - <<"\nt(X) -> ok.">>, - [return_warnings, export_all, column], - {warning, [{{2, 3}, erl_lint, {unused_var, 'X'}}]}}], - ?line [] = run(Config, Ts1), - ok. %% Tests that a head mismatch is reported on the correct line (OTP-2125). head_mismatch_line(Config) when is_list(Config) -> -- cgit v1.2.3