diff options
Diffstat (limited to 'lib/tools')
-rw-r--r-- | lib/tools/doc/src/xref.xml | 2 | ||||
-rw-r--r-- | lib/tools/emacs/erlang.el | 96 | ||||
-rw-r--r-- | lib/tools/src/Makefile | 4 | ||||
-rw-r--r-- | lib/tools/src/cover.erl | 14 | ||||
-rw-r--r-- | lib/tools/src/lcnt.erl | 12 | ||||
-rw-r--r-- | lib/tools/src/make.erl | 14 | ||||
-rw-r--r-- | lib/tools/src/tags.erl | 8 | ||||
-rw-r--r-- | lib/tools/src/xref.erl | 4 | ||||
-rw-r--r-- | lib/tools/src/xref_base.erl | 60 | ||||
-rw-r--r-- | lib/tools/src/xref_compiler.erl | 26 | ||||
-rw-r--r-- | lib/tools/src/xref_reader.erl | 2 | ||||
-rw-r--r-- | lib/tools/src/xref_utils.erl | 12 | ||||
-rw-r--r-- | lib/tools/test/Makefile | 1 | ||||
-rw-r--r-- | lib/tools/test/cprof_SUITE.erl | 18 | ||||
-rw-r--r-- | lib/tools/test/emacs_SUITE.erl | 76 |
15 files changed, 239 insertions, 110 deletions
diff --git a/lib/tools/doc/src/xref.xml b/lib/tools/doc/src/xref.xml index 9706ae6746..891a81639a 100644 --- a/lib/tools/doc/src/xref.xml +++ b/lib/tools/doc/src/xref.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>2000</year><year>2011</year> + <year>2000</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el index 2967acf310..d6d4457920 100644 --- a/lib/tools/emacs/erlang.el +++ b/lib/tools/emacs/erlang.el @@ -7,7 +7,7 @@ ;; %CopyrightBegin% ;; -;; Copyright Ericsson AB 1996-2012. All Rights Reserved. +;; Copyright Ericsson AB 1996-2013. 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 @@ -723,9 +723,6 @@ resulting regexp is surrounded by \\_< and \\_>." (eval-and-compile (defvar erlang-int-bifs '("abs" - "adler32" - "adler32_combine" - "alive" "apply" "atom_to_binary" "atom_to_list" @@ -733,19 +730,20 @@ resulting regexp is surrounded by \\_< and \\_>." "binary_to_existing_atom" "binary_to_list" "binary_to_term" + "binary_part" "bit_size" + "bitsize" "bitstring_to_list" "byte_size" + "check_old_code" "check_process_code" - "contact_binary" - "crc32" - "crc32_combine" "date" - "decode_packet" "delete_module" + "demonitor" "disconnect_node" "element" "erase" + "error" "exit" "float" "float_to_list" @@ -756,7 +754,6 @@ resulting regexp is surrounded by \\_< and \\_>." "halt" "hd" "integer_to_list" - "internal_bif" "iolist_size" "iolist_to_binary" "is_alive" @@ -787,13 +784,13 @@ resulting regexp is surrounded by \\_< and \\_>." "list_to_tuple" "load_module" "make_ref" + "max" + "min" "module_loaded" + "monitor" "monitor_node" "node" - "node_link" - "node_unlink" "nodes" - "notalive" "now" "open_port" "pid_to_list" @@ -837,48 +834,102 @@ resulting regexp is surrounded by \\_< and \\_>." (eval-and-compile (defvar erlang-ext-bifs - '("append_element" + '("adler32" + "adler32_combine" + "alloc_info" + "alloc_sizes" + "append" + "append_element" + "await_proc_exit" + "await_sched_wall_time_modifications" + "bitstr_to_list" "bump_reductions" + "call_on_load_function" "cancel_timer" - "demonitor" + "crasher" + "crc32" + "crc32_combine" + "decode_packet" + "delay_trap" + "delete_element" + "dexit" + "dgroup_leader" "display" + "display_nl" + "display_string" + "dist_exit" + "dlink" + "dmonitor_node" + "dmonitor_p" + "dsend" + "dt_append_vm_tag_data" + "dt_get_tag" + "dt_get_tag_data" + "dt_prepend_vm_tag_data" + "dt_put_tag" + "dt_restore_tag" + "dt_spread_tag" + "dunlink" + "external_size" + "finish_after_on_load" + "finish_loading" + "flush_monitor_message" + "format_cpu_topology" "fun_info" "fun_to_list" "function_exported" + "garbage_collect_message_area" + "gather_sched_wall_time_result" "get_cookie" + "get_module_info" "get_stacktrace" "hash" - "integer_to_list" + "hibernate" + "insert_element" "is_builtin" - "list_to_integer" + "list_to_bitstr" + "load_nif" "loaded" "localtime" "localtime_to_universaltime" + "make_fun" "make_tuple" - "max" + "match_spec_test" "md5" "md5_final" "md5_init" "md5_update" "memory" - "min" - "monitor" + "module_info" "monitor_node" + "nif_error" "phash" "phash2" "port_call" + "port_get_data" "port_info" + "port_set_data" "port_to_list" "ports" + "posixtime_to_universaltime" + "prepare_loading" "process_display" + "raise" "read_timer" "ref_to_list" "resume_process" "send" "send_after" "send_nosuspend" + "seq_trace" + "seq_trace_info" + "seq_trace_print" "set_cookie" + "set_cpu_topology" + "setnode" + "spawn_opt" "start_timer" + "subtract" "suspend_process" "system_flag" "system_info" @@ -890,6 +941,7 @@ resulting regexp is surrounded by \\_< and \\_>." "trace_pattern" "universaltime" "universaltime_to_localtime" + "universaltime_to_posixtime" "yield") "Erlang built-in functions (BIFs) that needs erlang: prefix")) @@ -1518,9 +1570,9 @@ Other commands: . (("\\(?:^\\|[^$]\\)\"\\(?:[^\"\n]\\|\\\\\"\\)*\\(\\$\\)\"" 1 "w") ;; Likewise for atoms ("\\(?:^\\|[^$]\\)'\\(?:[^'\n]\\|\\\\'\\)*\\(\\$\\)'" 1 "w") - ;; And the dollar sign in $\" escapes two characters, not - ;; just one. - ("\\(\\$\\)\\\\\\\"" 1 "'")))))) + ;; And the dollar sign in $\" or $\' escapes two + ;; characters, not just one. + ("\\(\\$\\)\\\\[\"']" 1 "'")))))) diff --git a/lib/tools/src/Makefile b/lib/tools/src/Makefile index bdd0cdce25..e606b97a48 100644 --- a/lib/tools/src/Makefile +++ b/lib/tools/src/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 1996-2012. All Rights Reserved. +# Copyright Ericsson AB 1996-2013. 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 @@ -75,7 +75,7 @@ APPUP_TARGET = $(EBIN)/$(APPUP_FILE) # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- -ERL_COMPILE_FLAGS += +ERL_COMPILE_FLAGS += -Werror # ---------------------------------------------------- # Targets diff --git a/lib/tools/src/cover.erl b/lib/tools/src/cover.erl index 680c1781ca..468225dc13 100644 --- a/lib/tools/src/cover.erl +++ b/lib/tools/src/cover.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2012. All Rights Reserved. +%% Copyright Ericsson AB 2001-2013. 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 @@ -824,7 +824,7 @@ main_process_loop(State) -> main_process_loop(State); get_status -> - io:format("~p~n",[State]), + io:format("~tp~n",[State]), main_process_loop(State) end. @@ -889,7 +889,7 @@ remote_process_loop(State) -> remote_process_loop(State); get_status -> - io:format("~p~n",[State]), + io:format("~tp~n",[State]), remote_process_loop(State); M -> @@ -1007,7 +1007,7 @@ do_start_nodes(Nodes, State) -> erlang:monitor(process,{?SERVER,Node}), [Node|Acc]; Error -> - io:format("Could not start cover on ~w: ~p\n", + io:format("Could not start cover on ~w: ~tp\n", [Node,Error]), Acc end @@ -1223,7 +1223,7 @@ do_get_all_importfiles([],Acc) -> imported_info(Text,Module,Imported) -> case lists:keysearch(Module,1,Imported) of {value,{Module,_File,ImportFiles}} -> - io:format("~s includes data from imported files\n~p\n", + io:format("~ts includes data from imported files\n~tp\n", [Text,ImportFiles]); false -> ok @@ -1237,7 +1237,7 @@ add_imported(Module, File, ImportFile, Imported) -> add_imported(M, F1, ImportFile, [{M,_F2,ImportFiles}|Imported], Acc) -> case lists:member(ImportFile,ImportFiles) of true -> - io:fwrite("WARNING: Module ~w already imported from ~p~n" + io:fwrite("WARNING: Module ~w already imported from ~tp~n" "Not importing again!~n",[M,ImportFile]), dont_import; false -> @@ -1255,7 +1255,7 @@ remove_imported(Module,Imported) -> case lists:keysearch(Module,1,Imported) of {value,{Module,_,ImportFiles}} -> io:fwrite("WARNING: Deleting data for module ~w imported from~n" - "~p~n",[Module,ImportFiles]), + "~tp~n",[Module,ImportFiles]), lists:keydelete(Module,1,Imported); false -> Imported diff --git a/lib/tools/src/lcnt.erl b/lib/tools/src/lcnt.erl index 70d62307c8..f13a297ecf 100644 --- a/lib/tools/src/lcnt.erl +++ b/lib/tools/src/lcnt.erl @@ -2,7 +2,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2012. All Rights Reserved. +%% Copyright Ericsson AB 2010-2013. 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 @@ -272,7 +272,7 @@ handle_call({locations, InOpts}, _From, #state{ locks = Locks } = State) when is Opts = options(InOpts, Default), Printables = filter_print([#print{ name = string_names(Names), - entry = term2string("~p:~p", [Stats#stats.file, Stats#stats.line]), + entry = term2string("~tp:~p", [Stats#stats.file, Stats#stats.line]), colls = Stats#stats.colls, tries = Stats#stats.tries, cr = percent(Stats#stats.colls, Stats#stats.tries), @@ -567,7 +567,7 @@ stats2print(Stats, Duration) -> lists:map(fun (S) -> #print{ - entry = term2string("~p:~p", [S#stats.file, S#stats.line]), + entry = term2string("~tp:~p", [S#stats.file, S#stats.line]), colls = S#stats.colls, tries = S#stats.tries, cr = percent(S#stats.colls, S#stats.tries), @@ -798,20 +798,20 @@ options1([{Key, Value}|Opts], Defaults) -> %%% AUX STRING FORMATTING -print(String) -> io:format("~s~n", [String]). +print(String) -> io:format("~ts~n", [String]). kv(Key, Value) -> kv(Key, Value, 20). kv(Key, Value, Offset) -> term2string(term2string("~~~ps : ~~s", [Offset]),[Key, Value]). s(T) when is_float(T) -> term2string("~.4f", [T]); -s(T) when is_list(T) -> term2string("~s", [T]); +s(T) when is_list(T) -> term2string("~ts", [T]); s(T) -> term2string(T). strings(Strings) -> strings(Strings, []). strings([], Out) -> Out; strings([{space, N, S} | Ss], Out) -> strings(Ss, Out ++ term2string(term2string("~~~ps", [N]), [S])); strings([{format, Format, S} | Ss], Out) -> strings(Ss, Out ++ term2string(Format, [S])); -strings([S|Ss], Out) -> strings(Ss, Out ++ term2string("~s", [S])). +strings([S|Ss], Out) -> strings(Ss, Out ++ term2string("~ts", [S])). term2string({M,F,A}) when is_atom(M), is_atom(F), is_integer(A) -> term2string("~p:~p/~p", [M,F,A]); diff --git a/lib/tools/src/make.erl b/lib/tools/src/make.erl index 5cc8d47faa..c8ef0a04a5 100644 --- a/lib/tools/src/make.erl +++ b/lib/tools/src/make.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2011. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. 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 @@ -90,7 +90,7 @@ read_emakefile(Emakefile,Opts) -> Mods = [filename:rootname(F) || F <- filelib:wildcard("*.erl")], [{Mods, Opts}]; {error,Other} -> - io:format("make: Trouble reading 'Emakefile':~n~p~n",[Other]), + io:format("make: Trouble reading 'Emakefile':~n~tp~n",[Other]), error end. @@ -145,7 +145,7 @@ get_opts_from_emakefile(Mods,Emakefile,Opts) -> {error,enoent} -> [{Mods, Opts}]; {error,Other} -> - io:format("make: Trouble reading 'Emakefile':~n~p~n",[Other]), + io:format("make: Trouble reading 'Emakefile':~n~tp~n",[Other]), error end. @@ -253,15 +253,15 @@ include_opt([]) -> %% Where load can be netload | load | noload recompile(File, true, _Load, _Opts) -> - io:format("Out of date: ~s\n",[File]); + io:format("Out of date: ~ts\n",[File]); recompile(File, false, noload, Opts) -> - io:format("Recompile: ~s\n",[File]), + io:format("Recompile: ~ts\n",[File]), compile:file(File, [report_errors, report_warnings, error_summary |Opts]); recompile(File, false, load, Opts) -> - io:format("Recompile: ~s\n",[File]), + io:format("Recompile: ~ts\n",[File]), c:c(File, Opts); recompile(File, false, netload, Opts) -> - io:format("Recompile: ~s\n",[File]), + io:format("Recompile: ~ts\n",[File]), c:nc(File, Opts). exists(File) -> diff --git a/lib/tools/src/tags.erl b/lib/tools/src/tags.erl index e740d38c91..1c72ef8db5 100644 --- a/lib/tools/src/tags.erl +++ b/lib/tools/src/tags.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. 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 @@ -157,7 +157,7 @@ files_loop([F | Fs], Os) -> ok -> ok; error -> - %% io:format("Could not open ~s~n", [F]), + %% io:format("Could not open ~ts~n", [F]), error end, files_loop(Fs, Os). @@ -315,11 +315,11 @@ close_out(Os) -> pfnote(Str, {LineNo, CharNo}) -> - io_lib:format("~s\177~w,~w~n", [flatrev(Str), LineNo, CharNo]). + io_lib:format("~ts\177~w,~w~n", [flatrev(Str), LineNo, CharNo]). genout(Os, Name, Entries) -> - io:format(Os, "\^l~n~s,~w~n", [Name, reclength(Entries)]), + io:format(Os, "\^l~n~ts,~w~n", [Name, reclength(Entries)]), io:put_chars(Os, lists:reverse(Entries)). diff --git a/lib/tools/src/xref.erl b/lib/tools/src/xref.erl index 0693bec019..abc184c84d 100644 --- a/lib/tools/src/xref.erl +++ b/lib/tools/src/xref.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-2013. 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 @@ -297,7 +297,7 @@ set_default(Name, Option, Value) -> format_error({error, Module, Error}) -> Module:format_error(Error); format_error(E) -> - io_lib:format("~p~n", [E]). + io_lib:format("~tp~n", [E]). %%%---------------------------------------------------------------------- %%%Callback functions from gen_server diff --git a/lib/tools/src/xref_base.erl b/lib/tools/src/xref_base.erl index 93f0e9c0c8..30c5f3d12d 100644 --- a/lib/tools/src/xref_base.erl +++ b/lib/tools/src/xref_base.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2010. All Rights Reserved. +%% Copyright Ericsson AB 2000-2013. 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 @@ -480,43 +480,43 @@ set_default(State, Options) -> format_error({error, Module, Error}) -> Module:format_error(Error); format_error({invalid_options, Options}) -> - io_lib:format("Unknown option(s) or invalid option value(s): ~p~n", + io_lib:format("Unknown option(s) or invalid option value(s): ~tp~n", [Options]); format_error({invalid_filename, Term}) -> - io_lib:format("A file name (a string) was expected: ~p~n", [Term]); + io_lib:format("A file name (a string) was expected: ~tp~n", [Term]); format_error({no_debug_info, FileName}) -> - io_lib:format("The BEAM file ~p has no debug info~n", [FileName]); + io_lib:format("The BEAM file ~tp has no debug info~n", [FileName]); format_error({invalid_path, Term}) -> - io_lib:format("A path (a list of strings) was expected: ~p~n", [Term]); + io_lib:format("A path (a list of strings) was expected: ~tp~n", [Term]); format_error({invalid_query, Term}) -> - io_lib:format("A query (a string or an atom) was expected: ~p~n", [Term]); + io_lib:format("A query (a string or an atom) was expected: ~tp~n", [Term]); format_error({not_user_variable, Variable}) -> - io_lib:format("~p is not a user variable~n", [Variable]); + io_lib:format("~tp is not a user variable~n", [Variable]); format_error({unknown_analysis, Term}) -> - io_lib:format("~p is not a predefined analysis~n", [Term]); + io_lib:format("~tp is not a predefined analysis~n", [Term]); format_error({module_mismatch, Module, ReadModule}) -> - io_lib:format("Name of read module ~p does not match analyzed module ~p~n", + io_lib:format("Name of read module ~tp does not match analyzed module ~tp~n", [ReadModule, Module]); format_error({release_clash, {Release, Dir, OldDir}}) -> - io_lib:format("The release ~p read from ~p clashes with release " - "already read from ~p~n", [Release, Dir, OldDir]); + io_lib:format("The release ~tp read from ~tp clashes with release " + "already read from ~tp~n", [Release, Dir, OldDir]); format_error({application_clash, {Application, Dir, OldDir}}) -> - io_lib:format("The application ~p read from ~p clashes with application " - "already read from ~p~n", [Application, Dir, OldDir]); + io_lib:format("The application ~tp read from ~tp clashes with application " + "already read from ~tp~n", [Application, Dir, OldDir]); format_error({module_clash, {Module, Dir, OldDir}}) -> - io_lib:format("The module ~p read from ~p clashes with module " - "already read from ~p~n", [Module, Dir, OldDir]); + io_lib:format("The module ~tp read from ~tp clashes with module " + "already read from ~tp~n", [Module, Dir, OldDir]); format_error({no_such_release, Name}) -> - io_lib:format("There is no analyzed release ~p~n", [Name]); + io_lib:format("There is no analyzed release ~tp~n", [Name]); format_error({no_such_application, Name}) -> - io_lib:format("There is no analyzed application ~p~n", [Name]); + io_lib:format("There is no analyzed application ~tp~n", [Name]); format_error({no_such_module, Name}) -> - io_lib:format("There is no analyzed module ~p~n", [Name]); + io_lib:format("There is no analyzed module ~tp~n", [Name]); format_error({no_such_info, Term}) -> - io_lib:format("~p is not one of 'modules', 'applications', " + io_lib:format("~tp is not one of 'modules', 'applications', " "'releases' and 'libraries'~n", [Term]); format_error(E) -> - io_lib:format("~p~n", [E]). + io_lib:format("~tp~n", [E]). %% %% Local functions @@ -1506,7 +1506,7 @@ do_variables(State) -> _Else -> {[Name | P], U} end; ({{tmp, V}, _}, A) -> - io:format("Bug in ~p: temporary ~p~n", [?MODULE, V]), A; + io:format("Bug in ~tp: temporary ~tp~n", [?MODULE, V]), A; (_V, A) -> A end, {U,P} = foldl(Fun, {[],[]}, dict:to_list(State#xref.variables)), @@ -1766,23 +1766,23 @@ tpack(T, I, L) -> message(true, What, Arg) -> case What of reading_beam -> - io:format("~s... ", Arg); + io:format("~ts... ", Arg); skipped_beam -> io:format("skipped (no debug information)~n", Arg); no_debug_info -> - io:format("Skipping ~s (no debug information)~n", Arg); + io:format("Skipping ~ts (no debug information)~n", Arg); unresolved_summary1 -> - io:format("~p: 1 unresolved call~n", Arg); + io:format("~tp: 1 unresolved call~n", Arg); unresolved_summary -> - io:format("~p: ~p unresolved calls~n", Arg); + io:format("~tp: ~tp unresolved calls~n", Arg); jam -> - io:format("Skipping ~s (probably JAM file)~n", [Arg]); + io:format("Skipping ~ts (probably JAM file)~n", [Arg]); unreadable -> - io:format("Skipping ~s (unreadable)~n", [Arg]); + io:format("Skipping ~ts (unreadable)~n", [Arg]); xref_attr -> - io:format("~s: Skipping 'xref' attribute ~w~n", Arg); + io:format("~ts: Skipping 'xref' attribute ~w~n", Arg); depr_attr -> - io:format("~s: Skipping 'deprecated' attribute ~w~n", Arg); + io:format("~ts: Skipping 'deprecated' attribute ~w~n", Arg); lib_search -> io:format("Scanning library path for BEAM files... ", []); lib_check -> @@ -1794,7 +1794,7 @@ message(true, What, Arg) -> error -> io:format("error~n", Arg); Else -> - io:format("~p~n", [{Else,Arg}]) + io:format("~tp~n", [{Else,Arg}]) end; message(_, _, _) -> true. diff --git a/lib/tools/src/xref_compiler.erl b/lib/tools/src/xref_compiler.erl index 22312c6754..f0fed502a5 100644 --- a/lib/tools/src/xref_compiler.erl +++ b/lib/tools/src/xref_compiler.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2011. All Rights Reserved. +%% Copyright Ericsson AB 2000-2013. 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 @@ -83,19 +83,19 @@ format_error({error, Module, Error}) -> format_error({parse_error, Line, Error}) -> format_parse_error(Error, format_line(Line)); format_error({variable_reassigned, Expr}) -> - io_lib:format("Variable assigned more than once: ~s~n", [Expr]); + io_lib:format("Variable assigned more than once: ~ts~n", [Expr]); format_error({unknown_variable, Name}) -> - io_lib:format("Variable ~p used before set~n", [Name]); + io_lib:format("Variable ~tp used before set~n", [Name]); format_error({type_error, Expr}) -> io_lib:format("Operator applied to argument(s) of different or " - "invalid type(s): ~s~n", [Expr]); + "invalid type(s): ~ts~n", [Expr]); format_error({type_mismatch, Expr1, Expr2}) -> - io_lib:format("Constants of different types: ~s, ~s~n", + io_lib:format("Constants of different types: ~ts, ~ts~n", [Expr1, Expr2]); format_error({unknown_constant, Constant}) -> - io_lib:format("Unknown constant ~s~n", [Constant]); + io_lib:format("Unknown constant ~ts~n", [Constant]); format_error(E) -> - io_lib:format("~p~n", [E]). + io_lib:format("~tp~n", [E]). %% %% Local functions @@ -908,21 +908,21 @@ fetch_value(V, D) -> Value. format_parse_error(["invalid_regexp", String, Error], Line) -> - io_lib:format("Invalid regular expression \"~s\"~s: ~s~n", + io_lib:format("Invalid regular expression \"~ts\"~s: ~ts~n", [String, Line, lists:flatten(Error)]); format_parse_error(["invalid_regexp_variable", Var], Line) -> - io_lib:format("Invalid wildcard variable ~p~s " + io_lib:format("Invalid wildcard variable ~tp~s " "(only '_' is allowed)~n", [Var, Line]); format_parse_error(["missing_type", Expr], Line) -> - io_lib:format("Missing type of regular expression ~s~s~n", + io_lib:format("Missing type of regular expression ~ts~s~n", [Expr, Line]); format_parse_error(["type_mismatch", Expr], Line) -> - io_lib:format("Type does not match structure of constant~s: ~s~n", + io_lib:format("Type does not match structure of constant~s: ~ts~n", [Line, Expr]); format_parse_error(["invalid_operator", Op], Line) -> - io_lib:format("Invalid operator ~p~s~n", [Op, Line]); + io_lib:format("Invalid operator ~tp~s~n", [Op, Line]); format_parse_error(Error, Line) -> - io_lib:format("Parse error~s: ~s~n", [Line, lists:flatten(Error)]). + io_lib:format("Parse error~s: ~ts~n", [Line, lists:flatten(Error)]). format_line(-1) -> " at end of string"; diff --git a/lib/tools/src/xref_reader.erl b/lib/tools/src/xref_reader.erl index 2fcc2c503c..d3601c6ea0 100644 --- a/lib/tools/src/xref_reader.erl +++ b/lib/tools/src/xref_reader.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2010. All Rights Reserved. +%% Copyright Ericsson AB 2000-2013. 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 diff --git a/lib/tools/src/xref_utils.erl b/lib/tools/src/xref_utils.erl index 680563e9df..7b72165e6f 100644 --- a/lib/tools/src/xref_utils.erl +++ b/lib/tools/src/xref_utils.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2012. All Rights Reserved. +%% Copyright Ericsson AB 2000-2013. 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 @@ -517,16 +517,16 @@ subprocess(Fun, Opts) -> format_error({error, Module, Error}) -> Module:format_error(Error); format_error({file_error, FileName, Reason}) -> - io_lib:format("~s: ~p~n", [FileName, file:format_error(Reason)]); + io_lib:format("~ts: ~tp~n", [FileName, file:format_error(Reason)]); format_error({unrecognized_file, FileName}) -> - io_lib:format("~p is neither a regular file nor a directory~n", + io_lib:format("~tp is neither a regular file nor a directory~n", [FileName]); format_error({no_such_module, Module}) -> - io_lib:format("Cannot find module ~p using the code path~n", [Module]); + io_lib:format("Cannot find module ~tp using the code path~n", [Module]); format_error({interpreted, Module}) -> - io_lib:format("Cannot use BEAM code of interpreted module ~p~n", [Module]); + io_lib:format("Cannot use BEAM code of interpreted module ~tp~n", [Module]); format_error(E) -> - io_lib:format("~p~n", [E]). + io_lib:format("~tp~n", [E]). %% %% Local functions diff --git a/lib/tools/test/Makefile b/lib/tools/test/Makefile index 86c81217b6..484cfdf53f 100644 --- a/lib/tools/test/Makefile +++ b/lib/tools/test/Makefile @@ -22,6 +22,7 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk MODULES = \ cover_SUITE \ eprof_SUITE \ + emacs_SUITE \ emem_SUITE \ fprof_SUITE \ cprof_SUITE \ diff --git a/lib/tools/test/cprof_SUITE.erl b/lib/tools/test/cprof_SUITE.erl index 93caee0c8f..fa4068dade 100644 --- a/lib/tools/test/cprof_SUITE.erl +++ b/lib/tools/test/cprof_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2011. All Rights Reserved. +%% Copyright Ericsson AB 2002-2013. 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 @@ -230,10 +230,10 @@ on_load_test(Config) -> %% ?line N4 = cprof:restart(), ?line {ok,Module} = c:c(File, [{outdir,Priv}]), - ?line L = Module:seq(1, M, fun (I) -> succ(I) end), - ?line Lr = Module:seq_r(1, M, fun (I) -> succ(I) end), - ?line L = seq(1, M, fun (I) -> succ(I) end), - ?line Lr = seq_r(1, M, fun (I) -> succ(I) end), + ?line L = Module:seq(1, M, fun succ/1), + ?line Lr = Module:seq_r(1, M, fun succ/1), + ?line L = seq(1, M, fun succ/1), + ?line Lr = seq_r(1, M, fun succ/1), ?line N2 = cprof:pause(), ?line {Module,0,[]} = cprof:analyse(Module), ?line M_1 = M - 1, @@ -265,10 +265,10 @@ modules_test(Config) -> ?line M2__1 = M2 + 1, ?line erlang:yield(), ?line N = cprof:start(), - ?line L = Module:seq(1, M, fun (I) -> succ(I) end), - ?line Lr = Module:seq_r(1, M, fun (I) -> succ(I) end), - ?line L = seq(1, M, fun (I) -> succ(I) end), - ?line Lr = seq_r(1, M, fun (I) -> succ(I) end), + ?line L = Module:seq(1, M, fun succ/1), + ?line Lr = Module:seq_r(1, M, fun succ/1), + ?line L = seq(1, M, fun succ/1), + ?line Lr = seq_r(1, M, fun succ/1), ?line N = cprof:pause(), ?line Lr = lists:reverse(L), ?line M_1 = M - 1, diff --git a/lib/tools/test/emacs_SUITE.erl b/lib/tools/test/emacs_SUITE.erl new file mode 100644 index 0000000000..657a3002a3 --- /dev/null +++ b/lib/tools/test/emacs_SUITE.erl @@ -0,0 +1,76 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2005-2013. 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 +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(emacs_SUITE). + +%%-define(line_trace, 1). + +-export([all/0, init_per_testcase/2, end_per_testcase/2]). + +-export([bif_highlight/1]). + +all() -> + [bif_highlight]. + +init_per_testcase(_Case, Config) -> + ErlangEl = filename:join([code:lib_dir(tools),"emacs","erlang.el"]), + case file:read_file_info(ErlangEl) of + {ok, _} -> + [{el, ErlangEl}|Config]; + _ -> + {skip, "Could not find erlang.el"} + end. + +end_per_testcase(_Case, _Config) -> + ok. + +bif_highlight(Config) -> + ErlangEl = proplists:get_value(el,Config), + {ok, Bin} = file:read_file(ErlangEl), + + %% All auto-imported bifs + IntBifs = lists:usort( + [F || {F,A} <- erlang:module_info(exports), + erl_internal:bif(F,A)]), + + %% all bif which need erlang: prefix and are not operands + ExtBifs = lists:usort( + [F || {F,A} <- erlang:module_info(exports), + not erl_internal:bif(F,A) andalso + not is_atom(catch erl_internal:op_type(F,A))]), + + check_bif_highlight(Bin, <<"erlang-int-bifs">>, IntBifs), + check_bif_highlight(Bin, <<"erlang-ext-bifs">>, ExtBifs). + + +check_bif_highlight(Bin, Tag, Compare) -> + [_H,IntMatch,_T] = + re:split(Bin,<<"defvar ",Tag/binary, + "[^(]*\\(([^)]*)">>,[]), + EmacsIntBifs = [list_to_atom(S) || + S <- string:tokens(binary_to_list(IntMatch)," '\"\n")], + + ct:log("Emacs ~p",[EmacsIntBifs]), + ct:log("Int ~p",[Compare]), + + ct:log("Diff1 ~p",[Compare -- EmacsIntBifs]), + ct:log("Diff2 ~p",[EmacsIntBifs -- Compare]), + [] = Compare -- EmacsIntBifs, + [] = EmacsIntBifs -- Compare. + + |