Some way to support an a handler for `BOOST_ASSERT(_MSG)` that takes a `std::source_location`
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- cpp
- 领域
- testing-qa
调研方向
首先检查现有的 BOOST_ASSERT handler API,以及 BOOST_ASSERT(_MSG) 的展开方式。将提议的使用 std::source_location 的 handler 选项与可自定义的 BOOST_ASSERT_FAILURE_HANDLER() 和 BOOST_ASSERT_MSG_FAILURE_HANDLER() 宏进行比较。完成的标准是拥有经 maintainer 批准的 API 设计及相应的实现范围。
由索引模型根据 Issue 内容生成。
描述
Problem: Using std::source_location is more efficient than passing separate file/line/column/func info because the location is a single pointer to static storage, rather than 2 pointer + 2 const ints. That can result in codegen bloat, especially on platforms like Aarch64 where it takes multiple instructions to load a global pointer. Given the usecase of assertions, this is often used for very cold (hopefully never executed!) code that sits in the same function as hot code, so you often want to make it as small as possible to maximize icache and iTLB. Note that it is important to use source_location from std:: rather than boost:: because the std:: flavor uses implementation techniques that are not available to userspace C++ to make it a single pointer to static storage.
Possible solution 1: Add a new macro like BOOST_ENABLE_ASSERT_HANDLER_WITH_STD_SOURCE_LOCATION to opt into a different handler API that takes std::source_location.
Possible solution 2: Give the user full control over the handler expression by just making the failure case be a macro call like BOOST_ASSERT_FAILURE_HANDLER() and BOOST_ASSERT_MSG_FAILURE_HANDLER(msg). The only tricky issue is that you would likely need some way to inject declarations and #includes into global scope, but it may be reasonable to say that anyone who can use this facility correctly can probably also use -include "my_boost_assert_prefix_header.h". This option also has the advantage for anyone who wants to use __builtin_trap() to get the ultimate code size reduction, while still checking asserts.
- 主要语言
- C++
- 星标
- 35
- 派生
- 77
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
boostorg/assert 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 55/100
-
难度 4/5 3-5 天 新手友好度 20/100
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
AXERA-TECH/ax-llm#77 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
games-on-whales/wolf#509 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 74/100
-
bug-unconfirmed
难度 2/5 1-3 小时 新手友好度 76/100