-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Replace outcome
with Boost's version of outcome
to remove dependence on quickcpplib
.
#62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
anlowee
wants to merge
20
commits into
y-scope:main
Choose a base branch
from
anlowee:xwei/change-boost
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+22
−50
Open
Changes from 8 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
8243ff7
Update install_boost and bump yscope-dev-utils version
ee2664b
Make task build:all runnable
15a669a
Fix build CI (Kirk figured this)
23bae4e
Fix
9497510
Add else check
3047723
Fix unit test
aa60263
Fix lint check
c0208ac
Fix lint
df69a31
Merge branch 'main' into xwei/change-boost
anlowee db16c39
Fix
anlowee 00cbc53
Fix
anlowee c25d371
Fix
anlowee 68f8bef
Fix
anlowee 8a18f96
Fix
anlowee fa691c3
Merge branch 'y-scope:main' into xwei/change-boost
anlowee 6a913df
Fix
anlowee afb5e98
Fix
anlowee 84ee31e
Bump boost version to 1.88
anlowee 58c4393
Try 1.87
anlowee 4c7a6c6
Fix
anlowee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Lock to v19.x until we can upgrade our code to fix new v20 issues. | ||
clang-format~=19.1 | ||
clang-format>=20.1.0 | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Lock to v19.x until we can upgrade our code to fix new v20 issues. | ||
clang-tidy~=19.1 | ||
clang-tidy>=19.1.0 | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
colorama>=0.4.6 | ||
gersemi>=0.16.2 | ||
yamllint>=1.35.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
#ifndef YSTDLIB_ERROR_HANDLING_RESULT_HPP | ||
#define YSTDLIB_ERROR_HANDLING_RESULT_HPP | ||
|
||
#include <boost/outcome/config.hpp> | ||
#include <boost/outcome/std_result.hpp> | ||
#include <boost/outcome/success_failure.hpp> | ||
#include <boost/outcome/try.hpp> | ||
anlowee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#include <system_error> | ||
|
||
#include <outcome/config.hpp> | ||
#include <outcome/std_result.hpp> | ||
#include <outcome/success_failure.hpp> | ||
#include <outcome/try.hpp> | ||
|
||
namespace ystdlib::error_handling { | ||
/** | ||
* A Rust-style `Result<T, E>` type for standardized, exception-free error handling. | ||
|
@@ -20,34 +19,16 @@ namespace ystdlib::error_handling { | |
* @tparam ErrorType The type used to represent errors. | ||
*/ | ||
template <typename ReturnType, typename ErrorType = std::error_code> | ||
using Result = OUTCOME_V2_NAMESPACE::std_result<ReturnType, ErrorType>; | ||
using Result = BOOST_OUTCOME_V2_NAMESPACE::std_result<ReturnType, ErrorType>; | ||
|
||
/** | ||
* @return A value indicating successful completion of a function that returns a void result (i.e., | ||
* `Result<void, E>`). | ||
*/ | ||
[[nodiscard]] inline auto success() -> OUTCOME_V2_NAMESPACE::success_type<void> { | ||
return OUTCOME_V2_NAMESPACE::success(); | ||
[[nodiscard]] inline auto success() -> BOOST_OUTCOME_V2_NAMESPACE::success_type<void> { | ||
return BOOST_OUTCOME_V2_NAMESPACE::success(); | ||
} | ||
|
||
/** | ||
* A function-style macro that emulates Rust’s try (`?`) operator for error propagation. | ||
* | ||
* @param expr An expression that evaluates to a `Result` object. | ||
* | ||
* Behavior: | ||
* - If `expr` represents an error (i.e., `expr.has_error()` returns true), the macro performs an | ||
* early return from the enclosing function with the contained error. | ||
* - Otherwise, it unwraps and yields the successful value as an rvalue reference (`expr.value()`). | ||
* | ||
* NOTE: This macro is only supported on GCC and Clang due to reliance on compiler-specific | ||
* extensions. | ||
*/ | ||
#ifdef OUTCOME_TRYX | ||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) | ||
#define YSTDLIB_ERROR_HANDLING_TRYX(expr) OUTCOME_TRYX(expr) | ||
#endif | ||
|
||
/** | ||
* A function-style macro for propagating errors from expressions that evaluate to a void result | ||
* (`Result<void, E>`). | ||
|
@@ -60,7 +41,8 @@ using Result = OUTCOME_V2_NAMESPACE::std_result<ReturnType, ErrorType>; | |
* - Otherwise, execution continues normally. | ||
*/ | ||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) | ||
#define YSTDLIB_ERROR_HANDLING_TRYV(expr) OUTCOME_TRYV(expr) | ||
#define YSTDLIB_ERROR_HANDLING_TRYV(expr) BOOST_OUTCOME_TRYV(expr) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Guard Wrap -// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
-#define YSTDLIB_ERROR_HANDLING_TRYV(expr) BOOST_OUTCOME_TRYV(expr)
+#ifdef BOOST_OUTCOME_TRYV
+ // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
+ #define YSTDLIB_ERROR_HANDLING_TRYV(expr) BOOST_OUTCOME_TRYV(expr)
+#endif 🤖 Prompt for AI Agents
|
||
#define YSTDLIB_ERROR_HANDLING_TRY(val, expr) BOOST_OUTCOME_TRY(auto&& val, expr) | ||
} // namespace ystdlib::error_handling | ||
|
||
#endif // YSTDLIB_ERROR_HANDLING_RESULT_HPP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.