Skip to content

Commit c79bd04

Browse files
committed
- Something I've been meaning to do for far too long now is make the GDB pretty printers
auto-loading so you don't have to set up `.gdbinit`. This is now done. I also improved the pretty printers to also pretty print the C result type which can be very useful if working with that type, as it will print the error message in GDB. Experimental Outcome's `status_code` has also gained its own auto-loading GDB pretty printer with display of `strerror()` if the code domain is POSIX or generic.
1 parent 571f9c9 commit c79bd04

File tree

13 files changed

+1302
-501
lines changed

13 files changed

+1302
-501
lines changed

doc/html

Submodule html updated 471 files

doc/src/content/changelog/_index.md

+16-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,22 @@ weight = 80
44
+++
55

66
---
7-
## v2.2.9 ? (Boost 1.85) [[release]](https://github.com/ned14/outcome/releases/tag/v2.2.9)
7+
## v2.2.10 ? (Boost 1.86) [[release]](https://github.com/ned14/outcome/releases/tag/v2.2.10)
8+
9+
### Enhancements:
10+
11+
- Something I've been meaning to do for far too long now is make the GDB pretty printers
12+
auto-loading so you don't have to set up `.gdbinit`. This is now done. I also improved
13+
the pretty printers to also pretty print the C result type which can be very useful if
14+
working with that type, as it will print the error message in GDB.
15+
16+
Experimental Outcome's `status_code` has also gained its own auto-loading GDB pretty printer
17+
with display of `strerror()` if the code domain is POSIX or generic.
18+
19+
### Bug fixes:
20+
21+
---
22+
## v2.2.9 15th April 2024 (Boost 1.85) [[release]](https://github.com/ned14/outcome/releases/tag/v2.2.9)
823

924
### Enhancements:
1025

@@ -24,8 +39,6 @@ realised at the time that in Boost.Outcome this resulted in
2439
This has now been remedied to remove the double `status-code`, which will obviously break
2540
any Boost.Outcome code which relies on the double `status-code`. Standalone Outcome is unaffected.
2641

27-
### Bug fixes:
28-
2942
---
3043
## v2.2.8 13th December 2023 (Boost 1.84) [[release]](https://github.com/ned14/outcome/releases/tag/v2.2.8)
3144

include/outcome/basic_outcome.hpp

+52-44
Large diffs are not rendered by default.

include/outcome/basic_result.hpp

+41-25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* A very simple result type
2-
(C) 2017-2021 Niall Douglas <http://www.nedproductions.biz/> (14 commits)
2+
(C) 2017-2024 Niall Douglas <http://www.nedproductions.biz/> (14 commits)
33
File Created: June 2017
44
55
@@ -28,6 +28,7 @@ Distributed under the Boost Software License, Version 1.0.
2828
#include "config.hpp"
2929
#include "convert.hpp"
3030
#include "detail/basic_result_final.hpp"
31+
#include "outcome_gdb.h"
3132

3233
#include "policy/all_narrow.hpp"
3334
#include "policy/terminate.hpp"
@@ -136,16 +137,31 @@ namespace detail
136137
&& !std::is_same<choose_inplace_value_error_constructor<Args...>, disable_inplace_value_error_constructor>::value;
137138
};
138139

139-
template <class T, class U> constexpr inline const U &extract_value_from_success(const success_type<U> &v) { return v.value(); }
140-
template <class T, class U> constexpr inline U &&extract_value_from_success(success_type<U> &&v) { return static_cast<success_type<U> &&>(v).value(); }
141-
template <class T> constexpr inline T extract_value_from_success(const success_type<void> & /*unused*/) { return T{}; }
140+
template <class T, class U> constexpr inline const U &extract_value_from_success(const success_type<U> &v)
141+
{
142+
return v.value();
143+
}
144+
template <class T, class U> constexpr inline U &&extract_value_from_success(success_type<U> &&v)
145+
{
146+
return static_cast<success_type<U> &&>(v).value();
147+
}
148+
template <class T> constexpr inline T extract_value_from_success(const success_type<void> & /*unused*/)
149+
{
150+
return T{};
151+
}
142152

143-
template <class T, class U, class V> constexpr inline const U &extract_error_from_failure(const failure_type<U, V> &v) { return v.error(); }
153+
template <class T, class U, class V> constexpr inline const U &extract_error_from_failure(const failure_type<U, V> &v)
154+
{
155+
return v.error();
156+
}
144157
template <class T, class U, class V> constexpr inline U &&extract_error_from_failure(failure_type<U, V> &&v)
145158
{
146159
return static_cast<failure_type<U, V> &&>(v).error();
147160
}
148-
template <class T, class V> constexpr inline T extract_error_from_failure(const failure_type<void, V> & /*unused*/) { return T{}; }
161+
template <class T, class V> constexpr inline T extract_error_from_failure(const failure_type<void, V> & /*unused*/)
162+
{
163+
return T{};
164+
}
149165

150166
template <class T> struct is_basic_result
151167
{
@@ -355,7 +371,7 @@ class OUTCOME_NODISCARD basic_result : public detail::basic_result_final<R, S, N
355371
template <class... Args>
356372
static constexpr bool enable_inplace_value_error_constructor = //
357373
constructors_enabled //
358-
&&base::template enable_inplace_value_error_constructor<Args...>;
374+
&& base::template enable_inplace_value_error_constructor<Args...>;
359375
template <class... Args> using choose_inplace_value_error_constructor = typename base::template choose_inplace_value_error_constructor<Args...>;
360376
};
361377

@@ -387,7 +403,7 @@ SIGNATURE NOT RECOGNISED
387403
*/
388404
OUTCOME_TEMPLATE(class Arg, class... Args)
389405
OUTCOME_TREQUIRES(OUTCOME_TPRED(!predicate::constructors_enabled && (sizeof...(Args) >= 0)))
390-
basic_result(Arg && /*unused*/, Args &&... /*unused*/) = delete; // NOLINT basic_result<T, T> is NOT SUPPORTED, see docs!
406+
basic_result(Arg && /*unused*/, Args &&.../*unused*/) = delete; // NOLINT basic_result<T, T> is NOT SUPPORTED, see docs!
391407

392408
/*! AWAITING HUGO JSON CONVERSION TOOL
393409
SIGNATURE NOT RECOGNISED
@@ -451,8 +467,8 @@ SIGNATURE NOT RECOGNISED
451467
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_compatible_conversion<T, U, V>))
452468
constexpr explicit basic_result(
453469
const basic_result<T, U, V> &o,
454-
explicit_compatible_copy_conversion_tag /*unused*/ =
455-
explicit_compatible_copy_conversion_tag()) noexcept(detail::is_nothrow_constructible<value_type, T> &&detail::is_nothrow_constructible<error_type, U>)
470+
explicit_compatible_copy_conversion_tag /*unused*/ = explicit_compatible_copy_conversion_tag()) noexcept(detail::is_nothrow_constructible<value_type, T> &&
471+
detail::is_nothrow_constructible<error_type, U>)
456472
: base{typename base::compatible_conversion_tag(), o}
457473
{
458474
no_value_policy_type::on_result_copy_construction(this, o);
@@ -464,8 +480,8 @@ SIGNATURE NOT RECOGNISED
464480
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_compatible_conversion<T, U, V>))
465481
constexpr explicit basic_result(
466482
basic_result<T, U, V> &&o,
467-
explicit_compatible_move_conversion_tag /*unused*/ =
468-
explicit_compatible_move_conversion_tag()) noexcept(detail::is_nothrow_constructible<value_type, T> &&detail::is_nothrow_constructible<error_type, U>)
483+
explicit_compatible_move_conversion_tag /*unused*/ = explicit_compatible_move_conversion_tag()) noexcept(detail::is_nothrow_constructible<value_type, T> &&
484+
detail::is_nothrow_constructible<error_type, U>)
469485
: base{typename base::compatible_conversion_tag(), static_cast<basic_result<T, U, V> &&>(o)}
470486
{
471487
no_value_policy_type::on_result_move_construction(this, static_cast<basic_result<T, U, V> &&>(o));
@@ -477,8 +493,8 @@ SIGNATURE NOT RECOGNISED
477493
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_make_error_code_compatible_conversion<T, U, V>))
478494
constexpr explicit basic_result(const basic_result<T, U, V> &o,
479495
explicit_make_error_code_compatible_copy_conversion_tag /*unused*/ =
480-
explicit_make_error_code_compatible_copy_conversion_tag()) noexcept(detail::is_nothrow_constructible<value_type, T>
481-
&&noexcept(make_error_code(std::declval<U>())))
496+
explicit_make_error_code_compatible_copy_conversion_tag()) noexcept(detail::is_nothrow_constructible<value_type, T> &&
497+
noexcept(make_error_code(std::declval<U>())))
482498
: base{typename base::make_error_code_compatible_conversion_tag(), o}
483499
{
484500
no_value_policy_type::on_result_copy_construction(this, o);
@@ -490,8 +506,8 @@ SIGNATURE NOT RECOGNISED
490506
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_make_error_code_compatible_conversion<T, U, V>))
491507
constexpr explicit basic_result(basic_result<T, U, V> &&o,
492508
explicit_make_error_code_compatible_move_conversion_tag /*unused*/ =
493-
explicit_make_error_code_compatible_move_conversion_tag()) noexcept(detail::is_nothrow_constructible<value_type, T>
494-
&&noexcept(make_error_code(std::declval<U>())))
509+
explicit_make_error_code_compatible_move_conversion_tag()) noexcept(detail::is_nothrow_constructible<value_type, T> &&
510+
noexcept(make_error_code(std::declval<U>())))
495511
: base{typename base::make_error_code_compatible_conversion_tag(), static_cast<basic_result<T, U, V> &&>(o)}
496512
{
497513
no_value_policy_type::on_result_move_construction(this, static_cast<basic_result<T, U, V> &&>(o));
@@ -503,8 +519,8 @@ SIGNATURE NOT RECOGNISED
503519
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_make_exception_ptr_compatible_conversion<T, U, V>))
504520
constexpr explicit basic_result(const basic_result<T, U, V> &o,
505521
explicit_make_exception_ptr_compatible_copy_conversion_tag /*unused*/ =
506-
explicit_make_exception_ptr_compatible_copy_conversion_tag()) noexcept(detail::is_nothrow_constructible<value_type, T>
507-
&&noexcept(make_exception_ptr(std::declval<U>())))
522+
explicit_make_exception_ptr_compatible_copy_conversion_tag()) noexcept(detail::is_nothrow_constructible<value_type, T> &&
523+
noexcept(make_exception_ptr(std::declval<U>())))
508524
: base{typename base::make_exception_ptr_compatible_conversion_tag(), o}
509525
{
510526
no_value_policy_type::on_result_copy_construction(this, o);
@@ -516,8 +532,8 @@ SIGNATURE NOT RECOGNISED
516532
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_make_exception_ptr_compatible_conversion<T, U, V>))
517533
constexpr explicit basic_result(basic_result<T, U, V> &&o,
518534
explicit_make_exception_ptr_compatible_move_conversion_tag /*unused*/ =
519-
explicit_make_exception_ptr_compatible_move_conversion_tag()) noexcept(detail::is_nothrow_constructible<value_type, T>
520-
&&noexcept(make_exception_ptr(std::declval<U>())))
535+
explicit_make_exception_ptr_compatible_move_conversion_tag()) noexcept(detail::is_nothrow_constructible<value_type, T> &&
536+
noexcept(make_exception_ptr(std::declval<U>())))
521537
: base{typename base::make_exception_ptr_compatible_conversion_tag(), static_cast<basic_result<T, U, V> &&>(o)}
522538
{
523539
no_value_policy_type::on_result_move_construction(this, static_cast<basic_result<T, U, V> &&>(o));
@@ -528,7 +544,7 @@ SIGNATURE NOT RECOGNISED
528544
*/
529545
OUTCOME_TEMPLATE(class... Args)
530546
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_inplace_value_constructor<Args...>))
531-
constexpr explicit basic_result(in_place_type_t<value_type_if_enabled> _, Args &&... args) noexcept(detail::is_nothrow_constructible<value_type, Args...>)
547+
constexpr explicit basic_result(in_place_type_t<value_type_if_enabled> _, Args &&...args) noexcept(detail::is_nothrow_constructible<value_type, Args...>)
532548
: base{_, static_cast<Args &&>(args)...}
533549
{
534550
no_value_policy_type::on_result_in_place_construction(this, in_place_type<value_type>, static_cast<Args &&>(args)...);
@@ -539,7 +555,7 @@ SIGNATURE NOT RECOGNISED
539555
OUTCOME_TEMPLATE(class U, class... Args)
540556
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_inplace_value_constructor<std::initializer_list<U>, Args...>))
541557
constexpr explicit basic_result(in_place_type_t<value_type_if_enabled> _, std::initializer_list<U> il,
542-
Args &&... args) noexcept(detail::is_nothrow_constructible<value_type, std::initializer_list<U>, Args...>)
558+
Args &&...args) noexcept(detail::is_nothrow_constructible<value_type, std::initializer_list<U>, Args...>)
543559
: base{_, il, static_cast<Args &&>(args)...}
544560
{
545561
no_value_policy_type::on_result_in_place_construction(this, in_place_type<value_type>, il, static_cast<Args &&>(args)...);
@@ -549,7 +565,7 @@ SIGNATURE NOT RECOGNISED
549565
*/
550566
OUTCOME_TEMPLATE(class... Args)
551567
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_inplace_error_constructor<Args...>))
552-
constexpr explicit basic_result(in_place_type_t<error_type_if_enabled> _, Args &&... args) noexcept(detail::is_nothrow_constructible<error_type, Args...>)
568+
constexpr explicit basic_result(in_place_type_t<error_type_if_enabled> _, Args &&...args) noexcept(detail::is_nothrow_constructible<error_type, Args...>)
553569
: base{_, static_cast<Args &&>(args)...}
554570
{
555571
no_value_policy_type::on_result_in_place_construction(this, in_place_type<error_type>, static_cast<Args &&>(args)...);
@@ -560,7 +576,7 @@ SIGNATURE NOT RECOGNISED
560576
OUTCOME_TEMPLATE(class U, class... Args)
561577
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_inplace_error_constructor<std::initializer_list<U>, Args...>))
562578
constexpr explicit basic_result(in_place_type_t<error_type_if_enabled> _, std::initializer_list<U> il,
563-
Args &&... args) noexcept(detail::is_nothrow_constructible<error_type, std::initializer_list<U>, Args...>)
579+
Args &&...args) noexcept(detail::is_nothrow_constructible<error_type, std::initializer_list<U>, Args...>)
564580
: base{_, il, static_cast<Args &&>(args)...}
565581
{
566582
no_value_policy_type::on_result_in_place_construction(this, in_place_type<error_type>, il, static_cast<Args &&>(args)...);
@@ -570,7 +586,7 @@ SIGNATURE NOT RECOGNISED
570586
*/
571587
OUTCOME_TEMPLATE(class A1, class A2, class... Args)
572588
OUTCOME_TREQUIRES(OUTCOME_TPRED(predicate::template enable_inplace_value_error_constructor<A1, A2, Args...>))
573-
constexpr basic_result(A1 &&a1, A2 &&a2, Args &&... args) noexcept(noexcept(
589+
constexpr basic_result(A1 &&a1, A2 &&a2, Args &&...args) noexcept(noexcept(
574590
typename predicate::template choose_inplace_value_error_constructor<A1, A2, Args...>(std::declval<A1>(), std::declval<A2>(), std::declval<Args>()...)))
575591
: basic_result(in_place_type<typename predicate::template choose_inplace_value_error_constructor<A1, A2, Args...>>, static_cast<A1 &&>(a1),
576592
static_cast<A2 &&>(a2), static_cast<Args &&>(args)...)

include/outcome/detail/revision.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ Distributed under the Boost Software License, Version 1.0.
2222
*/
2323

2424
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
25-
#define OUTCOME_PREVIOUS_COMMIT_REF 893c2d0fb8f00b7afe8daf4a6f2782f3d11fc1ae
26-
#define OUTCOME_PREVIOUS_COMMIT_DATE "2023-12-16 22:34:16 +00:00"
27-
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE 893c2d0f
25+
#define OUTCOME_PREVIOUS_COMMIT_REF 571f9c930e672950e99d5d30f743603aaaf8014c
26+
#define OUTCOME_PREVIOUS_COMMIT_DATE "2024-03-13 20:29:49 +00:00"
27+
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE 571f9c93

include/outcome/experimental/result.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* C interface for result
2-
(C) 2017-2020 Niall Douglas <http://www.nedproductions.biz/> (6 commits)
2+
(C) 2017-2024 Niall Douglas <http://www.nedproductions.biz/> (6 commits)
33
File Created: Aug 2017
44
55
@@ -27,6 +27,8 @@ Distributed under the Boost Software License, Version 1.0.
2727

2828
#include <stdint.h> // for intptr_t
2929

30+
#include "../outcome_gdb.h"
31+
3032
#ifdef __cplusplus
3133
extern "C"
3234
{

include/outcome/outcome.gdb.py

-58
This file was deleted.

0 commit comments

Comments
 (0)