You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ei...@apache.org on 2018/01/12 15:00:29 UTC

[couchdb] branch remove-warning-in-epi_codegen created (now d43e864)

This is an automated email from the ASF dual-hosted git repository.

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


      at d43e864  Remove warning on couch_epi_codegen compile

This branch includes the following new commits:

     new d43e864  Remove warning on couch_epi_codegen compile

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <co...@couchdb.apache.org>'].

[couchdb] 01/01: Remove warning on couch_epi_codegen compile

Posted by ei...@apache.org.
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 <ei...@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" <co...@couchdb.apache.org>.