diff options
Diffstat (limited to 'lib')
49 files changed, 341 insertions, 354 deletions
diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl index a3c71fea15..c2d7d40446 100644 --- a/lib/erl_docgen/priv/xsl/db_html.xsl +++ b/lib/erl_docgen/priv/xsl/db_html.xsl @@ -383,9 +383,7 @@ </xsl:choose> </xsl:when> <xsl:otherwise> <!-- <datatype> with <name> --> - <span class="bold_code"> - <xsl:apply-templates/> - </span> + <xsl:call-template name="name"/> </xsl:otherwise> </xsl:choose> </xsl:template> @@ -1855,6 +1853,7 @@ </xsl:choose> </xsl:template> + <!-- Used both in <datatype> and in <func>! --> <xsl:template name="name"> <xsl:variable name="tmpstring"> @@ -1911,7 +1910,14 @@ </xsl:otherwise> </xsl:choose> </xsl:variable> - <a name="{$fname}-{$arity}"><span class="bold_code"><xsl:value-of select="."/></span></a><br/> + <xsl:choose> + <xsl:when test="ancestor::datatype"> + <a name="type-{$fname}"><span class="bold_code"><xsl:value-of select="."/></span></a><br/> + </xsl:when> + <xsl:otherwise> + <a name="{$fname}-{$arity}"><span class="bold_code"><xsl:value-of select="."/></span></a><br/> + </xsl:otherwise> + </xsl:choose> </xsl:when> <xsl:otherwise> <span class="bold_code"><xsl:value-of select="."/></span> diff --git a/lib/erl_interface/test/ei_connect_SUITE_data/Makefile.src b/lib/erl_interface/test/ei_connect_SUITE_data/Makefile.src index 5b82f0bfcf..c2d8261dd8 100644 --- a/lib/erl_interface/test/ei_connect_SUITE_data/Makefile.src +++ b/lib/erl_interface/test/ei_connect_SUITE_data/Makefile.src @@ -23,9 +23,10 @@ include @erl_interface_mk_include@ CC0 = @CC@ CC = ..@DS@all_SUITE_data@DS@gccifier@exe@ -CC"$(CC0)" LD = @LD@ +LIBERL = @erl_interface_lib@ LIBEI = @erl_interface_eilib@ LIBFLAGS = ../all_SUITE_data/ei_runner@obj@ \ - $(LIBEI) @LIBS@ @erl_interface_sock_libs@ \ + $(LIBERL) $(LIBEI) @LIBS@ @erl_interface_sock_libs@ \ @erl_interface_threadlib@ CFLAGS = @EI_CFLAGS@ $(THR_DEFS) -I@erl_interface_include@ -I../all_SUITE_data EI_CONNECT_OBJS = ei_connect_test@obj@ ei_connect_test_decl@obj@ diff --git a/lib/erl_interface/test/ei_connect_SUITE_data/einode.c b/lib/erl_interface/test/ei_connect_SUITE_data/einode.c index e1d46ae59a..bb71575740 100644 --- a/lib/erl_interface/test/ei_connect_SUITE_data/einode.c +++ b/lib/erl_interface/test/ei_connect_SUITE_data/einode.c @@ -35,6 +35,7 @@ #endif #include "ei.h" +#include "erl_interface.h" #ifdef VXWORKS #define MAIN cnode @@ -115,6 +116,8 @@ MAIN(int argc, char *argv[]) if (argc < 3) exit(1); + erl_init(NULL, 0); + cookie = argv[1]; n = atoi(argv[2]); if (n > 100) diff --git a/lib/inets/src/ftp/ftp.erl b/lib/inets/src/ftp/ftp.erl index db6260c7af..c2ca511795 100644 --- a/lib/inets/src/ftp/ftp.erl +++ b/lib/inets/src/ftp/ftp.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2015. All Rights Reserved. +%% Copyright Ericsson AB 1997-2016. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -2177,7 +2177,7 @@ handle_caller(#state{caller = {transfer_data, {Cmd, Bin, RemoteFile}}} = %% Connect to FTP server at Host (default is TCP port 21) %% in order to establish a control connection. setup_ctrl_connection(Host, Port, Timeout, State) -> - MsTime = inets_time_compat:monotonic_time(), + MsTime = erlang:monotonic_time(), case connect(Host, Port, Timeout, State) of {ok, IpFam, CSock} -> NewState = State#state{csock = {tcp, CSock}, ipfamily = IpFam}, diff --git a/lib/inets/src/inets_app/Makefile b/lib/inets/src/inets_app/Makefile index 1d870c14e8..eb0098dbee 100644 --- a/lib/inets/src/inets_app/Makefile +++ b/lib/inets/src/inets_app/Makefile @@ -48,8 +48,7 @@ MODULES = \ inets_app \ inets_sup \ inets_trace \ - inets_lib \ - inets_time_compat + inets_lib INTERNAL_HRL_FILES = inets_internal.hrl EXTERNAL_HRL_FILES = ../../include/httpd.hrl \ diff --git a/lib/inets/src/inets_app/inets.app.src b/lib/inets/src/inets_app/inets.app.src index 5706a335d7..eb4be932ac 100644 --- a/lib/inets/src/inets_app/inets.app.src +++ b/lib/inets/src/inets_app/inets.app.src @@ -28,7 +28,6 @@ inets_service, inets_trace, inets_lib, - inets_time_compat, %% FTP ftp, diff --git a/lib/inets/src/inets_app/inets_lib.erl b/lib/inets/src/inets_app/inets_lib.erl index 6e16f5ef6e..8993be29e4 100644 --- a/lib/inets/src/inets_app/inets_lib.erl +++ b/lib/inets/src/inets_app/inets_lib.erl @@ -27,7 +27,7 @@ %% Help function, elapsed milliseconds since T0 millisec_passed({_,_,_} = T0 ) -> %% OTP 17 and earlier - timer:now_diff(inets_time_compat:timestamp(), T0) div 1000; + timer:now_diff(erlang:timestamp(), T0) div 1000; millisec_passed(T0) -> %% OTP 18 diff --git a/lib/inets/src/inets_app/inets_time_compat.erl b/lib/inets/src/inets_app/inets_time_compat.erl deleted file mode 100644 index 475f0685dc..0000000000 --- a/lib/inets/src/inets_app/inets_time_compat.erl +++ /dev/null @@ -1,72 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2015-2015. All Rights Reserved. -%% -%% Licensed under the Apache License, Version 2.0 (the "License"); -%% you may not use this file except in compliance with the License. -%% You may obtain a copy of the License at -%% -%% http://www.apache.org/licenses/LICENSE-2.0 -%% -%% Unless required by applicable law or agreed to in writing, software -%% distributed under the License is distributed on an "AS IS" BASIS, -%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -%% See the License for the specific language governing permissions and -%% limitations under the License. -%% -%% %CopyrightEnd% -%% - -%% This module is created to be able to execute on ERTS versions both -%% earlier and later than 7.0. - --module(inets_time_compat). - -%% We don't want warnings about the use of erlang:now/0 in -%% this module. --compile(nowarn_deprecated_function). - --export([monotonic_time/0, - timestamp/0, - unique_integer/0, - unique_integer/1]). - -monotonic_time() -> - try - erlang:monotonic_time() - catch - error:undef -> - %% Use Erlang system time as monotonic time - erlang_system_time_fallback() - end. - -timestamp() -> - try - erlang:timestamp() - catch - error:undef -> - erlang:now() - end. - -unique_integer() -> - try - erlang:unique_integer() - catch - error:undef -> - erlang_system_time_fallback() - end. - -unique_integer(Modifiers) -> - try - erlang:unique_integer(Modifiers) - catch - error:badarg -> - erlang:error(badarg, [Modifiers]); - error:undef -> - erlang_system_time_fallback() - end. - -erlang_system_time_fallback() -> - {MS, S, US} = erlang:now(), - (MS*1000000+S)*1000000+US. diff --git a/lib/inets/src/tftp/tftp_logger.erl b/lib/inets/src/tftp/tftp_logger.erl index 5e5d1d56c7..a869958484 100644 --- a/lib/inets/src/tftp/tftp_logger.erl +++ b/lib/inets/src/tftp/tftp_logger.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2015. All Rights Reserved. +%% Copyright Ericsson AB 2008-2016. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -85,7 +85,7 @@ info_msg(Format, Data) -> %%------------------------------------------------------------------- add_timestamp(Format, Data) -> - Time = inets_time_compat:timestamp(), + Time = erlang:timestamp(), {{_Y, _Mo, _D}, {H, Mi, S}} = calendar:now_to_universal_time(Time), %% {"~p-~s-~sT~s:~s:~sZ,~6.6.0w tftp: " ++ Format ++ "\n", %% [Y, t(Mo), t(D), t(H), t(Mi), t(S), MicroSecs | Data]}. diff --git a/lib/inets/src/tftp/tftp_sup.erl b/lib/inets/src/tftp/tftp_sup.erl index 98b92cc87c..40b67c499c 100644 --- a/lib/inets/src/tftp/tftp_sup.erl +++ b/lib/inets/src/tftp/tftp_sup.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2015. All Rights Reserved. +%% Copyright Ericsson AB 2005-2016. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -94,7 +94,7 @@ unique_name(Options) -> {value, {_, Port}} when is_integer(Port), Port > 0 -> {tftpd, Port}; _ -> - {tftpd, inets_time_compat:unique_integer([positive])} + {tftpd, erlang:unique_integer([positive])} end. default_kill_after() -> diff --git a/lib/inets/test/ftp_suite_lib.erl b/lib/inets/test/ftp_suite_lib.erl index 71985df877..0f82b1c1c3 100644 --- a/lib/inets/test/ftp_suite_lib.erl +++ b/lib/inets/test/ftp_suite_lib.erl @@ -1353,7 +1353,7 @@ do_delete(Pid, Config) -> do_mkdir(Pid) -> NewDir = "earl_" ++ - integer_to_list(inets_time_compat:unique_integer([positive])), + integer_to_list(erlang:unique_integer([positive])), ok = ftp:cd(Pid, "incoming"), {ok, CurrDir} = ftp:pwd(Pid), diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl index f9b3aa5b59..e6c4e48feb 100644 --- a/lib/inets/test/httpc_SUITE.erl +++ b/lib/inets/test/httpc_SUITE.erl @@ -2077,7 +2077,7 @@ run_clients(NumClients, ServerPort, SeqNumServer) -> wait4clients([], _Timeout) -> ok; wait4clients(Clients, Timeout) when Timeout > 0 -> - Time = inets_time_compat:monotonic_time(), + Time = erlang:monotonic_time(), receive {'DOWN', _MRef, process, Pid, normal} -> @@ -2177,7 +2177,7 @@ parse_connection_type(Request) -> end. set_random_seed() -> - Unique = inets_time_compat:unique_integer(), + Unique = erlang:unique_integer(), A = erlang:phash2([make_ref(), self(), Unique]), random:seed(A, A, A). diff --git a/lib/inets/test/httpd_time_test.erl b/lib/inets/test/httpd_time_test.erl index fddc0003cd..e858ddf4f6 100644 --- a/lib/inets/test/httpd_time_test.erl +++ b/lib/inets/test/httpd_time_test.erl @@ -117,7 +117,7 @@ main(N, SocketType, Host, Port, Time) loop(Pollers, Timeout) -> d("loop -> entry when" "~n Timeout: ~p", [Timeout]), - Start = inets_time_compat:monotonic_time(), + Start = erlang:monotonic_time(), receive {'EXIT', Pid, {poller_stat_failure, SocketType, Host, Port, Time, Reason}} -> diff --git a/lib/kernel/doc/src/application.xml b/lib/kernel/doc/src/application.xml index 3928078932..8d33aa86e7 100644 --- a/lib/kernel/doc/src/application.xml +++ b/lib/kernel/doc/src/application.xml @@ -62,8 +62,7 @@ </datatype> <datatype> <name>tuple_of(T)</name> - <desc><p><marker id="type-tuple_of"/> - A tuple where the elements are of type <c>T</c>.</p></desc> + <desc><p>A tuple where the elements are of type <c>T</c>.</p></desc> </datatype> </datatypes> <funcs> diff --git a/lib/kernel/doc/src/file.xml b/lib/kernel/doc/src/file.xml index a73038ac58..7d86c3ebcb 100644 --- a/lib/kernel/doc/src/file.xml +++ b/lib/kernel/doc/src/file.xml @@ -90,8 +90,7 @@ <datatype> <name>fd()</name> <desc> - <p><marker id="type-fd"/> - A file descriptor representing a file opened in + <p>A file descriptor representing a file opened in <seealso marker="#raw"><c>raw</c></seealso> mode.</p> </desc> </datatype> diff --git a/lib/kernel/doc/src/gen_sctp.xml b/lib/kernel/doc/src/gen_sctp.xml index 57307cd594..737800c6b1 100644 --- a/lib/kernel/doc/src/gen_sctp.xml +++ b/lib/kernel/doc/src/gen_sctp.xml @@ -72,8 +72,7 @@ <datatype> <name>assoc_id()</name> <desc> - <p><marker id="type-assoc_id"/> - An opaque term returned in, for example, <c>#sctp_paddr_change{}</c>, + <p>An opaque term returned in, for example, <c>#sctp_paddr_change{}</c>, which identifies an association for an SCTP socket. The term is opaque except for the special value <c>0</c>, which has a meaning such as "the whole endpoint" or "all future associations".</p> @@ -88,12 +87,11 @@ </datatype> <datatype> <name name="option_name"/> - <desc><marker id="type-sctp_socket"></marker></desc> </datatype> <datatype> <name>sctp_socket()</name> <desc> - <p><marker id="type-sctp_socket"/>Socket identifier returned from + <p>Socket identifier returned from <seealso marker="#open/0"><c>open/*</c></seealso>.</p> <marker id="exports"></marker> </desc> diff --git a/lib/kernel/doc/src/gen_tcp.xml b/lib/kernel/doc/src/gen_tcp.xml index 919178195f..8bd94892ad 100644 --- a/lib/kernel/doc/src/gen_tcp.xml +++ b/lib/kernel/doc/src/gen_tcp.xml @@ -79,8 +79,7 @@ do_recv(Sock, Bs) -> </datatype> <datatype> <name>socket()</name> - <desc><p><marker id="type-socket"/> - As returned by + <desc><p>As returned by <seealso marker="#accept/1"><c>accept/1,2</c></seealso> and <seealso marker="#connect/3"><c>connect/3,4</c></seealso>.</p> <marker id="connect"></marker> diff --git a/lib/kernel/doc/src/gen_udp.xml b/lib/kernel/doc/src/gen_udp.xml index 906883ed34..3db291600d 100644 --- a/lib/kernel/doc/src/gen_udp.xml +++ b/lib/kernel/doc/src/gen_udp.xml @@ -45,7 +45,6 @@ <datatype> <name>socket()</name> <desc> - <marker id="type-socket"/> <p>As returned by <seealso marker="#open/1"><c>open/1,2</c></seealso>.</p> </desc> diff --git a/lib/kernel/doc/src/inet.xml b/lib/kernel/doc/src/inet.xml index cfff393b8c..bca04aa244 100644 --- a/lib/kernel/doc/src/inet.xml +++ b/lib/kernel/doc/src/inet.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1997</year><year>2015</year> + <year>1997</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -128,7 +128,7 @@ fe80::204:acff:fe17:bf38 <datatype> <name>socket()</name> <desc> - <p><marker id="type-socket"></marker>See + <p>See <seealso marker="gen_tcp#type-socket"><c>gen_tcp:type-socket</c></seealso> and <seealso marker="gen_udp#type-socket"><c>gen_udp:type-socket</c></seealso>. diff --git a/lib/kernel/test/erl_prim_loader_SUITE.erl b/lib/kernel/test/erl_prim_loader_SUITE.erl index 4f3881d27e..b6417210b9 100644 --- a/lib/kernel/test/erl_prim_loader_SUITE.erl +++ b/lib/kernel/test/erl_prim_loader_SUITE.erl @@ -108,13 +108,18 @@ get_file(Config) when is_list(Config) -> error = erl_prim_loader:get_file({dummy}), ok. -get_modules(_Config) -> +get_modules(Config) -> case test_server:is_cover() of - false -> do_get_modules(); + false -> do_get_modules(Config); true -> {skip,"Cover"} end. -do_get_modules() -> +do_get_modules(Config) -> + PrivDir = proplists:get_value(priv_dir, Config), + NotADir = atom_to_list(?FUNCTION_NAME) ++ "_not_a_dir", + ok = file:write_file(filename:join(PrivDir, NotADir), <<>>), + ok = file:set_cwd(PrivDir), + MsGood = lists:sort([lists,gen_server,gb_trees,code_server]), Ms = [certainly_not_existing|MsGood], SuccExp = [begin @@ -129,8 +134,10 @@ do_get_modules() -> Path = code:get_path(), Process = fun(_, F, Code) -> {ok,{F,erlang:md5(Code)}} end, - {ok,{Succ,FailExp}} = erl_prim_loader:get_modules(Ms, Process, Path), - SuccExp = lists:sort(Succ), + {ok,{SuccExp,FailExp}} = get_modules_sorted(Ms, Process, Path), + + %% Test that an 'enotdir' error can be handled. + {ok,{SuccExp,FailExp}} = get_modules_sorted(Ms, Process, [NotADir|Path]), Name = inet_get_modules, {ok, Node, BootPid} = complete_start_node(Name), @@ -147,6 +154,13 @@ do_get_modules() -> ok. +get_modules_sorted(Ms, Process, Path) -> + case erl_prim_loader:get_modules(Ms, Process, Path) of + {ok,{Succ,FailExp}} -> + {ok,{lists:sort(Succ),lists:sort(FailExp)}}; + Other -> + Other + end. normalize_and_backslash(Config) -> %% Test OTP-11170 diff --git a/lib/percept/src/egd.erl b/lib/percept/src/egd.erl index d57b7bb81d..fe52da71f1 100644 --- a/lib/percept/src/egd.erl +++ b/lib/percept/src/egd.erl @@ -37,9 +37,7 @@ -include("egd.hrl"). %%========================================================================== -%% -%% Type definitions -%% +%% Type definitions %%========================================================================== %% @type egd_image() @@ -54,9 +52,7 @@ -type color() :: {float(), float(), float(), float()}. %%========================================================================== -%% -%% Interface functions -%% +%% Interface functions %%========================================================================== %% @spec create(integer(), integer()) -> egd_image() @@ -74,8 +70,7 @@ create(Width,Height) -> -spec destroy(Image :: egd_image()) -> ok. destroy(Image) -> - cast(Image, destroy), - ok. + cast(Image, destroy). %% @spec render(egd_image()) -> binary() @@ -113,8 +108,7 @@ render(Image, Type, Options) -> %% mainly. information(Pid) -> - cast(Pid, information), - ok. + cast(Pid, information). %% @spec line(egd_image(), point(), point(), color()) -> ok %% @doc Creates a line object from P1 to P2 in the image. @@ -126,8 +120,7 @@ information(Pid) -> Color :: color()) -> 'ok'. line(Image, P1, P2, Color) -> - cast(Image, {line, P1, P2, Color}), - ok. + cast(Image, {line, P1, P2, Color}). %% @spec color( Value | Name ) -> color() %% where @@ -152,74 +145,67 @@ color(_Image, Color) -> %% @doc Creates a text object. text(Image, P, Font, Text, Color) -> - cast(Image, {text, P, Font, Text, Color}), - ok. + cast(Image, {text, P, Font, Text, Color}). %% @spec rectangle(egd_image(), point(), point(), color()) -> ok %% @doc Creates a rectangle object. rectangle(Image, P1, P2, Color) -> - cast(Image, {rectangle, P1, P2, Color}), - ok. + cast(Image, {rectangle, P1, P2, Color}). %% @spec filledRectangle(egd_image(), point(), point(), color()) -> ok %% @doc Creates a filled rectangle object. filledRectangle(Image, P1, P2, Color) -> - cast(Image, {filled_rectangle, P1, P2, Color}), - ok. + cast(Image, {filled_rectangle, P1, P2, Color}). %% @spec filledEllipse(egd_image(), point(), point(), color()) -> ok %% @doc Creates a filled ellipse object. filledEllipse(Image, P1, P2, Color) -> - cast(Image, {filled_ellipse, P1, P2, Color}), - ok. + cast(Image, {filled_ellipse, P1, P2, Color}). %% @spec filledTriangle(egd_image(), point(), point(), point(), color()) -> ok %% @hidden %% @doc Creates a filled triangle object. filledTriangle(Image, P1, P2, P3, Color) -> - cast(Image, {filled_triangle, P1, P2, P3, Color}), - ok. + cast(Image, {filled_triangle, P1, P2, P3, Color}). %% @spec polygon(egd_image(), [point()], color()) -> ok %% @hidden %% @doc Creates a filled filled polygon object. polygon(Image, Pts, Color) -> - cast(Image, {polygon, Pts, Color}), - ok. + cast(Image, {polygon, Pts, Color}). %% @spec arc(egd_image(), point(), point(), color()) -> ok %% @hidden %% @doc Creates an arc with radius of bbx corner. arc(Image, P1, P2, Color) -> - cast(Image, {arc, P1, P2, Color}), - ok. + cast(Image, {arc, P1, P2, Color}). %% @spec arc(egd_image(), point(), point(), integer(), color()) -> ok %% @hidden %% @doc Creates an arc. arc(Image, P1, P2, D, Color) -> - cast(Image, {arc, P1, P2, D, Color}), - ok. + cast(Image, {arc, P1, P2, D, Color}). %% @spec save(binary(), string()) -> ok %% @doc Saves the binary to file. save(Binary, Filename) when is_binary(Binary) -> - file:write_file(Filename, Binary), + ok = file:write_file(Filename, Binary), ok. % --------------------------------- % Aux functions % --------------------------------- cast(Pid, Command) -> - Pid ! {egd, self(), Command}. + Pid ! {egd, self(), Command}, + ok. call(Pid, Command) -> Pid ! {egd, self(), Command}, diff --git a/lib/percept/src/egd.hrl b/lib/percept/src/egd.hrl index 1b125d3a08..fc0a7e10ee 100644 --- a/lib/percept/src/egd.hrl +++ b/lib/percept/src/egd.hrl @@ -41,6 +41,5 @@ -ifdef(debug). -define(dbg(X), io:format("DEBUG: ~p:~p~n",[?MODULE, X])). -else. --define(dbg(X), void). +-define(dbg(X), ok). -endif. - diff --git a/lib/percept/src/egd_font.erl b/lib/percept/src/egd_font.erl index 95203d5441..ef1cc434df 100644 --- a/lib/percept/src/egd_font.erl +++ b/lib/percept/src/egd_font.erl @@ -51,9 +51,7 @@ %% %%========================================================================== -%% -%% Interface functions -%% +%% Interface functions %%========================================================================== size(Font) -> @@ -70,15 +68,14 @@ load(Filename) -> load_font_header(Font). %%========================================================================== -%% -%% Internal functions -%% +%% Internal functions %%========================================================================== %% ETS handler functions initialize_table() -> - ets:new(egd_font_table, [named_table, ordered_set, public]). + egd_font_table = ets:new(egd_font_table, [named_table, ordered_set, public]), + ok. glyph_insert(Font, Code, Translation, LSs) -> Element = {{Font, Code}, Translation, LSs}, diff --git a/lib/percept/src/egd_render.erl b/lib/percept/src/egd_render.erl index c0075b8c42..6c708e3e86 100644 --- a/lib/percept/src/egd_render.erl +++ b/lib/percept/src/egd_render.erl @@ -662,4 +662,3 @@ eps_header(W,H) -> eps_footer() -> "%%EOF\n". - diff --git a/lib/percept/src/percept.erl b/lib/percept/src/percept.erl index 24ddf1bd14..046e0b7518 100644 --- a/lib/percept/src/percept.erl +++ b/lib/percept/src/percept.erl @@ -26,27 +26,24 @@ -module(percept). -behaviour(application). --export([ - profile/1, - profile/2, - profile/3, - stop_profile/0, - start_webserver/0, - start_webserver/1, - stop_webserver/0, - stop_webserver/1, - analyze/1, - % Application behaviour - start/2, - stop/1]). +-export([profile/1, + profile/2, + profile/3, + stop_profile/0, + start_webserver/0, + start_webserver/1, + stop_webserver/0, + stop_webserver/1, + analyze/1, + % Application behaviour + start/2, + stop/1]). -include("percept.hrl"). %%========================================================================== -%% -%% Type definitions -%% +%% Type definitions %%========================================================================== %% @type percept_option() = procs | ports | exclusive @@ -54,9 +51,7 @@ -type percept_option() :: 'procs' | 'ports' | 'exclusive' | 'scheduler'. %%========================================================================== -%% -%% Application callback functions -%% +%% Application callback functions %%========================================================================== %% @spec start(Type, Args) -> {started, Hostname, Port} | {error, Reason} @@ -76,9 +71,7 @@ stop(_State) -> stop_webserver(0). %%========================================================================== -%% -%% Interface functions -%% +%% Interface functions %%========================================================================== %% @spec profile(Filename::string()) -> {ok, Port} | {already_started, Port} @@ -158,11 +151,11 @@ start_webserver() -> {'started', string(), pos_integer()} | {'error', any()}. start_webserver(Port) when is_integer(Port) -> - application:load(percept), + ok = ensure_loaded(percept), case whereis(percept_httpd) of undefined -> {ok, Config} = get_webserver_config("percept", Port), - inets:start(), + ok = application:ensure_started(inets), case inets:start(httpd, Config) of {ok, Pid} -> AssignedPort = find_service_port_from_pid(inets:services_info(), Pid), @@ -217,9 +210,7 @@ stop_webserver(Port) -> do_stop(Port,[]). %%========================================================================== -%% -%% Auxiliary functions -%% +%% Auxiliary functions %%========================================================================== %% parse_and_insert @@ -337,3 +328,10 @@ get_webserver_config(Servername, Port) when is_list(Servername), is_integer(Port {bind_address, any}, {port, Port}], {ok, Config}. + +ensure_loaded(App) -> + case application:load(App) of + ok -> ok; + {error,{already_loaded,App}} -> ok; + Error -> Error + end. diff --git a/lib/percept/src/percept_db.erl b/lib/percept/src/percept_db.erl index 6c2dddccac..6cbe3ce022 100644 --- a/lib/percept/src/percept_db.erl +++ b/lib/percept/src/percept_db.erl @@ -24,21 +24,17 @@ -module(percept_db). --export([ - start/0, - stop/0, - insert/1, - select/2, - select/1, - consolidate/0 - ]). +-export([start/0, + stop/0, + insert/1, + select/2, + select/1, + consolidate/0]). -include("percept.hrl"). -define(STOP_TIMEOUT, 1000). %%========================================================================== -%% -%% Type definitions -%% +%% Type definitions %%========================================================================== %% @type activity_option() = @@ -64,9 +60,7 @@ %%========================================================================== -%% -%% Interface functions -%% +%% Interface functions %%========================================================================== %% @spec start() -> ok | {started, Pid} | {restarted, Pid} @@ -100,7 +94,7 @@ restart(PerceptDB)-> -spec do_start()-> pid(). do_start()-> - Pid = spawn( fun() -> init_percept_db() end), + Pid = spawn(fun() -> init_percept_db() end), erlang:register(percept_db, Pid), Pid. @@ -123,17 +117,17 @@ stop() -> %% @private %% @doc Stops the percept database, with a synchronous call. --spec stop_sync(pid())-> true. +-spec stop_sync(pid()) -> true. -stop_sync(Pid)-> +stop_sync(Pid) -> MonitorRef = erlang:monitor(process, Pid), - stop(), + _ = stop(), receive {'DOWN', MonitorRef, _Type, Pid, _Info}-> true after ?STOP_TIMEOUT-> - erlang:demonitor(MonitorRef, [flush]), - exit(Pid, kill) + erlang:demonitor(MonitorRef, [flush]), + exit(Pid, kill) end. %% @spec insert(tuple()) -> ok @@ -186,26 +180,24 @@ consolidate() -> ok. %%========================================================================== -%% -%% Database loop -%% +%% Database loop %%========================================================================== init_percept_db() -> % Proc and Port information - ets:new(pdb_info, [named_table, private, {keypos, #information.id}, set]), + pdb_info = ets:new(pdb_info, [named_table, private, {keypos, #information.id}, set]), % Scheduler runnability - ets:new(pdb_scheduler, [named_table, private, {keypos, #activity.timestamp}, ordered_set]), + pdb_scheduler = ets:new(pdb_scheduler, [named_table, private, {keypos, #activity.timestamp}, ordered_set]), % Process and Port runnability - ets:new(pdb_activity, [named_table, private, {keypos, #activity.timestamp}, ordered_set]), + pdb_activity = ets:new(pdb_activity, [named_table, private, {keypos, #activity.timestamp}, ordered_set]), % System status - ets:new(pdb_system, [named_table, private, {keypos, 1}, set]), + pdb_system = ets:new(pdb_system, [named_table, private, {keypos, 1}, set]), % System warnings - ets:new(pdb_warnings, [named_table, private, {keypos, 1}, ordered_set]), + pdb_warnings = ets:new(pdb_warnings, [named_table, private, {keypos, 1}, ordered_set]), put(debug, 0), loop_percept_db(). @@ -232,9 +224,7 @@ loop_percept_db() -> end. %%========================================================================== -%% -%% Auxiliary functions -%% +%% Auxiliary functions %%========================================================================== %% cleans trace messages from external pids @@ -788,5 +778,3 @@ update_system_stop_ts(TS) -> Unhandled -> io:format("update_system_stop_ts, unhandled ~p ~n", [Unhandled]) end. - - diff --git a/lib/percept/src/percept_graph.erl b/lib/percept/src/percept_graph.erl index 1803e035ab..e5bbaca2b4 100644 --- a/lib/percept/src/percept_graph.erl +++ b/lib/percept/src/percept_graph.erl @@ -33,28 +33,28 @@ %% graph(SessionID, Env, Input) -> - mod_esi:deliver(SessionID, header()), - mod_esi:deliver(SessionID, binary_to_list(graph(Env, Input))). + ok = mod_esi:deliver(SessionID, header()), + ok = mod_esi:deliver(SessionID, binary_to_list(graph(Env, Input))). %% activity %% @spec activity(SessionID, Env, Input) -> term() %% @doc An ESI callback implementation used by the httpd server. activity(SessionID, Env, Input) -> - mod_esi:deliver(SessionID, header()), - mod_esi:deliver(SessionID, binary_to_list(activity_bar(Env, Input))). + ok = mod_esi:deliver(SessionID, header()), + ok = mod_esi:deliver(SessionID, binary_to_list(activity_bar(Env, Input))). proc_lifetime(SessionID, Env, Input) -> - mod_esi:deliver(SessionID, header()), - mod_esi:deliver(SessionID, binary_to_list(proc_lifetime(Env, Input))). + ok = mod_esi:deliver(SessionID, header()), + ok = mod_esi:deliver(SessionID, binary_to_list(proc_lifetime(Env, Input))). percentage(SessionID, Env, Input) -> - mod_esi:deliver(SessionID, header()), - mod_esi:deliver(SessionID, binary_to_list(percentage(Env,Input))). + ok = mod_esi:deliver(SessionID, header()), + ok = mod_esi:deliver(SessionID, binary_to_list(percentage(Env,Input))). scheduler_graph(SessionID, Env, Input) -> - mod_esi:deliver(SessionID, header()), - mod_esi:deliver(SessionID, binary_to_list(scheduler_graph(Env, Input))). + ok = mod_esi:deliver(SessionID, header()), + ok = mod_esi:deliver(SessionID, binary_to_list(scheduler_graph(Env, Input))). graph(_Env, Input) -> Query = httpd:parse_query(Input), diff --git a/lib/percept/src/percept_html.erl b/lib/percept/src/percept_html.erl index a8eb29b741..a675227584 100644 --- a/lib/percept/src/percept_html.erl +++ b/lib/percept/src/percept_html.erl @@ -18,22 +18,18 @@ %% %CopyrightEnd% -module(percept_html). --export([ - page/3, - codelocation_page/3, - databases_page/3, - load_database_page/3, - processes_page/3, - concurrency_page/3, - process_info_page/3 - ]). - --export([ - value2pid/1, - pid2value/1, - get_option_value/2, - join_strings_with/2 - ]). +-export([page/3, + codelocation_page/3, + databases_page/3, + load_database_page/3, + processes_page/3, + concurrency_page/3, + process_info_page/3]). + +-export([value2pid/1, + pid2value/1, + get_option_value/2, + join_strings_with/2]). -include("percept.hrl"). -include_lib("kernel/include/file.hrl"). @@ -42,47 +38,47 @@ %% API page(SessionID, Env, Input) -> - mod_esi:deliver(SessionID, header()), - mod_esi:deliver(SessionID, menu()), - mod_esi:deliver(SessionID, overview_content(Env, Input)), - mod_esi:deliver(SessionID, footer()). + ok = mod_esi:deliver(SessionID, header()), + ok = mod_esi:deliver(SessionID, menu()), + ok = mod_esi:deliver(SessionID, overview_content(Env, Input)), + ok = mod_esi:deliver(SessionID, footer()). processes_page(SessionID, _, _) -> - mod_esi:deliver(SessionID, header()), - mod_esi:deliver(SessionID, menu()), - mod_esi:deliver(SessionID, processes_content()), - mod_esi:deliver(SessionID, footer()). + ok = mod_esi:deliver(SessionID, header()), + ok = mod_esi:deliver(SessionID, menu()), + ok = mod_esi:deliver(SessionID, processes_content()), + ok = mod_esi:deliver(SessionID, footer()). concurrency_page(SessionID, Env, Input) -> - mod_esi:deliver(SessionID, header()), - mod_esi:deliver(SessionID, menu()), - mod_esi:deliver(SessionID, concurrency_content(Env, Input)), - mod_esi:deliver(SessionID, footer()). + ok = mod_esi:deliver(SessionID, header()), + ok = mod_esi:deliver(SessionID, menu()), + ok = mod_esi:deliver(SessionID, concurrency_content(Env, Input)), + ok = mod_esi:deliver(SessionID, footer()). databases_page(SessionID, _, _) -> - mod_esi:deliver(SessionID, header()), - mod_esi:deliver(SessionID, menu()), - mod_esi:deliver(SessionID, databases_content()), - mod_esi:deliver(SessionID, footer()). + ok = mod_esi:deliver(SessionID, header()), + ok = mod_esi:deliver(SessionID, menu()), + ok = mod_esi:deliver(SessionID, databases_content()), + ok = mod_esi:deliver(SessionID, footer()). codelocation_page(SessionID, Env, Input) -> - mod_esi:deliver(SessionID, header()), - mod_esi:deliver(SessionID, menu()), - mod_esi:deliver(SessionID, codelocation_content(Env, Input)), - mod_esi:deliver(SessionID, footer()). + ok = mod_esi:deliver(SessionID, header()), + ok = mod_esi:deliver(SessionID, menu()), + ok = mod_esi:deliver(SessionID, codelocation_content(Env, Input)), + ok = mod_esi:deliver(SessionID, footer()). process_info_page(SessionID, Env, Input) -> - mod_esi:deliver(SessionID, header()), - mod_esi:deliver(SessionID, menu()), - mod_esi:deliver(SessionID, process_info_content(Env, Input)), - mod_esi:deliver(SessionID, footer()). + ok = mod_esi:deliver(SessionID, header()), + ok = mod_esi:deliver(SessionID, menu()), + ok = mod_esi:deliver(SessionID, process_info_content(Env, Input)), + ok = mod_esi:deliver(SessionID, footer()). load_database_page(SessionID, Env, Input) -> - mod_esi:deliver(SessionID, header()), + ok = mod_esi:deliver(SessionID, header()), % Very dynamic page, handled differently load_database_content(SessionID, Env, Input), - mod_esi:deliver(SessionID, footer()). + ok = mod_esi:deliver(SessionID, footer()). %%% --------------------------- %%% @@ -446,24 +442,24 @@ load_database_content(SessionId, _Env, Input) -> Filename = filename:join(Path, File), % Check path/file/filename - mod_esi:deliver(SessionId, "<div id=\"content\">"), + ok = mod_esi:deliver(SessionId, "<div id=\"content\">"), case file:read_file_info(Filename) of {ok, _} -> Content = "<center> Parsing: " ++ Filename ++ "<br> </center>", - mod_esi:deliver(SessionId, Content), - case percept:analyze(Filename) of - {error, Reason} -> - mod_esi:deliver(SessionId, error_msg("Analyze" ++ term2html(Reason))); - _ -> - Complete = "<center><a href=\"/cgi-bin/percept_html/page\">View</a></center>", - mod_esi:deliver(SessionId, Complete) - end; + ok = mod_esi:deliver(SessionId, Content), + case percept:analyze(Filename) of + {error, Reason} -> + ok = mod_esi:deliver(SessionId, error_msg("Analyze" ++ term2html(Reason))); + _ -> + Complete = "<center><a href=\"/cgi-bin/percept_html/page\">View</a></center>", + ok = mod_esi:deliver(SessionId, Complete) + end; {error, Reason} -> - mod_esi:deliver(SessionId, error_msg("File" ++ term2html(Reason))) + ok = mod_esi:deliver(SessionId, error_msg("File" ++ term2html(Reason))) end, - mod_esi:deliver(SessionId, "</div>"). + ok = mod_esi:deliver(SessionId, "</div>"). codelocation_content(_Env, Input) -> Query = httpd:parse_query(Input), diff --git a/lib/runtime_tools/c_src/trace_ip_drv.c b/lib/runtime_tools/c_src/trace_ip_drv.c index c73630f702..195558f958 100644 --- a/lib/runtime_tools/c_src/trace_ip_drv.c +++ b/lib/runtime_tools/c_src/trace_ip_drv.c @@ -374,6 +374,7 @@ static void trace_ip_output(ErlDrvData handle, char *buff, ErlDrvSizeT bufflen) } return; } + ASSERT(!IS_INVALID_SOCKET(data->fd)); if (data->que[data->questart] != NULL) { trace_ip_ready_output(handle, sock2event(data->fd)); } @@ -412,6 +413,7 @@ static void trace_ip_ready_input(ErlDrvData handle, ErlDrvEvent fd) /* ** Maybe accept, we are a listen port... */ + ASSERT(IS_INVALID_SOCKET(data->fd)); if (!IS_INVALID_SOCKET((client = my_accept(data->listenfd)))) { data->fd = client; set_nonblocking(client); @@ -735,6 +737,7 @@ static void close_client(TraceIpData *data) { my_driver_select(data, data->fd, FLAG_WRITE | FLAG_READ, SELECT_CLOSE); data->flags |= FLAG_LISTEN_PORT; + data->fd = INVALID_SOCKET; if (!(data->flags & FLAG_FILL_ALWAYS)) { clean_que(data); } diff --git a/lib/runtime_tools/doc/src/dbg.xml b/lib/runtime_tools/doc/src/dbg.xml index 103b8b52e9..49b11ddc3c 100644 --- a/lib/runtime_tools/doc/src/dbg.xml +++ b/lib/runtime_tools/doc/src/dbg.xml @@ -439,6 +439,50 @@ Error: fun containing local erlang function calls ('is_atomm' called in guard)\ global calls (and functions).</p> </desc> </func> + + + <func> + <name>tpe(Event, MatchSpec) -> {ok, MatchDesc} | {error, term()}</name> + <fsummary>Set pattern for traced event</fsummary> + <type> + <v>Event = send | 'receive'</v> + <v>MatchSpec = integer() | Built-inAlias | [] | match_spec()</v> + <v>Built-inAlias = x | c | cx</v> + <v>MatchDesc = [MatchInfo]</v> + <v>MatchInfo = {saved, integer()} | MatchNum</v> + <v>MatchNum = {matched, node(), 1} | {matched, node(), 0, RPCError}</v> + </type> + <desc> + <p>This function associates a match specification with trace event + <c>send</c> or <c>'receive'</c>. By default all executed <c>send</c> + and <c>'receive'</c> events are traced if enabled for a process. + A match specification can be used to filter traced events + based on sender, receiver and/or message content.</p> + <p>For a description of the <c>match_spec()</c> syntax, + please turn to the <em>User's guide</em> part of the online + documentation for the runtime system (<em>erts</em>). The + chapter <seealso marker="erts:match_spec"><em>Match Specifications in Erlang</em></seealso> + explains the general match specification "language".</p> + <p>For <c>send</c>, the matching is done on the list <c>[Receiver, Msg]</c>. + <c>Receiver</c> is the process or port identity of the receiver and + <c>Msg</c> is the message term. The pid of the sending process can be + accessed with the guard function <c>self/0</c>.</p> + <p>For <c>'receive'</c>, the matching is done on the list <c>[Node, Sender, Msg]</c>. + <c>Node</c> is the node name of the sender. <c>Sender</c> is the + process or port identity of the sender, or the atom + <c>undefined</c> if the sender is not known (which may + be the case for remote senders). <c>Msg</c> is the + message term. The pid of the receiving process can be + accessed with the guard function <c>self/0</c>.</p> + <p>All nodes added with <seealso marker="#n-1"><c>n/1</c></seealso> or + <seealso marker="#tracer-3"><c>tracer/3</c></seealso> will + be affected by this call.</p> + <p>The return value is the same as for + <seealso marker="#tp-2"><c>tp/2</c></seealso>. The number of matched + events are never larger than 1 as <c>tpe/2</c> does not + accept any form of wildcards for argument <c>Event</c>.</p> + </desc> + </func> <func> <name>ctp()</name> <fsummary>Clear call trace pattern for the specified functions</fsummary> @@ -563,6 +607,22 @@ Error: fun containing local erlang function calls ('is_atomm' called in guard)\ </desc> </func> <func> + <name>ctpe(Event) -> {ok, MatchDesc} | {error, term()}</name> + <fsummary>Clear trace pattern for the specified event</fsummary> + <type> + <v>Event = send | 'receive'</v> + <v>MatchDesc = [MatchNum]</v> + <v>MatchNum = {matched, node(), 1} | {matched, node(), 0, RPCError}</v> + </type> + <desc> + <p>This function clears match specifications for the specified + trace event (<c>send</c> or <c>'receive'</c>). It will revert back + to the default behavior of tracing all triggered events.</p> + <p>The return value follow the same style as for + <seealso marker="#ctp-1"><c>ctp/1</c></seealso>.</p> + </desc> + </func> + <func> <name>ltp() -> ok</name> <fsummary>List saved and built-in match specifications on the console.</fsummary> <desc> diff --git a/lib/stdlib/doc/src/digraph.xml b/lib/stdlib/doc/src/digraph.xml index 16dd789caf..1bb8eef247 100644 --- a/lib/stdlib/doc/src/digraph.xml +++ b/lib/stdlib/doc/src/digraph.xml @@ -104,14 +104,12 @@ </datatype> <datatype> <name>edge()</name> - <desc><p><marker id="type-edge"/></p></desc> </datatype> <datatype> <name name="label"/> </datatype> <datatype> <name>vertex()</name> - <desc><p><marker id="type-vertex"/></p></desc> </datatype> </datatypes> <funcs> diff --git a/lib/stdlib/doc/src/digraph_utils.xml b/lib/stdlib/doc/src/digraph_utils.xml index 9bddee546f..e481711c50 100644 --- a/lib/stdlib/doc/src/digraph_utils.xml +++ b/lib/stdlib/doc/src/digraph_utils.xml @@ -120,13 +120,6 @@ considering all edges undirected.</p> </description> - <datatypes> - <datatype> - <name>digraph()</name> - <desc><p><marker id="type-digraph"/> - A digraph as returned by <c>digraph:new/0,1</c>.</p></desc> - </datatype> - </datatypes> <funcs> <func> <name name="arborescence_root" arity="1"/> diff --git a/lib/stdlib/doc/src/erl_anno.xml b/lib/stdlib/doc/src/erl_anno.xml index ddc8b8c765..9f775943c1 100644 --- a/lib/stdlib/doc/src/erl_anno.xml +++ b/lib/stdlib/doc/src/erl_anno.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>2015</year> - <year>2015</year> + <year>2016</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> @@ -103,7 +103,7 @@ <datatypes> <datatype> <name>anno()</name> - <desc><p><marker id="type-anno"/>A collection of annotations.</p> + <desc><p>A collection of annotations.</p> </desc> </datatype> <datatype> diff --git a/lib/stdlib/doc/src/erl_parse.xml b/lib/stdlib/doc/src/erl_parse.xml index 13be488c33..32fce16d68 100644 --- a/lib/stdlib/doc/src/erl_parse.xml +++ b/lib/stdlib/doc/src/erl_parse.xml @@ -45,26 +45,22 @@ <datatypes> <datatype> <name>abstract_clause()</name> - <desc><p><marker id="type-abstract_clause"/> - Abstract form of an Erlang clause.</p> + <desc><p>Abstract form of an Erlang clause.</p> </desc> </datatype> <datatype> <name>abstract_expr()</name> - <desc><p><marker id="type-abstract_expr"/> - Abstract form of an Erlang expression.</p> + <desc><p>Abstract form of an Erlang expression.</p> </desc> </datatype> <datatype> <name>abstract_form()</name> - <desc><p><marker id="type-abstract_form"/> - Abstract form of an Erlang form.</p> + <desc><p>Abstract form of an Erlang form.</p> </desc> </datatype> <datatype> <name>abstract_type()</name> - <desc><p><marker id="type-abstract_type"/> - Abstract form of an Erlang type.</p> + <desc><p>Abstract form of an Erlang type.</p> </desc> </datatype> <datatype> diff --git a/lib/stdlib/doc/src/ets.xml b/lib/stdlib/doc/src/ets.xml index 2d69c201bc..ad7591e214 100644 --- a/lib/stdlib/doc/src/ets.xml +++ b/lib/stdlib/doc/src/ets.xml @@ -123,8 +123,9 @@ <p>Some of the functions uses a <em>match specification</em>, match_spec. A brief explanation is given in <seealso marker="#select/2">select/2</seealso>. For a detailed - description, see the chapter "Match specifications in Erlang" in - <em>ERTS User's Guide</em>.</p> + description, see chapter + <seealso marker="erts:match_spec">Match Specifications in Erlang</seealso> + in <em>ERTS User's Guide</em>.</p> </section> <datatypes> @@ -134,8 +135,7 @@ <datatype> <name>continuation()</name> <desc> - <p><marker id="type-continuation"/> - Opaque continuation used by <seealso marker="#select/1"> + <p>Opaque continuation used by <seealso marker="#select/1"> <c>select/1,3</c></seealso>, <seealso marker="#select_reverse/1"> <c>select_reverse/1,3</c></seealso>, <seealso marker="#match/1"> diff --git a/lib/stdlib/doc/src/sofs.xml b/lib/stdlib/doc/src/sofs.xml index cf0855bc85..1e5be367bd 100644 --- a/lib/stdlib/doc/src/sofs.xml +++ b/lib/stdlib/doc/src/sofs.xml @@ -399,8 +399,7 @@ fun(S) -> sofs:partition(1, S) end <datatype> <!-- Parameterized opaque types are NYI: --> <name>tuple_of(T)</name> - <desc><p><marker id="type-tuple_of"/> - A tuple where the elements are of type <c>T</c>.</p></desc> + <desc><p>A tuple where the elements are of type <c>T</c>.</p></desc> </datatype> </datatypes> <funcs> diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el index 0a3fc0ddff..4f656e3ae4 100644 --- a/lib/tools/emacs/erlang.el +++ b/lib/tools/emacs/erlang.el @@ -2970,8 +2970,9 @@ Return nil if inside string, t if in a comment." (current-column))) ;; Type and Spec indentation ((eq (car stack-top) '::) - (if (looking-at "}") - ;; Closing record definition with types + (if (looking-at "[},)]") + ;; Closing function spec, record definition with types, + ;; or a comma at the start of the line ;; pop stack and recurse (erlang-calculate-stack-indent indent-point (cons (erlang-pop stack) (cdr state))) diff --git a/lib/tools/emacs/test.erl.indented b/lib/tools/emacs/test.erl.indented index 6913068133..7a1ff6a954 100644 --- a/lib/tools/emacs/test.erl.indented +++ b/lib/tools/emacs/test.erl.indented @@ -70,6 +70,9 @@ foo() -> 234, d}). +-record(record5, { a = 1 :: integer() + , b = foobar :: atom() + }). -define(MACRO_1, macro). -define(MACRO_2(_), macro). @@ -144,6 +147,12 @@ foo() -> -type t25() :: #rec3{f123 :: [t24() | 1|2|3|4|a|b|c|d| nonempty_maybe_improper_list(integer, any())]}. +-type t26() :: #rec4{ a :: integer() + , b :: any() + }. +-type t27() :: { integer() + , atom() + }. -type t99() :: {t2(),t4(),t5(),t6(),t7(),t8(),t10(),t14(), t15(),t20(),t21(), t22(),t25()}. @@ -179,6 +188,10 @@ foo() -> | {'error', {'no_process', term()} | {'no_such_group', term()}}. +-spec add( X :: integer() + , Y :: integer() + ) -> integer(). + -opaque attributes_data() :: [{'column', column()} | {'line', info_line()} | {'text', string()}] | {line(),column()}. diff --git a/lib/tools/emacs/test.erl.orig b/lib/tools/emacs/test.erl.orig index 621948cbe1..2552c71baf 100644 --- a/lib/tools/emacs/test.erl.orig +++ b/lib/tools/emacs/test.erl.orig @@ -70,6 +70,9 @@ foo() -> 234, d}). +-record(record5, { a = 1 :: integer() +, b = foobar :: atom() +}). -define(MACRO_1, macro). -define(MACRO_2(_), macro). @@ -144,6 +147,12 @@ nonempty_maybe_improper_list('integer', any())| -type t25() :: #rec3{f123 :: [t24() | 1|2|3|4|a|b|c|d| nonempty_maybe_improper_list(integer, any())]}. +-type t26() :: #rec4{ a :: integer() +, b :: any() +}. +-type t27() :: { integer() +, atom() +}. -type t99() :: {t2(),t4(),t5(),t6(),t7(),t8(),t10(),t14(), t15(),t20(),t21(), t22(),t25()}. @@ -179,6 +188,10 @@ t15(),t20(),t21(), t22(),t25()}. | {'error', {'no_process', term()} | {'no_such_group', term()}}. +-spec add( X :: integer() +, Y :: integer() +) -> integer(). + -opaque attributes_data() :: [{'column', column()} | {'line', info_line()} | {'text', string()}] | {line(),column()}. diff --git a/lib/wx/api_gen/gl_gen.erl b/lib/wx/api_gen/gl_gen.erl index 0473b7d771..54635bdd2e 100644 --- a/lib/wx/api_gen/gl_gen.erl +++ b/lib/wx/api_gen/gl_gen.erl @@ -191,8 +191,9 @@ parse_define([#xmlElement{name=initializer,content=Contents}|_R],Def,_Os) -> try case Val0 of "0x" ++ Val1 -> - _ = list_to_integer(Val1, 16), - Def#def{val=Val1, type=hex}; + Val2 = strip_type_cast(Val1), + _ = list_to_integer(Val2, 16), + Def#def{val=Val2, type=hex}; _ -> Val = list_to_integer(Val0), Def#def{val=Val, type=int} @@ -214,6 +215,15 @@ extract_def2([#xmlElement{content=Cs}|R]) -> extract_def2(Cs) ++ extract_def2(R); extract_def2([]) -> []. +strip_type_cast(Int) -> + lists:reverse(strip_type_cast2(lists:reverse(Int))). + +strip_type_cast2("u"++Rest) -> Rest; %% unsigned +strip_type_cast2("lu"++Rest) -> Rest; %% unsigned long +strip_type_cast2("llu"++Rest) -> Rest; %% unsigned long long +strip_type_cast2(Rest) -> Rest. + + strip_comment("/*" ++ Rest) -> strip_comment_until_end(Rest); strip_comment("//" ++ _) -> []; diff --git a/lib/wx/c_src/wxe_helpers.cpp b/lib/wx/c_src/wxe_helpers.cpp index 4798e605e8..d1f607d2af 100644 --- a/lib/wx/c_src/wxe_helpers.cpp +++ b/lib/wx/c_src/wxe_helpers.cpp @@ -48,7 +48,7 @@ void wxeCommand::Delete() driver_free(buffer); buffer = NULL; } - op = -1; + op = -2; } /* **************************************************************************** @@ -84,7 +84,7 @@ wxeCommand * wxeFifo::Get() pos = m_first++; m_n--; m_first %= m_max; - } while(m_q[pos].op == -1); + } while(m_q[pos].op < 0); return &m_q[pos]; } @@ -96,7 +96,7 @@ wxeCommand * wxeFifo::Peek(unsigned int *i) return NULL; pos = (m_first+*i) % m_max; (*i)++; - } while(m_q[pos].op == -1); + } while(m_q[pos].op < 0); return &m_q[pos]; } @@ -213,7 +213,7 @@ void wxeFifo::Realloc() // Strip end of queue if ops are already taken care of, avoids reallocs void wxeFifo::Strip() { - while((m_n > 0) && (m_q[(m_first + m_n - 1)%m_max].op == -1)) { + while((m_n > 0) && (m_q[(m_first + m_n - 1)%m_max].op < -1)) { m_n--; } } diff --git a/lib/wx/include/gl.hrl b/lib/wx/include/gl.hrl index 39cd474fcb..d708515e1b 100644 --- a/lib/wx/include/gl.hrl +++ b/lib/wx/include/gl.hrl @@ -1723,7 +1723,7 @@ -define(GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER, 16#8A44). -define(GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER, 16#8A45). -define(GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER, 16#8A46). --define(GL_INVALID_INDEX, 16#FFFFFFFFu). +-define(GL_INVALID_INDEX, 16#FFFFFFFF). -define(GL_COPY_READ_BUFFER, 16#8F36). -define(GL_COPY_WRITE_BUFFER, 16#8F37). -define(GL_DEPTH_CLAMP, 16#864F). @@ -1746,7 +1746,7 @@ -define(GL_CONDITION_SATISFIED, 16#911C). -define(GL_WAIT_FAILED, 16#911D). -define(GL_SYNC_FLUSH_COMMANDS_BIT, 16#00000001). --define(GL_TIMEOUT_IGNORED, 16#FFFFFFFFFFFFFFFFull). +-define(GL_TIMEOUT_IGNORED, 16#FFFFFFFFFFFFFFFF). -define(GL_SAMPLE_POSITION, 16#8E50). -define(GL_SAMPLE_MASK, 16#8E51). -define(GL_SAMPLE_MASK_VALUE, 16#8E52). diff --git a/lib/wx/test/wx_class_SUITE.erl b/lib/wx/test/wx_class_SUITE.erl index 6944a78360..0a3c4659bf 100644 --- a/lib/wx/test/wx_class_SUITE.erl +++ b/lib/wx/test/wx_class_SUITE.erl @@ -646,8 +646,8 @@ modal(Config) -> %% need to sleep so we know that the window is stuck in %% the ShowModal event loop and not in an earlier event loop %% wx2.8 invokes the event loop from more calls than wx-3 - receive {dialog, M1, 1} -> timer:sleep(1200), ets:insert(test_state, {M1, ready}) end, - receive {dialog, M2, 2} -> timer:sleep(1200), ets:insert(test_state, {M2, ready}) end, + M1 = receive {dialog, W1, 1} -> timer:sleep(1200), ets:insert(test_state, {W1, ready}), W1 end, + M2 = receive {dialog, W2, 2} -> timer:sleep(1200), ets:insert(test_state, {W2, ready}), W2 end, receive done -> ok end, receive {dialog_done, M2, 2} -> M2 end, diff --git a/lib/xmerl/src/xmerl_eventp.erl b/lib/xmerl/src/xmerl_eventp.erl index 598d26261d..2cb76abc6e 100644 --- a/lib/xmerl/src/xmerl_eventp.erl +++ b/lib/xmerl/src/xmerl_eventp.erl @@ -199,7 +199,7 @@ cont2(F, Exception, Sofar, Fd, Fname, T, S) -> find_good_split(list_to_binary([Sofar,Bin]), F,Exception,Fd,Fname,T,S); eof -> - file:close(Fd), + ok = file:close(Fd), NewS = xmerl_scan:cont_state([{Fname, eof}|T], S), F(binary_to_list(Sofar), NewS); Error -> @@ -319,7 +319,7 @@ close(S) -> [{_Fname, eof}|T] -> xmerl_scan:cont_state(T, S); [{_Sofar, _Fname, Fd}|T] -> - file:close(Fd), + ok = file:close(Fd), xmerl_scan:cont_state(T, S) end. diff --git a/lib/xmerl/src/xmerl_sax_parser.erl b/lib/xmerl/src/xmerl_sax_parser.erl index 196baacda7..318a0cf7f4 100644 --- a/lib/xmerl/src/xmerl_sax_parser.erl +++ b/lib/xmerl/src/xmerl_sax_parser.erl @@ -32,17 +32,13 @@ %%---------------------------------------------------------------------- %% External exports %%---------------------------------------------------------------------- --export([ - file/2, - stream/2 - ]). +-export([file/2, + stream/2]). %%---------------------------------------------------------------------- %% Internal exports %%---------------------------------------------------------------------- --export([ - default_continuation_cb/1 - ]). +-export([default_continuation_cb/1]). %%---------------------------------------------------------------------- %% Macros @@ -81,7 +77,7 @@ file(Name,Options) -> {current_location, CL}, {entity, File} |Options]), - file:close(FD), + ok = file:close(FD), Res end. diff --git a/lib/xmerl/src/xmerl_sax_parser_base.erlsrc b/lib/xmerl/src/xmerl_sax_parser_base.erlsrc index 200770a7cf..4d75805b9b 100644 --- a/lib/xmerl/src/xmerl_sax_parser_base.erlsrc +++ b/lib/xmerl/src/xmerl_sax_parser_base.erlsrc @@ -29,12 +29,10 @@ %%---------------------------------------------------------------------- %% External exports %%---------------------------------------------------------------------- --export([ - parse/2, +-export([parse/2, parse_dtd/2, is_name_char/1, - is_name_start/1 - ]). + is_name_start/1]). %%---------------------------------------------------------------------- %% Internal exports @@ -1681,7 +1679,7 @@ handle_external_entity({file, FileToOpen}, State) -> current_location=filename:dirname(FileToOpen), entity=filename:basename(FileToOpen), input_type=file}), - file:close(FD), + ok = file:close(FD), EntityState#xmerl_sax_parser_state.event_state end; handle_external_entity({http, Url}, State) -> @@ -1700,8 +1698,8 @@ handle_external_entity({http, Url}, State) -> current_location=filename:dirname(Url), entity=filename:basename(Url), input_type=file}), - file:close(FD), - file:delete(TmpFile), + ok = file:close(FD), + ok = file:delete(TmpFile), EntityState#xmerl_sax_parser_state.event_state end catch @@ -3471,17 +3469,17 @@ http_get_file(Host, Port, Key) -> receive_msg(Socket, FD, true, SendTimeout) catch throw:{error, Error} -> - file:close(FD), - file:delete(Filename), + ok = file:close(FD), + ok = file:delete(Filename), throw({error, Error}) end; {error, _Reason} -> - file:close(FD), - file:delete(Filename), + ok = file:close(FD), + ok = file:delete(Filename), throw({error, lists:flatten(io_lib:format("Couldn't fetch http://~s:~p/~s", [Host, Port, Key]))}) end, - file:close(FD), + ok = file:close(FD), Filename. %%---------------------------------------------------------------------- @@ -3498,11 +3496,11 @@ receive_msg(Socket, FD, WaitForHeader, Timeout) -> {tcp_closed, Socket} -> ok; {tcp, Socket, Response} when WaitForHeader == false -> - file:write(FD, Response), + ok = file:write(FD, Response), receive_msg(Socket, FD, WaitForHeader, Timeout); {tcp, Socket, Response} -> MsgBody = remove_header(Response), - file:write(FD, MsgBody), + ok = file:write(FD, MsgBody), receive_msg(Socket, FD, false, Timeout); {tcp_error, Socket, _Reason} -> gen_tcp:close(Socket), diff --git a/lib/xmerl/src/xmerl_scan.erl b/lib/xmerl/src/xmerl_scan.erl index ea487a0900..2147a46a13 100644 --- a/lib/xmerl/src/xmerl_scan.erl +++ b/lib/xmerl/src/xmerl_scan.erl @@ -605,7 +605,7 @@ scan_document(Str0, S=#xmerl_scanner{event_fun = Event, schema -> case schemaLocations(Res, S5) of {ok, Schemas} -> - cleanup(S5), + _ = cleanup(S5), %%?dbg("Schemas: ~p~nRes: ~p~ninhertih_options(S): ~p~n", %% [Schemas,Res,inherit_options(S5)]), XSDRes = xmerl_xsd:process_validate(Schemas, Res, diff --git a/lib/xmerl/src/xmerl_xsd.erl b/lib/xmerl/src/xmerl_xsd.erl index 412ef59e41..d97913ecbc 100644 --- a/lib/xmerl/src/xmerl_xsd.erl +++ b/lib/xmerl/src/xmerl_xsd.erl @@ -64,12 +64,10 @@ %%---------------------------------------------------------------------- %% External exports %%---------------------------------------------------------------------- --export([ - validate/2,validate/3,process_validate/2,process_validate/3, +-export([validate/2,validate/3,process_validate/2,process_validate/3, process_schema/1,process_schema/2, process_schemas/1,process_schemas/2, - state2file/1,state2file/2,file2state/1,format_error/1 - ]). + state2file/1,state2file/2,file2state/1,format_error/1]). %%---------------------------------------------------------------------- %% Internal exports @@ -1178,7 +1176,7 @@ rename_redef_group(Name={LN,Scope,NS},S) -> NewName = {LN,['#redefine'|Scope],NS}, case resolve({group,NewName},S) of {SG=#schema_group{name=Name},_} -> - save_object({group,SG#schema_group{name=NewName}},S), + _ = save_object({group,SG#schema_group{name=NewName}},S), NewName; _ -> failed @@ -3436,7 +3434,7 @@ check_keys([Key=#id_constraint{selector={selector,SelectorPath}, {L,S1} when length(L)==length(TargetNodeSet) -> %% Part1: 3.11.4.4.2.1 S2 = key_sequence_uniqueness(L,XMLEl,S1), - save_key(Key#id_constraint{key_sequence=L},S2), + _ = save_key(Key#id_constraint{key_sequence=L},S2), S2; {Err,S1} -> acc_errs(S1,{error_path(XMLEl,XMLEl#xmlElement.name),?MODULE, @@ -4014,7 +4012,7 @@ merge_derived_types(XSDType,InstType,Blocks,Mode,S) -> {error,S2} -> {InstType,S2}; {MergedType,S2} -> - save_merged_type(MergedType,S2), + _ = save_merged_type(MergedType,S2), {MergedType,S2} end. @@ -4970,7 +4968,7 @@ save_schema_element(CM,S=#xsd_state{elementFormDefault = EFD, undefined -> []; _ -> TN end, - save_in_table({schema,TN2},Schema2,S), + _ = save_in_table({schema,TN2},Schema2,S), save_to_file(S). %% other_global_elements(S,ElementList) -> @@ -5006,13 +5004,13 @@ save_to_file(S=#xsd_state{tab2file=TF}) -> {ok,IO}=file:open(filename:rootname(S#xsd_state.schema_name)++".tab", [write]), io:format(IO,"~p~n",[catch ets:tab2list(S#xsd_state.table)]), - file:close(IO); + ok = file:close(IO); false -> ok; IOFile -> {ok,IO}=file:open(IOFile,[write]), io:format(IO,"~p~n",[catch ets:tab2list(S#xsd_state.table)]), - file:close(IO) + ok = file:close(IO) end. save_merged_type(Type=#schema_simple_type{},S) -> @@ -5034,25 +5032,25 @@ save_idc(unique,IDConstr,S) -> save_unique(IDConstr,S). save_key(Key,S) -> - save_object({key,Key},S), + _ = save_object({key,Key},S), S. save_keyref(KeyRef=#id_constraint{category=keyref},S) -> S1 = add_keyref(KeyRef,S), - save_object({keyref,KeyRef},S1), + _ = save_object({keyref,KeyRef},S1), S1; save_keyref(_,S) -> S. save_unique(Unique,S) -> - save_object({unique,Unique},S), + _ = save_object({unique,Unique},S), S. save_substitutionGroup([],S) -> S; save_substitutionGroup([{Head,Members}|SGs],S) -> %% save {head,[members]} - save_in_table({substitutionGroup,Head},Members,S), + _ = save_in_table({substitutionGroup,Head},Members,S), %% save {member,head}, an element can only be a member in one %% substitutionGroup lists:foreach(fun(X)->save_in_table({substitutionGroup_member,X},Head,S) end,Members), diff --git a/lib/xmerl/src/xmerl_xsd_type.erl b/lib/xmerl/src/xmerl_xsd_type.erl index 14a673b0c0..3ee5961522 100644 --- a/lib/xmerl/src/xmerl_xsd_type.erl +++ b/lib/xmerl/src/xmerl_xsd_type.erl @@ -229,11 +229,13 @@ check_float(Value) -> %% {Mantissa,Exponent}=lists:splitwith(Pred,Value), %% SkipEe = fun([]) -> [];(L) -> tl(L) end, case string:tokens(Value,"eE") of - [Mantissa,Exponent] -> - {ok,_} = check_decimal(Mantissa), - {ok,_} = check_integer(Exponent); - [Mantissa] -> - check_decimal(Mantissa) + [Mantissa,Exponent] -> + {ok,_} = check_decimal(Mantissa), + {ok,_} = check_integer(Exponent), + ok; + [Mantissa] -> + {ok,_} = check_decimal(Mantissa), + ok end, {ok,Value}. %% case {check_decimal(Mantissa), @@ -367,7 +369,7 @@ check_dateTime("+"++_DateTime) -> check_dateTime(DateTime) -> [Date,Time] = string:tokens(DateTime,"T"), [Y,M,D] = string:tokens(Date,"-"), - check_year(Y), + {ok,_} = check_year(Y), {ok,_} = check_positive_integer(M), {ok,_} = check_positive_integer(D), check_time(Time). |