summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2015-08-07 12:59:51 +0200
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2015-08-07 12:59:51 +0200
commit804a2209b4c8c540559c06f2c9d1544c609f1624 (patch)
tree93e7fc068aa8bce9814c4ce51b2350a2a4228368
parente2b7de27cc6c55e430882621a4545dcfdd901e95 (diff)
downloadrabbitmq-server-git-804a2209b4c8c540559c06f2c9d1544c609f1624.tar.gz
Warn about exported variables
Fix the reported warning in `credit_flow.erl` and `rabbit_table.erl`. This is the default setting in erlang.mk, so fixing this directly in RabbitMQ will ease future work on erlang.mk or Rebar.
-rw-r--r--Makefile2
-rw-r--r--src/credit_flow.erl6
-rw-r--r--src/rabbit_table.erl9
3 files changed, 10 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 1c9800188e..22f8270a07 100644
--- a/Makefile
+++ b/Makefile
@@ -61,7 +61,7 @@ USE_PROPER_QC:=$(shell erl -noshell -eval 'io:format({module, proper} =:= code:e
endif
#other args: +native +"{hipe,[o3,verbose]}" -Ddebug=true +debug_info +no_strict_record_tests
-ERLC_OPTS=-I $(INCLUDE_DIR) -Wall -v +debug_info $(call boolean_macro,$(USE_SPECS),use_specs) $(call boolean_macro,$(USE_PROPER_QC),use_proper_qc)
+ERLC_OPTS=-I $(INCLUDE_DIR) -Wall +warn_export_vars -v +debug_info $(call boolean_macro,$(USE_SPECS),use_specs) $(call boolean_macro,$(USE_PROPER_QC),use_proper_qc)
ifdef INSTRUMENT_FOR_QC
ERLC_OPTS += -DINSTR_MOD=gm_qc
diff --git a/src/credit_flow.erl b/src/credit_flow.erl
index 6b24175388..e7f13a66dc 100644
--- a/src/credit_flow.erl
+++ b/src/credit_flow.erl
@@ -61,9 +61,9 @@
%% We deliberately allow Var to escape from the case here
%% to be used in Expr. Any temporary var we introduced
%% would also escape, and might conflict.
- case get(Key) of
- undefined -> Var = Default;
- Var -> ok
+ Var = case get(Key) of
+ undefined -> Default;
+ V -> V
end,
put(Key, Expr)
end).
diff --git a/src/rabbit_table.erl b/src/rabbit_table.erl
index e716345b85..a873a714e1 100644
--- a/src/rabbit_table.erl
+++ b/src/rabbit_table.erl
@@ -189,9 +189,12 @@ check_content(Tab, TabDef) ->
check(Fun) ->
case [Error || {Tab, TabDef} <- definitions(),
- case Fun(Tab, TabDef) of
- ok -> Error = none, false;
- {error, Error} -> true
+ begin
+ {Ret, Error} = case Fun(Tab, TabDef) of
+ ok -> {false, none};
+ {error, E} -> {true, E}
+ end,
+ Ret
end] of
[] -> ok;
Errors -> {error, Errors}