couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject [couchdb] 01/01: Remove warning on couch_epi_codegen compile
Date Fri, 12 Jan 2018 15:00:30 GMT
This is an automated email from the ASF dual-hosted git repository.

eiri pushed a commit to branch remove-warning-in-epi_codegen
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit d43e86423d855667add19c26a2e198af0f93edc2
Author: Eric Avdey <eiri@eiri.ca>
AuthorDate: Fri Jan 12 10:56:18 2018 -0400

    Remove warning on couch_epi_codegen compile
    
    Change runtime choice beween `erl_scan:token_info`
    and `erl_scan:line` to compilation conditional one.
    
    This is getting rid of compilation deprication warning
    and should also 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
"commits@couchdb.apache.org" <commits@couchdb.apache.org>.

Mime
View raw message