arximboldi / immer

Postmodern immutable and persistent data structures for C++ — value semantics at scale
https://sinusoid.es/immer
Boost Software License 1.0
2.5k stars 182 forks source link

Possibly address unused parameter/variable warnings #137

Open gorakhargosh opened 4 years ago

gorakhargosh commented 4 years ago

Hi!

Thank you for creating this wonderful library. I have a small request. Could you please turn on -Wall -Wpedantic -Wextra -Wunused and try to minimize the unused variables/parameters? We see a flurry of warnings when we build code that uses immer.

INFO: From Compiling codelab/cc/containers/immutable/vector_test.cc:
In file included from codelab/cc/containers/immutable/vector_test.cc:1:
In file included from bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/vector.hpp:11:
In file included from bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/rbtree.hpp:11:
In file included from bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/node.hpp:13:
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/util.hpp:132:20: warning: unused parameter 'f' [-Wunused-parameter]
auto static_if(F&& f) -> std::enable_if_t<!b>
                   ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/util.hpp:136:30: warning: unused parameter 'f2' [-Wunused-parameter]
auto static_if(F1&& f1, F2&& f2) -> std::enable_if_t<b, R>
                             ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/util.hpp:141:21: warning: unused parameter 'f1' [-Wunused-parameter]
auto static_if(F1&& f1, F2&& f2) -> std::enable_if_t<!b, R>
                    ^
In file included from codelab/cc/containers/immutable/vector_test.cc:1:
In file included from bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/vector.hpp:11:
In file included from bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/rbtree.hpp:11:
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/node.hpp:874:24: warning: unused parameter 'shift' [-Wunused-parameter]
    bool check(shift_t shift, size_t size)
                       ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/node.hpp:874:38: warning: unused parameter 'size' [-Wunused-parameter]
    bool check(shift_t shift, size_t size)
                                     ^
In file included from codelab/cc/containers/immutable/vector_test.cc:1:
In file included from bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/vector.hpp:11:
In file included from bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/rbtree.hpp:12:
In file included from bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:17:
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:55:34: warning: unused parameter 'v' [-Wunused-parameter]
    decltype(auto) visit(Visitor v, Args&&... args)
                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:79:34: warning: unused parameter 'v' [-Wunused-parameter]
    decltype(auto) visit(Visitor v, Args&&... args)
                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:110:34: warning: unused parameter 'v' [-Wunused-parameter]
    decltype(auto) visit(Visitor v, Args&&... args)
                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:142:34: warning: unused parameter 'v' [-Wunused-parameter]
    decltype(auto) visit(Visitor v, Args&&... args)
                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:174:34: warning: unused parameter 'v' [-Wunused-parameter]
    decltype(auto) visit(Visitor v, Args&&... args)
                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:204:34: warning: unused parameter 'v' [-Wunused-parameter]
    decltype(auto) visit(Visitor v, Args&&... args)
                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:312:42: warning: unused parameter 'count_hint' [-Wunused-parameter]
                                 count_t count_hint,
                                         ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:333:34: warning: unused parameter 'v' [-Wunused-parameter]
    decltype(auto) visit(Visitor v, Args&&... args)
                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:730:26: warning: unused parameter 'idx' [-Wunused-parameter]
    count_t index(size_t idx) const { return 0; }
                         ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:731:29: warning: unused parameter 'idx' [-Wunused-parameter]
    count_t subindex(size_t idx) const { return 0; }
                            ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:732:32: warning: unused parameter 'offset' [-Wunused-parameter]
    size_t size_before(count_t offset) const { return 0; }
                               ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:734:25: warning: unused parameter 'offset' [-Wunused-parameter]
    size_t size(count_t offset) { return count_; }
                        ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:737:32: warning: unused parameter 'v' [-Wunused-parameter]
    void each_left_sub(Visitor v, Args&&... args)
                               ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:737:45: warning: unused parameter 'args' [-Wunused-parameter]
    void each_left_sub(Visitor v, Args&&... args)
                                            ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:740:23: warning: unused parameter 'v' [-Wunused-parameter]
    void each(Visitor v, Args&&... args)
                      ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:740:36: warning: unused parameter 'args' [-Wunused-parameter]
    void each(Visitor v, Args&&... args)
                                   ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:750:34: warning: unused parameter 'v' [-Wunused-parameter]
    decltype(auto) visit(Visitor v, Args&&... args)
                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:922:42: warning: unused parameter 'count_hint' [-Wunused-parameter]
                                 count_t count_hint,
                                         ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:1021:34: warning: unused parameter 'v' [-Wunused-parameter]
    decltype(auto) visit(Visitor v, Args&&... args)
                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:1072:34: warning: unused parameter 'v' [-Wunused-parameter]
    decltype(auto) visit(Visitor v, Args&&... args)
                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:1097:34: warning: unused parameter 'v' [-Wunused-parameter]
    decltype(auto) visit(Visitor v, Args&&... args)
                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:1150:25: warning: unused parameter 'offset' [-Wunused-parameter]
    size_t size(count_t offset) const { return size_t{1} << shift_; }
                        ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:1151:29: warning: unused parameter 'offset' [-Wunused-parameter]
    size_t size_sbh(count_t offset, size_t) const
                            ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:1157:29: warning: unused parameter 'offset' [-Wunused-parameter]
    void copy_sizes(count_t offset, count_t n, size_t init, size_t* sizes)
                            ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:1385:34: warning: unused parameter 'v' [-Wunused-parameter]
    decltype(auto) visit(Visitor v, Args&&... args)
                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:1787:34: warning: unused parameter 'v' [-Wunused-parameter]
    decltype(auto) visit(Visitor v, Args&&... args)
                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:1875:34: warning: unused parameter 'v' [-Wunused-parameter]
    decltype(auto) visit(Visitor v, Args&&... args)
                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/position.hpp:1913:34: warning: unused parameter 'v' [-Wunused-parameter]
    decltype(auto) visit(Visitor v, Args&&... args)
                                 ^
In file included from codelab/cc/containers/immutable/vector_test.cc:1:
In file included from bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/vector.hpp:11:
In file included from bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/rbtree.hpp:12:
In file included from bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:18:
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/visitor.hpp:24:48: warning: unused parameter 'args' [-Wunused-parameter]
    static decltype(auto) visit_node(Args&&... args)
                                               ^
In file included from codelab/cc/containers/immutable/vector_test.cc:1:
In file included from bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/vector.hpp:11:
In file included from bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/rbtree.hpp:12:
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:417:52: warning: unused parameter 'first' [-Wunused-parameter]
    visit_regular(PosL&& posl, PosR&& posr, Iter&& first, size_t idx)
                                                   ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:417:66: warning: unused parameter 'idx' [-Wunused-parameter]
    visit_regular(PosL&& posl, PosR&& posr, Iter&& first, size_t idx)
                                                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:766:37: warning: unused parameter 'pos' [-Wunused-parameter]
    static node_t* visit_leaf(Pos&& pos, edit_t e, node_t* tail, Args&&...)
                                    ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:766:49: warning: unused parameter 'e' [-Wunused-parameter]
    static node_t* visit_leaf(Pos&& pos, edit_t e, node_t* tail, Args&&...)
                                                ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:766:60: warning: unused parameter 'tail' [-Wunused-parameter]
    static node_t* visit_leaf(Pos&& pos, edit_t e, node_t* tail, Args&&...)
                                                           ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:843:37: warning: unused parameter 'pos' [-Wunused-parameter]
    static node_t* visit_leaf(Pos&& pos, node_t* tail, Args&&...)
                                    ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:843:50: warning: unused parameter 'tail' [-Wunused-parameter]
    static node_t* visit_leaf(Pos&& pos, node_t* tail, Args&&...)
                                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:877:34: warning: unused parameter 'p' [-Wunused-parameter]
    static void visit_leaf(Pos&& p, count_t idx)
                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:877:45: warning: unused parameter 'idx' [-Wunused-parameter]
    static void visit_leaf(Pos&& p, count_t idx)
                                            ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:1201:34: warning: unused parameter 'p' [-Wunused-parameter]
    static void visit_leaf(Pos&& p, count_t idx)
                                 ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:1201:45: warning: unused parameter 'idx' [-Wunused-parameter]
    static void visit_leaf(Pos&& p, count_t idx)
                                            ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:1858:23: warning: unused parameter 'lpos' [-Wunused-parameter]
    visit_leaf(LPos&& lpos, TPos&& tpos, RPos&& rpos)
                      ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:1858:36: warning: unused parameter 'tpos' [-Wunused-parameter]
    visit_leaf(LPos&& lpos, TPos&& tpos, RPos&& rpos)
                                   ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:1858:49: warning: unused parameter 'rpos' [-Wunused-parameter]
    visit_leaf(LPos&& lpos, TPos&& tpos, RPos&& rpos)
                                                ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:2236:62: warning: unused parameter 'ec' [-Wunused-parameter]
concat_center_mut_pos<Node> concat_leafs_mut(edit_type<Node> ec,
                                                             ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:2237:62: warning: unused parameter 'el' [-Wunused-parameter]
                                             edit_type<Node> el,
                                                             ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:2240:62: warning: unused parameter 'er' [-Wunused-parameter]
                                             edit_type<Node> er,
                                                             ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:2320:16: warning: unused parameter 'lpos' [-Wunused-parameter]
        LPos&& lpos, edit_t ec, edit_t el, TPos&& tpos, edit_t er, RPos&& rpos)
               ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:2320:29: warning: unused parameter 'ec' [-Wunused-parameter]
        LPos&& lpos, edit_t ec, edit_t el, TPos&& tpos, edit_t er, RPos&& rpos)
                            ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:2320:40: warning: unused parameter 'el' [-Wunused-parameter]
        LPos&& lpos, edit_t ec, edit_t el, TPos&& tpos, edit_t er, RPos&& rpos)
                                       ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:2320:51: warning: unused parameter 'tpos' [-Wunused-parameter]
        LPos&& lpos, edit_t ec, edit_t el, TPos&& tpos, edit_t er, RPos&& rpos)
                                                  ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:2320:64: warning: unused parameter 'er' [-Wunused-parameter]
        LPos&& lpos, edit_t ec, edit_t el, TPos&& tpos, edit_t er, RPos&& rpos)
                                                               ^
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/detail/rbts/operations.hpp:2320:75: warning: unused parameter 'rpos' [-Wunused-parameter]
        LPos&& lpos, edit_t ec, edit_t el, TPos&& tpos, edit_t er, RPos&& rpos)
                                                                          ^
In file included from codelab/cc/containers/immutable/vector_test.cc:1:
In file included from bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/vector.hpp:13:
In file included from bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/memory_policy.hpp:11:
bazel-out/darwin-fastbuild/bin/external/com_github_arximboldi_immer/_virtual_includes/immer/immer/heap/cpp_heap.hpp:35:40: warning: unused parameter 'size' [-Wunused-parameter]
    static void deallocate(std::size_t size, void* data)
                                       ^
58 warnings generated.
arximboldi commented 4 years ago

Makes sense, but this is low priority, since unused parameter warnings provide not much value in my opinion. You can work around it by including the library in path with -isystem.

If this is part of some commercial work, consider supporting the project here: https://github.com/sponsors/arximboldi The higher sponsorship tiers help prioritizing issues :slightly_smiling_face: