refactor: add `[[noreturn]]` attributes #339

pull fanquake wants to merge 2 commits into bitcoin-core:master from fanquake:missing_noreturn changing 8 files +8 −8
  1. fanquake commented at 11:12 AM on August 10, 2026: member

    These will be used downstream, see https://github.com/bitcoin/bitcoin/pull/35911.

  2. DrahtBot commented at 11:12 AM on August 10, 2026: none

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK hebasto

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  3. in include/mp/proxy-types.h:223 in 82d5c4c070 outdated
     219 | @@ -220,7 +220,7 @@ void ThrowField(TypeList<LocalType>, InvokeContext& invoke_context, Input&& inpu
     220 |  {
     221 |      ReadField(
     222 |          TypeList<LocalType>(), invoke_context, input, ReadDestEmplace(TypeList<LocalType>(),
     223 | -            [](auto&& ...args) -> const LocalType& { throw LocalType{std::forward<decltype(args)>(args)...}; }));
     224 | +            [] [[noreturn]] (auto&& ...args) -> const LocalType& { throw LocalType{std::forward<decltype(args)>(args)...}; }));
    


    ryanofsky commented at 7:50 PM on August 10, 2026:

    In commit "refactor: add missing [[noreturn]] attributes" (82d5c4c07019902bd8eeced04cc298a97efed849)

    It seems like this noreturn might not work because it requires c++23 lambda syntax. It is causing some CI jobs to fail with

    /home/runner/work/libmultiprocess/libmultiprocess/include/mp/proxy-types.h:223:16: error: an attribute specifier sequence in this position is a C++23 extension [-Werror,-Wc++23-lambda-attributes]

    https://github.com/bitcoin-core/libmultiprocess/actions/runs/31382467869/job/93435472734?pr=339#step:6:474


    hebasto commented at 11:44 AM on August 11, 2026:

    @fanquake

    Was this change prompted by the -Wmissing-noreturn compiler flag? If so, could you provide the exact build configuration (system, compiler, extra flags) used to reproduce the warning?


    fanquake commented at 3:10 PM on August 11, 2026:

    At least with Apple Clang and -Wmissing-noreturn:

    export CXXFLAGS="-Wmissing-noreturn"
    cmake -B build -G Ninja          
    -- The CXX compiler identification is AppleClang 21.0.0.21000101
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
    -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
    -- Found Threads: TRUE
    -- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libz.tbd (found version "1.2.12")
    -- 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 (0.9s)
    -- Generating done (0.0s)
    -- Build files have been written to: /Users/michael/libmultiprocess/build
    cmake --build build --clean-first
    [1/1] Cleaning all built files...
    Cleaning... 0 files.
    [5/7] Building CXX object CMakeFiles/multiprocess.dir/src/mp/proxy.cpp.o
    In file included from /Users/michael/libmultiprocess/src/mp/proxy.cpp:8:
    /Users/michael/libmultiprocess/include/mp/proxy-types.h:223:13: warning: function 'operator()' could be declared with attribute 'noreturn' [-Wmissing-noreturn]
      223 |             [](auto&& ...args) -> const LocalType& { throw LocalType{std::forward<decltype(args)>(args)...}; }));
          |             ^
    1 warning generated.
    [7/7] Linking CXX static library libmultiprocess.a
    

    hebasto commented at 3:27 PM on August 11, 2026:

    It appears that the behavior of -Wmissing-noreturn depends on the Clang version:

    $ env CXX="clang++-21" CXXFLAGS="-Wmissing-noreturn" cmake -B build_clang21
    $ cmake --build build_clang21
    [6/7] Building CXX object CMakeFiles/multiprocess.dir/src/mp/proxy.cpp.o
    In file included from /home/hebasto/dev/libmultiprocess/src/mp/proxy.cpp:8:
    /home/hebasto/dev/libmultiprocess/include/mp/proxy-types.h:223:13: warning: function 'operator()' could be declared with attribute 'noreturn' [-Wmissing-noreturn]
      223 |             [](auto&& ...args) -> const LocalType& { throw LocalType{std::forward<decltype(args)>(args)...}; }));
          |             ^
    1 warning generated.
    [7/7] Linking CXX static library libmultiprocess.a
    

    However,

    $ env CXX="clang++-22" CXXFLAGS="-Wmissing-noreturn" cmake -B build_clang22
    $ cmake --build build_clang22
    [7/7] Linking CXX static library libmultiprocess.a
    

    Could this be a regression in Clang?


    ryanofsky commented at 3:27 PM on August 11, 2026:

    Maybe we can just turn off the -Wc++23-lambda-attributes error. It seems like it might be less practically useful than the -Wmissing-noreturn one.


    hebasto commented at 3:36 PM on August 11, 2026:

    Could this be a regression in Clang?

    Not a regression, but a deliberate change: https://github.com/llvm/llvm-project/commit/3baddbbb0a698102073635f7559336f92bc7fe83.

  4. refactor: add missing [[noreturn]] attributes
    These will be used downstream, see
    https://github.com/bitcoin/bitcoin/pull/35911.
    636aaff576
  5. ci: add -Wmissing-noreturn
    Suppress `-Wc++23-lambda-attributes` warnings in effected jobs.
    ```bash
    /libmultiprocess/include/mp/proxy-types.h:223:16: warning: an attribute specifier sequence in this position is a C++23 extension [-Wc++23-lambda-attributes]
      223 |             [] [[noreturn]] (auto&& ...args) -> const LocalType& { throw LocalType{std::forward<decltype(args)>(args)...}; }));
          |                ^
    1 warning generated.
    ```
    a779a09764
  6. fanquake force-pushed on Aug 12, 2026
  7. hebasto approved
  8. hebasto commented at 10:37 AM on August 12, 2026: member

    ACK a779a09764c2d24d3a6a54e54126b5623384a020.

  9. ryanofsky merged this on Aug 12, 2026
  10. ryanofsky closed this on Aug 12, 2026

  11. fanquake deleted the branch on Aug 12, 2026
  12. ryanofsky commented at 3:05 PM on August 12, 2026: collaborator

    It looks like we will also need to add -Wno-c++23-lambda-attributes to the bitcoin build after the next libmultiprocess subtree update. Implemented in https://github.com/ryanofsky/bitcoin/commit/c8aef32afc5a81e118b20aa021cb90ad8230f973

    EDIT: That commit doesn't work for older versions of clang or for MSVC. Updated version is https://github.com/ryanofsky/bitcoin/commit/fd7da34fd80980ebbe633b8e79792742494818e5


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-08-24 10:30 UTC

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