Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Use the new -spec format
Browse files Browse the repository at this point in the history
The old format is removed in Erlang 19.0, leading to build errors.

Also, get rid of the `use_specs` macro and thus always define -spec() &
friends.

While here, unnify the style of -type and -spec.

References rabbitmq/rabbitmq-server#860.
[#118562897]
[#122335241]
  • Loading branch information
dumbbell committed Jun 29, 2016
1 parent 2f3b9e7 commit f846d9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 25 deletions.
19 changes: 7 additions & 12 deletions src/rabbit_registry.erl
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,13 @@
-define(SERVER, ?MODULE).
-define(ETS_NAME, ?MODULE).

-ifdef(use_specs).

-spec(start_link/0 :: () -> rabbit_types:ok_pid_or_error()).
-spec(register/3 :: (atom(), binary(), atom()) -> 'ok').
-spec(unregister/2 :: (atom(), binary()) -> 'ok').
-spec(binary_to_type/1 ::
(binary()) -> atom() | rabbit_types:error('not_found')).
-spec(lookup_module/2 ::
(atom(), atom()) -> rabbit_types:ok_or_error2(atom(), 'not_found')).
-spec(lookup_all/1 :: (atom()) -> [{atom(), atom()}]).

-endif.
-spec start_link() -> rabbit_types:ok_pid_or_error().
-spec register(atom(), binary(), atom()) -> 'ok'.
-spec unregister(atom(), binary()) -> 'ok'.
-spec binary_to_type(binary()) -> atom() | rabbit_types:error('not_found').
-spec lookup_module(atom(), atom()) ->
rabbit_types:ok_or_error2(atom(), 'not_found').
-spec lookup_all(atom()) -> [{atom(), atom()}].

%%---------------------------------------------------------------------------

Expand Down
13 changes: 0 additions & 13 deletions src/rabbit_registry_class.erl
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
-module(rabbit_registry_class).

-ifdef(use_specs).

-callback added_to_rabbit_registry(atom(), atom()) -> ok.

-callback removed_from_rabbit_registry(atom()) -> ok.

-else.

-export([behaviour_info/1]).

behaviour_info(callbacks) ->
[{added_to_rabbit_registry, 2}, {removed_from_rabbit_registry, 1}];
behaviour_info(_Other) ->
undefined.

-endif.

0 comments on commit f846d9c

Please sign in to comment.