From c347415765f4e30e38e49f5bd369f48523ef935e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 23 Feb 2011 13:18:28 +0100 Subject: compiler: Eliminate some warnings --- lib/compiler/test/bs_construct_SUITE.erl | 4 ++-- lib/compiler/test/compilation_SUITE.erl | 10 +++++----- lib/compiler/test/guard_SUITE.erl | 6 +++--- lib/compiler/test/inline_SUITE.erl | 4 ++-- lib/compiler/test/lc_SUITE.erl | 4 ++-- lib/compiler/test/test_lib.erl | 18 +++++++++--------- 6 files changed, 23 insertions(+), 23 deletions(-) (limited to 'lib') diff --git a/lib/compiler/test/bs_construct_SUITE.erl b/lib/compiler/test/bs_construct_SUITE.erl index fe72fbb143..c430b12b70 100644 --- a/lib/compiler/test/bs_construct_SUITE.erl +++ b/lib/compiler/test/bs_construct_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% Copyright Ericsson AB 2004-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -231,7 +231,7 @@ one_test({C_bin, E_bin, Str, Result}) -> ok; %% For situations where the final bits may not matter, like %% for floats: - N when integer(N) -> + N when is_integer(N) -> io:format("Info: compiled and interpreted differ in the" " last bytes:~n ~p, ~p.~n", [bitstring_to_list(C_bin), bitstring_to_list(E_bin)]), diff --git a/lib/compiler/test/compilation_SUITE.erl b/lib/compiler/test/compilation_SUITE.erl index 6cd133ee39..ba225b66d0 100644 --- a/lib/compiler/test/compilation_SUITE.erl +++ b/lib/compiler/test/compilation_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2010. All Rights Reserved. +%% Copyright Ericsson AB 1997-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -163,7 +163,7 @@ split({int, N}, <>) -> beam_compiler_7(doc) -> "Code snippet submitted from Ulf Wiger which fails in R3 Beam."; beam_compiler_7(suite) -> []; -beam_compiler_7(Config) when list(Config) -> +beam_compiler_7(Config) when is_list(Config) -> ?line done = empty(2, false). empty(N, Toggle) when N > 0 -> @@ -327,7 +327,7 @@ from(_, []) -> []. vsn_1(doc) -> "Test generation of 'vsn' attribute"; vsn_1(suite) -> []; -vsn_1(Conf) when list(Conf) -> +vsn_1(Conf) when is_list(Conf) -> ?line M = vsn_1, ?line compile_load(M, ?config(data_dir, Conf), Conf), @@ -351,7 +351,7 @@ vsn_1(Conf) when list(Conf) -> vsn_2(doc) -> "Test overriding of generation of 'vsn' attribute"; vsn_2(suite) -> []; -vsn_2(Conf) when list(Conf) -> +vsn_2(Conf) when is_list(Conf) -> ?line M = vsn_2, ?line compile_load(M, ?config(data_dir, Conf), Conf), @@ -367,7 +367,7 @@ vsn_2(Conf) when list(Conf) -> vsn_3(doc) -> "Test that different code yields different generated 'vsn'"; vsn_3(suite) -> []; -vsn_3(Conf) when list(Conf) -> +vsn_3(Conf) when is_list(Conf) -> ?line M = vsn_3, ?line compile_load(M, ?config(data_dir, Conf), Conf), diff --git a/lib/compiler/test/guard_SUITE.erl b/lib/compiler/test/guard_SUITE.erl index 7201edf4ac..482564a32b 100644 --- a/lib/compiler/test/guard_SUITE.erl +++ b/lib/compiler/test/guard_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2010. All Rights Reserved. +%% Copyright Ericsson AB 2001-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -111,8 +111,8 @@ const_cond(Config) when is_list(Config) -> const_cond(T, Sz) -> case T of _X when false -> never; - _X when tuple(T), eq == eq, tuple_size(T) == Sz -> ok; - _X when tuple(T), eq == leq, tuple_size(T) =< Sz -> ok; + _X when is_tuple(T), eq == eq, tuple_size(T) == Sz -> ok; + _X when is_tuple(T), eq == leq, tuple_size(T) =< Sz -> ok; _X -> error end. diff --git a/lib/compiler/test/inline_SUITE.erl b/lib/compiler/test/inline_SUITE.erl index 6684b82751..7b9600c2f6 100644 --- a/lib/compiler/test/inline_SUITE.erl +++ b/lib/compiler/test/inline_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2010. All Rights Reserved. +%% Copyright Ericsson AB 2000-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -68,7 +68,7 @@ attribute(Config) when is_list(Config) -> ok. -define(comp(Name), - Name(Config) when list(Config) -> + Name(Config) when is_list(Config) -> try_inline(Name, Config)). ?comp(bsdecode). diff --git a/lib/compiler/test/lc_SUITE.erl b/lib/compiler/test/lc_SUITE.erl index 6dd950eade..bcdcf2fd9f 100644 --- a/lib/compiler/test/lc_SUITE.erl +++ b/lib/compiler/test/lc_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2010. All Rights Reserved. +%% Copyright Ericsson AB 2001-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -180,7 +180,7 @@ empty_generator(Config) when is_list(Config) -> id(I) -> I. fc(Args, {'EXIT',{function_clause,[{?MODULE,_,Args}|_]}}) -> ok; -fc(Args, {'EXIT',{function_clause,[{?MODULE,Name,Arity}|_]}}) +fc(Args, {'EXIT',{function_clause,[{?MODULE,_,Arity}|_]}}) when length(Args) =:= Arity -> true = test_server:is_native(?MODULE); fc(Args, {'EXIT',{{case_clause,ActualArgs},_}}) diff --git a/lib/compiler/test/test_lib.erl b/lib/compiler/test/test_lib.erl index d8799952a9..53d8c04169 100644 --- a/lib/compiler/test/test_lib.erl +++ b/lib/compiler/test/test_lib.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2003-2010. All Rights Reserved. +%% Copyright Ericsson AB 2003-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -41,7 +41,7 @@ smoke_disasm(Mod) when is_atom(Mod) -> smoke_disasm(code:which(Mod)); smoke_disasm(File) when is_list(File) -> Res = beam_disasm:file(File), - {beam_file,Mod} = {element(1, Res),element(2, Res)}. + {beam_file,_Mod} = {element(1, Res),element(2, Res)}. %% Retrieve the "interesting" compiler options (options for optimization %% and compatibility) for the given module. @@ -62,16 +62,16 @@ opt_opts(Mod) -> (_) -> false end, Opts). -%% Some test suites gets cloned (e.g. to "record_SUITE" to "record_no_opt_SUITE"), -%% but the data directory is not cloned. This function retrieves the path to -%% the original data directory. +%% Some test suites gets cloned (e.g. to "record_SUITE" to +%% "record_no_opt_SUITE"), but the data directory is not cloned. +%% This function retrieves the path to the original data directory. get_data_dir(Config) -> Data0 = ?config(data_dir, Config), - {ok,Data1,_} = regexp:sub(Data0, "_no_opt_SUITE", "_SUITE"), - {ok,Data2,_} = regexp:sub(Data1, "_post_opt_SUITE", "_SUITE"), - {ok,Data,_} = regexp:sub(Data2, "_inline_SUITE", "_SUITE"), - Data. + Opts = [{return,list}], + Data1 = re:replace(Data0, "_no_opt_SUITE", "_SUITE", Opts), + Data = re:replace(Data1, "_post_opt_SUITE", "_SUITE", Opts), + re:replace(Data, "_inline_SUITE", "_SUITE", Opts). %% p_run(fun(Data) -> ok|error, List) -> ok %% Will fail the test case if there were any errors. -- cgit v1.2.3