From 10301b40c8e9cfe84017db1eccbb3214f2ad1851 Mon Sep 17 00:00:00 2001 From: Anton Makarov Date: Fri, 28 Apr 2023 17:49:27 +0600 Subject: [PATCH] Fix compilation warnings and prepare to be a dependency. --- .gitignore | 13 ++++++++----- rebar.config | 3 +++ src/geef_nif.erl | 4 ++-- test/config_test.erl | 2 +- test/pkt_test.erl | 2 +- test/ref_test.erl | 2 +- test/repo_test.erl | 4 ++-- test/revwalk_test.erl | 2 +- 8 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 713629c..962075b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,12 @@ *.beam *.so *.o +*.d *.swp -rebar -ebin/ -.eunit -.rebar/ -_build/ \ No newline at end of file +/rebar +/ebin/ +/.eunit/ +/.rebar/ +/_build/ +/compile_commands.json +/geef diff --git a/rebar.config b/rebar.config index a270ae5..92ae46b 100644 --- a/rebar.config +++ b/rebar.config @@ -5,6 +5,9 @@ {port_env, [ {"DRV_LDFLAGS", "$DRV_LDFLAGS -lz -lgit2"}, + %% fix rebar2 compilation for erlang-23 and above (replace automatic usage of -lerl_interface with -lei) + {"ERL_LDFLAGS", "-L$ERL_EI_LIBDIR -lei"}, + %% OS X Leopard flags for 64-bit {"darwin9.*-64$", "CXXFLAGS", "-m64"}, {"darwin9.*-64$", "LDFLAGS", "-arch x86_64"}, diff --git a/src/geef_nif.erl b/src/geef_nif.erl index df6e4e3..9283e64 100644 --- a/src/geef_nif.erl +++ b/src/geef_nif.erl @@ -2,7 +2,7 @@ %%% NIF functions, not to be used directly. -module(geef_nif). --compile(export_all). +-compile([export_all,nowarn_export_all]). -include("geef_records.hrl"). @@ -85,7 +85,7 @@ reflog_read(_Handle, _Name) -> reflog_delete(_Handle, _Name) -> ?NIF_FN. -odb_object_exists(_Val, _Val) -> +odb_object_exists(_Val1, _Val2) -> nif_error(?LINE). -spec odb_write(term(), iolist(), atom()) -> term(). diff --git a/test/config_test.erl b/test/config_test.erl index f1c7832..5643947 100644 --- a/test/config_test.erl +++ b/test/config_test.erl @@ -1,5 +1,5 @@ -module(config_test). --compile([export_all]). +-compile([export_all,nowarn_export_all]). -include_lib("eunit/include/eunit.hrl"). -include("src/geef_records.hrl"). diff --git a/test/pkt_test.erl b/test/pkt_test.erl index 8d171b0..5b42783 100644 --- a/test/pkt_test.erl +++ b/test/pkt_test.erl @@ -1,5 +1,5 @@ -module(pkt_test). --compile([export_all]). +-compile([export_all,nowarn_export_all]). -include_lib("eunit/include/eunit.hrl"). -include("src/geef_records.hrl"). diff --git a/test/ref_test.erl b/test/ref_test.erl index e4fe8fb..5fd92ae 100644 --- a/test/ref_test.erl +++ b/test/ref_test.erl @@ -1,5 +1,5 @@ -module(ref_test). --compile([export_all]). +-compile([export_all,nowarn_export_all]). -include_lib("eunit/include/eunit.hrl"). -include("src/geef_records.hrl"). diff --git a/test/repo_test.erl b/test/repo_test.erl index 3d6cf15..e4bb2e7 100644 --- a/test/repo_test.erl +++ b/test/repo_test.erl @@ -1,5 +1,5 @@ -module(repo_test). --compile([export_all]). +-compile([export_all,nowarn_export_all]). -include_lib("eunit/include/eunit.hrl"). -include("src/geef_records.hrl"). @@ -117,7 +117,7 @@ commit_tree_test(Repo) -> CommitId = geef_oid:parse("bf968373f95f8fed2a24f9d25ebf06521359c6bc"), {ok, Commit} = geef_commit:lookup(Repo, CommitId), Resp = geef_commit:tree(Commit), - [?_assertMatch({ok, _}, Resp)]. + [?_assertMatch({ok, _, _}, Resp)]. rm_r(Path) -> case filelib:is_dir(Path) of diff --git a/test/revwalk_test.erl b/test/revwalk_test.erl index c938b32..1d7574c 100644 --- a/test/revwalk_test.erl +++ b/test/revwalk_test.erl @@ -1,5 +1,5 @@ -module(revwalk_test). --compile([export_all]). +-compile([export_all,nowarn_export_all]). -include_lib("eunit/include/eunit.hrl"). repo_test_() ->