This is an automated email from the ASF dual-hosted git repository.
eiri pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/master by this push:
new 1768aea Remove warning on `couch_epi_codegen` compile
1768aea is described below
commit 1768aeab8b9100034e374a45f1bc9b7bd72dad2e
Author: Eric Avdey <[email protected]>
AuthorDate: Fri Jan 12 10:56:18 2018 -0400
Remove warning on `couch_epi_codegen` compile
Change runtime choice between `erl_scan:token_info`
and `erl_scan:line` to compilation conditional one.
This is getting rid of compilation deprecation warning
and also should speed up things a bit.
---
src/couch_epi/rebar.config | 4 ++++
src/couch_epi/src/couch_epi_codegen.erl | 19 ++++++++++++-------
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/couch_epi/rebar.config b/src/couch_epi/rebar.config
index 82db830..3c7f8af 100644
--- a/src/couch_epi/rebar.config
+++ b/src/couch_epi/rebar.config
@@ -1,3 +1,7 @@
{cover_enabled, true}.
{cover_print_enabled, true}.
+
+{erl_opts, [
+ {platform_define, "^R16", 'pre18'},
+ {platform_define, "^17", 'pre18'}]}.
diff --git a/src/couch_epi/src/couch_epi_codegen.erl
b/src/couch_epi/src/couch_epi_codegen.erl
index 978f0bb..89b82a1 100644
--- a/src/couch_epi/src/couch_epi_codegen.erl
+++ b/src/couch_epi/src/couch_epi_codegen.erl
@@ -70,11 +70,16 @@ fixup_terminator(Tokens) ->
Tokens ++ [{dot, Line}]
end.
+
+-ifdef(pre18).
+
line(Token) ->
- case erlang:function_exported(erl_scan, line, 1) of
- true ->
- erl_scan:line(Token);
- false ->
- {line, Line} = erl_scan:token_info(Token, line),
- Line
- end.
+ {line, Line} = erl_scan:token_info(Token, line),
+ Line.
+
+-else.
+
+line(Token) ->
+ erl_scan:line(Token).
+
+-endif.
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].