diff options
author | Patrik Nyblom <[email protected]> | 2010-06-01 11:12:14 +0200 |
---|---|---|
committer | Patrik Nyblom <[email protected]> | 2010-06-02 16:47:29 +0200 |
commit | 334e4acd61605111712edefe874f98d030f0d25c (patch) | |
tree | 63260950d7af4a7b1194f548985d3cf8d9ac7303 /lib/stdlib | |
parent | dcd4d82b67c250987b17f61043d764d446ed00e3 (diff) | |
download | otp-334e4acd61605111712edefe874f98d030f0d25c.tar.gz otp-334e4acd61605111712edefe874f98d030f0d25c.tar.bz2 otp-334e4acd61605111712edefe874f98d030f0d25c.zip |
Change warning to error for nowarn_bif_clash compiler directive
Diffstat (limited to 'lib/stdlib')
-rw-r--r-- | lib/stdlib/src/erl_lint.erl | 25 | ||||
-rw-r--r-- | lib/stdlib/test/erl_lint_SUITE.erl | 26 |
2 files changed, 26 insertions, 25 deletions
diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl index 631ad0c1e3..29a949432b 100644 --- a/lib/stdlib/src/erl_lint.erl +++ b/lib/stdlib/src/erl_lint.erl @@ -163,8 +163,8 @@ format_error({bad_nowarn_unused_function,{F,A}}) -> io_lib:format("function ~w/~w undefined", [F,A]); format_error({bad_nowarn_bif_clash,{F,A}}) -> io_lib:format("function ~w/~w undefined", [F,A]); -format_error(deprecated_nowarn_bif_clash) -> - io_lib:format("compile directive nowarn_bif_clash is deprecated,~n" +format_error(disallowed_nowarn_bif_clash) -> + io_lib:format("compile directive nowarn_bif_clash is no longer allowed,~n" " - use explicit module names or -compile({no_auto_import, [F/A]})", []); format_error({bad_nowarn_deprecated_function,{M,F,A}}) -> io_lib:format("~w:~w/~w is not a deprecated function", [M,F,A]); @@ -553,7 +553,7 @@ forms(Forms0, St0) -> Forms = eval_file_attribute(Forms0, St0), Locals = local_functions(Forms), AutoImportSuppressed = auto_import_suppressed(St0#lint.compile), - StDeprecated = deprecated_compile_flags(Forms,St0), + StDeprecated = disallowed_compile_flags(Forms,St0), %% Line numbers are from now on pairs {File,Line}. St1 = includes_qlc_hrl(Forms, StDeprecated#lint{locals = Locals, no_auto = AutoImportSuppressed}), @@ -762,22 +762,23 @@ not_deprecated(Forms, St0) -> St1 = func_line_warning(bad_nowarn_deprecated_function, Bad, St0), St1#lint{not_deprecated = ordsets:from_list(Nowarn)}. -deprecated_compile_flags(Forms, St0) -> +%% The nowarn_bif_clash directive is not only deprecated, it's actually an error from R14A +disallowed_compile_flags(Forms, St0) -> %% There are (still) no line numbers in St0#lint.compile. - Warnings0 = [ {St0#lint.file,{L,erl_lint,deprecated_nowarn_bif_clash}} || + Errors0 = [ {St0#lint.file,{L,erl_lint,disallowed_nowarn_bif_clash}} || {attribute,[{line,{_,L}}],compile,nowarn_bif_clash} <- Forms ], - Warnings1 = [ {St0#lint.file,{L,erl_lint,deprecated_nowarn_bif_clash}} || + Errors1 = [ {St0#lint.file,{L,erl_lint,disallowed_nowarn_bif_clash}} || {attribute,[{line,{_,L}}],compile,{nowarn_bif_clash, {_,_}}} <- Forms ], Disabled = (not is_warn_enabled(bif_clash, St0)), - Warnings = if - Disabled andalso Warnings0 =:= [] -> - [{St0#lint.file,{erl_lint,deprecated_nowarn_bif_clash}} | St0#lint.warnings]; + Errors = if + Disabled andalso Errors0 =:= [] -> + [{St0#lint.file,{erl_lint,disallowed_nowarn_bif_clash}} | St0#lint.errors]; Disabled -> - Warnings0 ++ Warnings1 ++ St0#lint.warnings; + Errors0 ++ Errors1 ++ St0#lint.errors; true -> - Warnings1 ++ St0#lint.warnings + Errors1 ++ St0#lint.errors end, - St0#lint{warnings=Warnings}. + St0#lint{errors=Errors}. %% post_traversal_check(Forms, State0) -> State. %% Do some further checking after the forms have been traversed and diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl index 4a366f6a28..8fe7881081 100644 --- a/lib/stdlib/test/erl_lint_SUITE.erl +++ b/lib/stdlib/test/erl_lint_SUITE.erl @@ -1785,7 +1785,7 @@ otp_5362(Config) when is_list(Config) -> {16,erl_lint,{field_name_is_variable,ok,'Var'}}]}}, %% Nowarn_bif_clash has changed behaviour as local functions - %% nowdays supersede auto-imported BIFs, why nowarn_bif_clash in itself generates a warning + %% nowdays supersede auto-imported BIFs, why nowarn_bif_clash in itself generates an error %% (OTP-8579) /PaN {otp_5362_4, <<"-compile(nowarn_deprecated_function). @@ -1810,8 +1810,8 @@ otp_5362(Config) when is_list(Config) -> spawn(A). ">>, {[nowarn_unused_function]}, - {warnings, - [{2,erl_lint,deprecated_nowarn_bif_clash}]}}, + {errors, + [{2,erl_lint,disallowed_nowarn_bif_clash}],[]}}, %% The special nowarn_X are not affected by general warn_X. {otp_5362_6, @@ -1824,8 +1824,8 @@ otp_5362(Config) when is_list(Config) -> {[nowarn_unused_function, warn_deprecated_function, warn_bif_clash]}, - {warnings, - [{2,erl_lint,deprecated_nowarn_bif_clash}]}}, + {errors, + [{2,erl_lint,disallowed_nowarn_bif_clash}],[]}}, {otp_5362_7, <<"-export([spawn/1]). @@ -1840,10 +1840,10 @@ otp_5362(Config) when is_list(Config) -> spawn(A). ">>, {[nowarn_unused_function]}, - {error,[{4,erl_lint,{bad_nowarn_bif_clash,{spawn,2}}}], - [{3,erl_lint,deprecated_nowarn_bif_clash}, - {4,erl_lint,deprecated_nowarn_bif_clash}, - {5,erl_lint,{bad_nowarn_deprecated_function,{3,hash,-1}}}, + {error,[{3,erl_lint,disallowed_nowarn_bif_clash}, + {4,erl_lint,disallowed_nowarn_bif_clash}, + {4,erl_lint,{bad_nowarn_bif_clash,{spawn,2}}}], + [{5,erl_lint,{bad_nowarn_deprecated_function,{3,hash,-1}}}, {5,erl_lint,{bad_nowarn_deprecated_function,{erlang,hash,-1}}}, {5,erl_lint,{bad_nowarn_deprecated_function,{{a,b,c},hash,-1}}}]} }, @@ -1882,8 +1882,8 @@ otp_5362(Config) when is_list(Config) -> {[nowarn_unused_function, warn_deprecated_function, warn_bif_clash]}, - {warnings, - [{2,erl_lint,deprecated_nowarn_bif_clash}]}} + {errors, + [{2,erl_lint,disallowed_nowarn_bif_clash}],[]}} ], @@ -2409,7 +2409,7 @@ bif_clash(Config) when is_list(Config) -> [], {errors,[{2,erl_lint,{call_to_redefined_old_bif,{size,1}}}],[]}}, - %% Verify that (some) warnings can be turned off. + %% Verify that warnings can not be turned off in the old way. {clash2, <<"-export([t/1,size/1]). t(X) -> @@ -2425,7 +2425,7 @@ bif_clash(Config) when is_list(Config) -> abs(X) -> erlang:abs(X). ">>, {[nowarn_unused_function,nowarn_bif_clash]}, - {warnings,[{erl_lint,deprecated_nowarn_bif_clash}]}}, + {errors,[{erl_lint,disallowed_nowarn_bif_clash}],[]}}, %% As long as noone calls an overridden BIF, it's totally OK {clash3, <<"-export([size/1]). |