util: Drop Bind, BindTuple, ComposeFn, GetFn, and ThrowFn helpers #91

pull ryanofsky wants to merge 1 commits into bitcoin-core:master from ryanofsky:pr/c14 changing 2 files +3 −155
  1. ryanofsky commented at 7:45 PM on January 18, 2024: collaborator

    Last remaining uses of these utilities except for ThrowFn were removed in https://github.com/chaincodelabs/libmultiprocess/pull/31.

    Last remaining use of ThrowFn is removed here. After C++14 it is easily replaced with a perfect-forwarding auto&& lambda.

    Immediate motivation for this change is to fix C++20 compilers complaining about reference to std::result_of in the unused code: https://github.com/bitcoin/bitcoin/issues/29248

  2. util: Drop Bind, BindTuple, ComposeFn, GetFn, and ThrowFn helpers
    Last remaining uses of these utilities except for ThrowFn were removed in PR
    "Unify ReadFieldNew / ReadFieldUpdate"
    https://github.com/chaincodelabs/libmultiprocess/pull/31
    
    Last remaining use of ThrowFn is removed here. After C++14 it is easily replaced
    with a perfect-forwarding auto&& lambda.
    
    Immediate motivation for this change is to fix C++20 compilers complaining about
    reference to std::result_of in the unused code
    https://github.com/bitcoin/bitcoin/issues/29248
    65260d1851
  3. ryanofsky merged this on Jan 18, 2024
  4. ryanofsky closed this on Jan 18, 2024

  5. ryanofsky referenced this in commit 5dfd24581a on Jan 18, 2024
  6. edilmedeiros commented at 2:41 AM on January 19, 2024: none

    My build succeeded, but the tests failed.

    Attached are some logs; not sure if this is a problem with my setup.

    CMakeError.log CMakeOutput.log

    ❯ cmake ..
    -- The CXX compiler identification is AppleClang 15.0.0.15000100
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found PkgConfig: /opt/local/bin/pkg-config (found version "0.29.2")
    -- Checking for module 'capnp'
    --   Found capnp, version 1.0.1
    -- Checking for module 'capnpc'
    --   Found capnpc, version 1.0.1
    -- Checking for module 'capnp-rpc'
    --   Found capnp-rpc, version 1.0.1
    -- Checking for module 'capnp-json'
    --   Found capnp-json, version 1.0.1
    -- Checking for module 'capnp-websocket'
    --   Found capnp-websocket, version 1.0.1
    -- Checking for module 'kj'
    --   Found kj, version 1.0.1
    -- Checking for module 'kj-async'
    --   Found kj-async, version 1.0.1
    -- Checking for module 'kj-http'
    --   Found kj-http, version 1.0.1
    -- Checking for module 'kj-gzip'
    --   Found kj-gzip, version 1.0.1
    -- Checking for module 'kj-tls'
    --   Found kj-tls, version 1.0.1
    -- Checking for module 'kj-test'
    --   Found kj-test, version 1.0.1
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
    -- Found Threads: TRUE
    -- Performing Test HAVE_PTHREAD_GETNAME_NP
    -- Performing Test HAVE_PTHREAD_GETNAME_NP - Success
    -- Performing Test HAVE_PTHREAD_THREADID_NP
    -- Performing Test HAVE_PTHREAD_THREADID_NP - Success
    -- Performing Test HAVE_PTHREAD_GETTHREADID_NP
    -- Performing Test HAVE_PTHREAD_GETTHREADID_NP - Failed
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/build
    
    
    ❯ make
    [ 14%] Building CXX object CMakeFiles/util.dir/src/mp/util.cpp.o
    [ 14%] Built target util
    [ 28%] Compiling Cap'n Proto schema include/mp/proxy.capnp
    [ 42%] Building CXX object CMakeFiles/multiprocess.dir/include/mp/proxy.capnp.c++.o
    [ 57%] Building CXX object CMakeFiles/multiprocess.dir/src/mp/proxy.cpp.o
    [ 71%] Linking CXX static library libmultiprocess.a
    [ 71%] Built target multiprocess
    [ 85%] Building CXX object CMakeFiles/mpgen.dir/src/mp/gen.cpp.o
    [100%] Linking CXX executable mpgen
    [100%] Built target mpgen
    
    
    ❯ make check
    Consolidate compiler generated dependencies of target util
    [  7%] Built target util
    Consolidate compiler generated dependencies of target mpgen
    [ 21%] Built target mpgen
    Consolidate compiler generated dependencies of target multiprocess
    [ 50%] Built target multiprocess
    [ 57%] Generating mp/test/foo.capnp.h, mp/test/foo.capnp.c++, mp/test/foo.capnp.proxy.h, mp/test/foo.capnp.proxy-server.c++, mp/test/foo.capnp.proxy-client.c++, mp/test/foo.capnp.proxy-types.c++, mp/test/foo.capnp.proxy-types.h
    [ 64%] Building CXX object test/CMakeFiles/mptest.dir/mp/test/foo.capnp.c++.o
    [ 71%] Building CXX object test/CMakeFiles/mptest.dir/mp/test/foo.capnp.proxy-server.c++.o
    In file included from /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/build/test/mp/test/foo.capnp.proxy-server.c++:3:
    In file included from /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/build/test/mp/test/foo.capnp.proxy-types.h:7:
    In file included from /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/test/mp/test/foo-types.h:8:
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1003:16: error: no matching function for call to 'BuildPrimitive'
        output.set(BuildPrimitive(invoke_context, std::forward<Value>(value), TypeList<decltype(output.get())>()));
                   ^~~~~~~~~~~~~~
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:699:9: note: in instantiation of function template specialization 'mp::CustomBuildField<bool, std::__bit_const_reference<std::vector<bool>>, mp::ListOutput<capnp::List<bool, capnp::Kind::PRIMITIVE>>>' requested here
            CustomBuildField(TypeList<LocalTypes...>(), Priority<3>(), context, std::forward<Values>(values)...,
            ^
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:842:9: note: in instantiation of function template specialization 'mp::BuildField<bool, mp::InvokeContext, std::__bit_const_reference<std::vector<bool>>, mp::ListOutput<capnp::List<bool, capnp::Kind::PRIMITIVE>>>' requested here
            BuildField(TypeList<LocalType>(), invoke_context, ListOutput<typename decltype(list)::Builds>(list, i), *it);
            ^
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:699:9: note: in instantiation of function template specialization 'mp::CustomBuildField<bool, const std::vector<bool> &, mp::StructField<mp::Accessor<mp::foo_fields::Vbool, 19>, mp::test::messages::FooStruct::Builder> &>' requested here
            CustomBuildField(TypeList<LocalTypes...>(), Priority<3>(), context, std::forward<Values>(values)...,
            ^
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1018:5: note: in instantiation of function template specialization 'mp::BuildField<std::vector<bool>, mp::InvokeContext, const std::vector<bool> &, mp::StructField<mp::Accessor<mp::foo_fields::Vbool, 19>, mp::test::messages::FooStruct::Builder> &>' requested here
        BuildField(TypeList<Decay<decltype(field_value)>>(), invoke_context, field_output, field_value);
        ^
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1019:5: note: in instantiation of function template specialization 'mp::BuildOne<2UL, mp::test::FooStruct, const mp::test::FooStruct &, mp::test::messages::FooStruct::Builder &>' requested here
        BuildOne<index + 1>(param, invoke_context, output, value);
        ^
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1019:5: note: (skipping 2 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:699:9: note: in instantiation of function template specialization 'mp::CustomBuildField<mp::test::FooStruct, const mp::test::FooStruct &, mp::StructField<mp::Accessor<mp::foo_fields::Error, 18>, mp::test::messages::FooInterface::RaiseResults::Builder>>' requested here
            CustomBuildField(TypeList<LocalTypes...>(), Priority<3>(), context, std::forward<Values>(values)...,
            ^
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1360:13: note: in instantiation of function template specialization 'mp::BuildField<mp::test::FooStruct, mp::ServerInvokeContext<mp::ProxyServer<mp::test::messages::FooInterface>, capnp::CallContext<mp::test::messages::FooInterface::RaiseParams, mp::test::messages::FooInterface::RaiseResults>>, const mp::test::FooStruct &, mp::StructField<mp::Accessor<mp::foo_fields::Error, 18>, mp::test::messages::FooInterface::RaiseResults::Builder>>' requested here
                BuildField(TypeList<Exception>(), server_context, Make<StructField, Accessor>(results), exception);
                ^
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1135:8: note: in instantiation of function template specialization 'mp::ServerExcept<mp::test::FooStruct, mp::Accessor<mp::foo_fields::Error, 18>, mp::ServerCall>::invoke<mp::ServerInvokeContext<mp::ProxyServer<mp::test::messages::FooInterface>, capnp::CallContext<mp::test::messages::FooInterface::RaiseParams, mp::test::messages::FooInterface::RaiseResults>>, mp::test::FooStruct>' requested here
        fn.invoke(server_context, std::forward<Args>(args)..., static_cast<LocalType&&>(*param));
           ^
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1385:16: note: in instantiation of function template specialization 'mp::PassField<mp::Accessor<mp::foo_fields::Arg, 17>, mp::test::FooStruct, mp::ServerInvokeContext<mp::ProxyServer<mp::test::messages::FooInterface>, capnp::CallContext<mp::test::messages::FooInterface::RaiseParams, mp::test::messages::FooInterface::RaiseResults>>, const mp::ServerExcept<mp::test::FooStruct, mp::Accessor<mp::foo_fields::Error, 18>, mp::ServerCall> &, mp::TypeList<>>' requested here
            return PassField<Accessor>(Priority<2>(),
                   ^
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/build/test/mp/test/foo.capnp.proxy-server.c++:17:12: note: in instantiation of function template specialization 'mp::serverInvoke<mp::ProxyServer<mp::test::messages::FooInterface>, capnp::CallContext<mp::test::messages::FooInterface::RaiseParams, mp::test::messages::FooInterface::RaiseResults>, mp::ServerField<1, mp::Accessor<mp::foo_fields::Arg, 17>, mp::ServerExcept<mp::test::FooStruct, mp::Accessor<mp::foo_fields::Error, 18>, mp::ServerCall>>>' requested here
        return serverInvoke(*this, call_context, MakeServerField<1, Accessor<foo_fields::Arg, FIELD_IN | FIELD_BOXED>>(Make<ServerExcept, mp::test::FooStruct, Accessor<foo_fields::Error, FIELD_OUT | FIELD_BOXED>>(ServerCall())));
               ^
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:879:15: note: candidate function template not viable: no known conversion from 'TypeList<decltype(output.get())>' to 'TypeList<::capnp::Void>' for 3rd argument
    ::capnp::Void BuildPrimitive(InvokeContext& invoke_context, Value&&, TypeList<::capnp::Void>)
                  ^
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:884:20: note: candidate function not viable: no known conversion from 'std::__bit_const_reference<std::vector<bool>>' to 'std::vector<bool>::reference' (aka '__bit_reference<vector<bool, allocator<bool>>>') for 2nd argument
    inline static bool BuildPrimitive(InvokeContext& invoke_context, std::vector<bool>::reference value, TypeList<bool>)
                       ^
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:890:11: note: candidate template ignored: requirement 'std::is_enum<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>>::value' was not satisfied [with LocalType = bool, Value = std::__bit_const_reference<std::vector<bool>>]
    LocalType BuildPrimitive(InvokeContext& invoke_context,
              ^
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:899:11: note: candidate template ignored: requirement 'std::is_integral<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>>::value' was not satisfied [with LocalType = bool, Value = std::__bit_const_reference<std::vector<bool>>]
    LocalType BuildPrimitive(InvokeContext& invoke_context,
              ^
    /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:912:11: note: candidate template ignored: requirement 'std::is_floating_point<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>>::value' was not satisfied [with LocalType = bool, Value = std::__bit_const_reference<std::vector<bool>>]
    LocalType BuildPrimitive(InvokeContext& invoke_context,
              ^
    1 error generated.
    make[3]: *** [test/CMakeFiles/mptest.dir/mp/test/foo.capnp.proxy-server.c++.o] Error 1
    make[2]: *** [test/CMakeFiles/mptest.dir/all] Error 2
    make[1]: *** [test/CMakeFiles/check.dir/rule] Error 2
    make: *** [check] Error 2
    
  7. ryanofsky commented at 8:34 PM on January 19, 2024: collaborator

    My build succeeded, but the tests failed.

    Thanks @edilmedeiros, I opened a new issue for this in #92, and I'm downloading clang 15 to see if I can reproduce this error on linux.

  8. ryanofsky referenced this in commit b8105b3ed7 on Jan 22, 2024
  9. fanquake referenced this in commit f1ab078ed7 on Jan 23, 2024
  10. 0xB10C referenced this in commit d9baf06506 on Jan 24, 2024
  11. janus referenced this in commit 86470d732b on Apr 6, 2024
  12. PastaPastaPasta referenced this in commit fcb0d3ccf4 on Sep 27, 2024
  13. PastaPastaPasta referenced this in commit c7e42416ff on Sep 27, 2024
  14. PastaPastaPasta referenced this in commit 2758ba8cd9 on Sep 27, 2024
  15. PastaPastaPasta referenced this in commit 914582ecbd on Sep 28, 2024
  16. PastaPastaPasta referenced this in commit 7a63c20c47 on Oct 1, 2024
  17. bitcoin-core locked this on Jun 25, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/libmultiprocess. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-20 18:30 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me