early-access version 3088

This commit is contained in:
pineappleEA
2022-11-05 15:35:56 +01:00
parent 4e4fc25ce3
commit b601909c6d
35519 changed files with 5996896 additions and 860 deletions

View File

@@ -0,0 +1,2 @@
/html/
/pdf/

View File

@@ -0,0 +1,23 @@
# Copyright 2017, 2018 Peter Dimov
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import asciidoctor ;
html system.html : system.adoc ;
install html_ : system.html : <location>html ;
pdf system.pdf : system.adoc ;
explicit system.pdf ;
install pdf_ : system.pdf : <location>pdf ;
explicit pdf_ ;
###############################################################################
alias boostdoc ;
explicit boostdoc ;
alias boostrelease : html_ ;
explicit boostrelease ;

View File

@@ -0,0 +1,6 @@
<style>
*:not(pre)>code { background: none; color: #600000; }
:not(pre):not([class^=L])>code { background: none; color: #600000; }
</style>

View File

@@ -0,0 +1,30 @@
////
Copyright 2018 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
See accompanying file LICENSE_1_0.txt or copy at
https://www.boost.org/LICENSE_1_0.txt
////
# Boost.System: Extensible Error Reporting
Beman Dawes, Christopher Kohlhoff, Peter Dimov
:toc: left
:toclevels: 4
:idprefix:
:docinfo: private-footer
:source-highlighter: rouge
:source-language: c++
:leveloffset: +1
include::system/introduction.adoc[]
include::system/usage.adoc[]
include::system/changes.adoc[]
include::system/rationale.adoc[]
include::system/reference.adoc[]
include::system/history.adoc[]
include::system/acknowledgements.adoc[]
include::system/copyright.adoc[]
:leveloffset: -1

View File

@@ -0,0 +1,19 @@
////
Copyright 2003-2017 Beman Dawes
Distributed under the Boost Software License, Version 1.0.
See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt
////
[#acknowledgments]
# Acknowledgments
:idprefix: ack_
Christopher Kohlhoff and Peter Dimov made important contributions to the
design. Comments and suggestions were also received from Pavel Vozenilek,
Gennaro Prota, Dave Abrahams, Jeff Garland, Iain Hanson, Oliver Kowalke, and
Oleg Abrosimov. Christopher Kohlhoff suggested several improvements to the
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2066.html[N2066]
paper. Johan Nilsson's comments led to several of the refinements in N2066.

View File

@@ -0,0 +1,123 @@
////
Copyright 2018-2022 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
https://www.boost.org/LICENSE_1_0.txt
////
[#changes]
# Revision History
:idprefix:
## Changes in Boost 1.79
* Added a `boost::source_location` parameter to `throw_exception_from_error`.
* Added `throw_exception_from_error` overloads for `errc::errc_t`,
`std::error_code`, `std::errc`, `std::exception_ptr`.
* `result<T>::value` now automatically supplies `BOOST_CURRENT_LOCATION` to
`throw_exception_from_error` via a default argument.
* Added an `errc::make_error_code` overload taking a source location.
## Changes in Boost 1.78
* Added support for source locations to `error_code`.
* Added `error_code::to_string`, `error_condition::to_string`, `error_code::what`.
* `system_error::what()` now contains the source location, if present.
* Added `result<T, E = error_code>`, a class holding either a value or an
error, defined in `<boost/system/result.hpp>`.
## Changes in Boost 1.77
* The conversion operator from `error_category` to `std::error_category`
has been improved and no longer requires `<map>` or `<mutex>`.
* The comparison operators of `error_category` are now inline friends
instead of member functions (a side effect of the previous change.)
* `error_condition` now defers calling `generic_category()` to avoid
instantiating the object until it's actually needed.
* `error_condition::failed` and `error_condition::message` have been
undeprecated, and `operator bool()` now once again returns `failed()`.
* The system category now doesn't call `generic_category()`, to avoid
instantiating the object.
* The return value of `default_error_condition` changes in some cases into
an `error_condition` from the generic category, instead of from the system
category. This happens on POSIX when the input `error_code` is from
the system category and does not correspond to any `errc_t` value.
* The interoperability of `error_code` and `std::error_code` has been
improved substantially. It is now possible to construct
`boost::system::error_code` from `std::error_code`, and it's possible
to pass `boost::system::error_code` to functions taking `std::error_code&`.
* A stream insertion operator for `error_condition` has been added.
## Changes in Boost 1.76
* `windows_error.hpp` is no longer deprecated.
## Changes in Boost 1.75
* The platform-specific headers `windows_error.hpp`, `linux_error.hpp`,
and `cygwin_error.hpp` emit deprecation messages and are slated for
removal.
* The old names for `generic_category()` and `system_category()` emit
deprecation messages and are slated for removal.
* `error_condition::failed` is deprecated and is slated for removal.
`operator bool()` for `error_condition` has been reverted to its old
meaning of `value() != 0`. This is done for compatibility with
`std::error_condition` as the next release is expected to improve
interoperability with `<system_error>` even further. _Note that this
does not affect_ `error_code::failed`, which is still alive and well.
* The overload of `error_condition::message` that takes a buffer is
deprecated and is slated for removal, for the same reasons. _Note that
this does not affect_ `error_code::message`.
## Changes in Boost 1.74
* `operator bool()` now returns `failed()` instead of `value() != 0`.
## Changes in Boost 1.69
* Boost.System is now header-only. A stub library is still built for
compatibility, but linking to it is no longer necessary.
* Even more functions have been marked `constexpr`.
* The destructor of `error_category` is now protected and no longer
virtual. This is a _potentially breaking change_ but its impact
is expected to be limited.
* `error_category` now has a constructor that accepts a 64 bit identifier,
enabling distinct category objects to compare equal.
* The constructors of `error_category` are now protected.
* A non-allocating, nonthrowing overload of `message` has been added.
* A virtual function `failed` has been added, allowing categories for
which success is not synonymous with 0.
* The deprecated `boost::system::throws` object has been removed.
* `boost::throws()` is now deprecated and its use is discouraged.
* The constructor of `system_error` taking a single `error_code` argument
is now explicit.
* `system_error::code()` now returns by value.
## Changes in Boost 1.68
On a {cpp}14 compiler, many Boost.System functions and member functions
are now `constexpr`, and `error_code` and `error_condition` are literal
classes.
In addition to enabling use in constant expressions (and `constexpr`
functions), this significantly improves the quality of the generated code.
As a result of this change, however, now using Boost.System from {cpp}14
or {cpp}17 code requires that the library be also built with {cpp}14 or
above. This is the default on GCC 6 and newer, but not on GCC 5 or Clang.
One can build Boost for {cpp}14 by passing the `cxxstd=14` option to `b2`.
(Previous versions allowed code built against any {cpp} standard to link
with Boost.System built against any {cpp} standard. In 1.68, code using
any {cpp} standard can link with Boost.System built with {cpp}14 or above,
but if Boost.System is built with {cpp}11 or below, only code also built
with {cpp}11 and below can link to it successfully.)
## Changes in Boost 1.65
On a {cpp}11 compiler, Boost.System now provides implicit conversions
from `boost::system::error_category`, `error_code`, and `error_condition`
to their standard equivalents from `<system_error>`.
This allows libraries to expose a {cpp}11 interface and report errors
via `std::error_code` even when using Boost.System, directly or through a
dependency such as Boost.ASIO.

View File

@@ -0,0 +1,19 @@
////
Copyright 2018-2021 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt
////
[#copyright]
# Copyright and License
:idprefix:
This documentation is
* Copyright 2003-2017 Beman Dawes
* Copyright 2018-2022 Peter Dimov
and is distributed under the http://www.boost.org/LICENSE_1_0.txt[Boost Software License, Version 1.0].

View File

@@ -0,0 +1,30 @@
////
Copyright 2003-2017 Beman Dawes
Distributed under the Boost Software License, Version 1.0.
See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt
////
[#history]
# History
:idprefix: history_
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1975.html[N1975],
Filesystem Library Proposal for TR2, accepted for Library Technical
Report 2 (TR2) at the Berlin meeting, included additional components to
supplement the Standard Library's Diagnostics clause. Since then, these error
reporting components have received wider public scrutiny and enhancements have
been made to the design. The enhanced version has been used by
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2054.pdf[N2054],
Networking Library Proposal for TR2, demonstrating that these error reporting
components are useful beyond the original Filesystem Library.
The original proposal viewed error categories as a binary choice between
`errno` (i.e. POSIX-style) and the native operating system's error
codes. The proposed components now allow as many additional error categories as
are needed by either implementations or by users. The need to support additional
error categories, for example, occurs in some networking library implementations
because they are built on top of the POSIX `getaddrinfo` API that
uses error codes not based on `errno`.

View File

@@ -0,0 +1,78 @@
////
Copyright 2003-2017 Beman Dawes
Copyright 2018, 2021 Peter Dimov
Distributed under the Boost Software License, Version 1.0.
See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt
////
[#introduction]
# Introduction
:idprefix: intro_
Errors originating from the operating system or other low-level application
program interfaces (APIs) are typically reported via an integer representing
an error code, either by returning the code directly from the function (e.g.
`pthread_mutex_init`) or by using a side channel such as the `errno`
pseudo-variable under POSIX or `GetLastError()` under Windows.
However, these integer error values can only be interpreted when their source
is known. The value 5 under Windows means `ERROR_ACCESS_DENIED` when returned
by `GetLastError()`, but `EIO` when retrieved from `errno`. And conversely,
the same error condition "access denied" is represented by the value 5 when
returned by `GetLastError()` and 13 (`EACCES`) when retrieved from `errno`.
This means that in order for code to be able to handle errors from both
sources (to retrieve a text message describing the error, or to check whether
the error means "access denied"), it needs to know where the integer error
value originated. For this to be possible, the integer error value needs to
be accompanied by a piece of information identifying the source.
Boost.System provides a framework in which this is possible. Errors are
represented by a class `error_code` which contains both the error value and
a pointer to their source (called "category"), represented as a class derived
from `error_category`.
The category provides member functions such as `message`, which returns a text
message for a specific error value, and `equivalent`, which can be used to test
whether a specific error value correspond to an error condition such as "access
denied". `error_code` uses these category-provided functions in the
implementation of its `message` and `operator==` member functions.
Boost.System contains two predefined category classes, the generic category
(a reference to which is returned by `generic_category()`) and the system
category (`system_category()`). The generic category represents the error
values of the portable subset of `errno` values defined by the POSIX standard,
whereas the system category is OS dependent. Under POSIX, the system category
represents the `errno` values returned by the OS APIs (a superset of those in
the generic category), whereas under Windows, the system category represents
the error values returned by `GetLastError()`.
The framework is extensible. Users can define their own categories by
deriving a class from `error_category` and implementing a function that
returns a reference to an instance of it. This capability is useful both for
describing library-defined error values, and for adapting existing C API
libraries that return integer error values.
For those who prefer error reporting via exceptions, Boost.System provides
a standard exception class `system_error` that stores an `error_code`.
Boost.System was standardized in {cpp}11 as `<system_error>`. For a while,
the two were equivalent, but Boost.System has evolved since then and now
contains a number of extensions over its standard sibling:
* A non-allocating overload of `message`;
* Support for nonzero error codes meaning success, via the `failed` member
functions;
* Support for 64 bit category identifiers, as a solution to the problem
that sometimes it's not possible to ensure that only one instance of a
category exists in the program;
* Support for attaching source locations (file/line/function) to error codes;
* A class `result<T>` that can be used to return either a value or an error
code from a function;
* Various other minor improvements.
`boost::system::error_code` can be converted to, and constructed from,
`std::error_code`.

View File

@@ -0,0 +1,27 @@
////
Copyright 2003-2017 Beman Dawes
Distributed under the Boost Software License, Version 1.0.
See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt
////
[#rationale]
# Design Rationale
:idprefix: rationale_
`error_code` and `error_condition` are designed as value types so
they can be copied without slicing and do not require heap allocation, but
still have polymorphic behavior based on the error category. This is achieved
by abstract base class `error_category` supplying the polymorphic behavior,
and `error_code` and `error_condition` containing a pointer to an object of a
type derived from `error_category`.
Many of the detailed design decisions were driven by the requirements that
users to be able to add additional error categories, and that it be no more
difficult to write portable code than system-specific code.
The `operator<<` overload for `error_code` eliminates a misleading conversion to
`bool` in code like `cout << ec`, where `ec` is of type `error_code`. It is also
useful in its own right.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff