Skip to content

Commit

Permalink
Merge pull request #9301 from richcarl/deprecate-old-catch-rc
Browse files Browse the repository at this point in the history
Deprecate old catches in edoc, eunit, and syntax_tools
  • Loading branch information
bjorng authored Jan 23, 2025
2 parents d15be5e + 3e204d9 commit 1b95331
Show file tree
Hide file tree
Showing 20 changed files with 39 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/edoc/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RELSYSDIR = $(RELEASE_PATH)/lib/edoc-$(VSN)

EBIN = ../ebin
XMERL = ../../xmerl
ERL_COMPILE_FLAGS += -pa $(XMERL) -I../include -I$(XMERL)/include +warn_unused_vars +nowarn_shadow_vars +warn_unused_import +warn_deprecated_guard +no_docs +nowarn_missing_spec_documented
ERL_COMPILE_FLAGS += -pa $(XMERL) -I../include -I$(XMERL)/include +warn_unused_vars +nowarn_shadow_vars +warn_unused_import +warn_deprecated_guard +no_docs +nowarn_missing_spec_documented +warn_deprecated_catch -Werror

include files.mk

Expand Down
2 changes: 2 additions & 0 deletions lib/edoc/src/edoc_data.erl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

-module(edoc_data).

-compile(nowarn_deprecated_catch).

-export([module/4, overview/4, type/3]).

-export([hidden_filter/2, get_all_tags/1, get_entry/2, get_tags/2]).
Expand Down
2 changes: 2 additions & 0 deletions lib/edoc/src/edoc_doclet.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

-module(edoc_doclet).

-compile(nowarn_deprecated_catch).

-export([run/2]).

-import(edoc_report, [report/2, warning/2]).
Expand Down
2 changes: 2 additions & 0 deletions lib/edoc/src/edoc_extract.erl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

-module(edoc_extract).

-compile(nowarn_deprecated_catch).

-export([source/3, source/4, source/5,
header/3, header/4, header/5,
file/4,
Expand Down
2 changes: 2 additions & 0 deletions lib/edoc/src/edoc_html_to_markdown.erl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

-include_lib("kernel/include/eep48.hrl").

-compile(nowarn_deprecated_catch).

-export([convert_html/2, convert_xml/2, convert_html/3, convert_xml/3]).

%% @doc
Expand Down
2 changes: 2 additions & 0 deletions lib/edoc/src/edoc_layout_chunks.erl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
%% @end
-module(edoc_layout_chunks).

-compile(nowarn_deprecated_catch).

% -behaviour(edoc_layout).
-export([module/2, overview/2]).

Expand Down
2 changes: 2 additions & 0 deletions lib/edoc/src/edoc_lib.erl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

-module(edoc_lib).

-compile(nowarn_deprecated_catch).

-export([count/2, lines/1, split_at/2, split_at_stop/1,
split_at_space/1, filename/1, transpose/1, segment/2,
get_first_sentence/1, is_space/1, strip_space/1, parse_expr/2,
Expand Down
2 changes: 2 additions & 0 deletions lib/edoc/src/edoc_macros.erl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

-module(edoc_macros).

-compile(nowarn_deprecated_catch).

-export([expand_tags/3, std_macros/1, check_defs/1]).

-include("edoc.hrl").
Expand Down
2 changes: 2 additions & 0 deletions lib/edoc/src/edoc_run.erl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@

-module(edoc_run).

-compile(nowarn_deprecated_catch).

-export([file/1, application/1, files/1, toc/1]).

-compile({no_auto_import,[error/1]}).
Expand Down
2 changes: 2 additions & 0 deletions lib/edoc/src/edoc_scanner.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
%% `tokens' function *always* returns `{more, Continuation}' unless an
%% error occurs.

-compile(nowarn_deprecated_catch).

-export([string/1,string/2,format_error/1]).

-import(lists, [reverse/1]).
Expand Down
2 changes: 2 additions & 0 deletions lib/edoc/src/edoc_tags.erl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

-module(edoc_tags).

-compile(nowarn_deprecated_catch).

-export([tags/0, tags/1, tag_names/0, tag_parsers/0, scan_lines/2,
filter_tags/2, filter_tags/3, check_tags/4, parse_tags/4,
check_types/3]).
Expand Down
2 changes: 2 additions & 0 deletions lib/edoc/src/edoc_wiki.erl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@

-module(edoc_wiki).

-compile(nowarn_deprecated_catch).

-export([parse_xml/2, expand_text/2]).

-include("edoc.hrl").
Expand Down
2 changes: 1 addition & 1 deletion lib/eunit/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ EBIN = ../ebin
INCLUDE=../include

ERL_COMPILE_FLAGS += -pa $(EBIN) -pa ../../stdlib/ebin -I$(INCLUDE) \
+nowarn_shadow_vars +warn_unused_import -Werror
+warn_deprecated_catch +nowarn_shadow_vars +warn_unused_import -Werror

PARSE_TRANSFORM = eunit_autoexport.erl

Expand Down
5 changes: 4 additions & 1 deletion lib/eunit/src/eunit_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ server_command(From, {start, Job}, St) ->
server_command(From, stop, St) ->
%% unregister the server name and let remaining jobs finish
server_command_reply(From, {error, stopped}),
catch unregister(St#state.name),
try unregister(St#state.name)
catch
error:badarg -> ok
end,
server(St#state{stopped = true});
server_command(From, {watch, Target, _Opts}, St) ->
%% the code watcher is only started on demand
Expand Down
2 changes: 1 addition & 1 deletion lib/syntax_tools/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ INCLUDE=../include

ERL_COMPILE_FLAGS += -pa $(EBIN) -pa ./ -I$(INCLUDE)

ERL_COMPILE_FLAGS += +nowarn_shadow_vars +warn_unused_import #-Werror # +warn_missing_spec +warn_untyped_record
ERL_COMPILE_FLAGS += +warn_deprecated_catch +nowarn_shadow_vars +warn_unused_import -Werror # +warn_missing_spec +warn_untyped_record

SOURCES=erl_syntax.erl erl_prettypr.erl erl_syntax_lib.erl \
erl_comment_scan.erl erl_recomment.erl epp_dodger.erl \
Expand Down
2 changes: 2 additions & 0 deletions lib/syntax_tools/src/epp_dodger.erl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ preprocessor [`//stdlib/epp`](`m:epp`) before the parser sees them), an extended
syntax tree is created, using the `m:erl_syntax` module.
""".

-compile(nowarn_deprecated_catch).

-export([parse_file/1, quick_parse_file/1, parse_file/2,
quick_parse_file/2, parse/1, quick_parse/1, parse/2,
quick_parse/2, parse/3, quick_parse/3, parse_form/2,
Expand Down
2 changes: 2 additions & 0 deletions lib/syntax_tools/src/erl_comment_scan.erl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
-module(erl_comment_scan).
-moduledoc "Functions for reading comment lines from Erlang source code.".

-compile(nowarn_deprecated_catch).

-export([file/1, join_lines/1, scan_lines/1, string/1]).

-export_type([comment/0]).
Expand Down
2 changes: 2 additions & 0 deletions lib/syntax_tools/src/erl_prettypr.erl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ This module is a front end to the pretty-printing library module `prettypr`, for
text formatting of abstract syntax trees defined by the module `erl_syntax`.
""".

-compile(nowarn_deprecated_catch).

-export([format/1, format/2, best/1, best/2, layout/1, layout/2,
get_ctxt_precedence/1, set_ctxt_precedence/2,
get_ctxt_paperwidth/1, set_ctxt_paperwidth/2,
Expand Down
2 changes: 2 additions & 0 deletions lib/syntax_tools/src/erl_syntax.erl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ list `[]`. This can be relied on when writing functions that operate on syntax
trees.
""".

-compile(nowarn_deprecated_catch).

-export([type/1,
is_leaf/1,
is_form/1,
Expand Down
2 changes: 2 additions & 0 deletions lib/syntax_tools/src/erl_syntax_lib.erl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ This module contains utility functions for working with the abstract data type
defined in the module `m:erl_syntax`.
""".

-compile(nowarn_deprecated_catch).

-export([analyze_application/1, analyze_attribute/1,
analyze_export_attribute/1, analyze_file_attribute/1,
analyze_form/1, analyze_forms/1, analyze_function/1,
Expand Down

0 comments on commit 1b95331

Please sign in to comment.