darling-libcxx/docs
Roman Lebedev caf40ae419 [libc++] Add _LIBCPP_ENABLE_NODISCARD and _LIBCPP_NODISCARD_EXT to allow pre-C++2a [[nodiscard]]
Summary:
The `[[nodiscard]]` attribute is intended to help users find bugs where
function return values are ignored when they shouldn't be. After C++17 the
C++ standard has started to declared such library functions as `[[nodiscard]]`.
However, this application is limited and applies only to dialects after C++17.
Users who want help diagnosing misuses of STL functions may desire a more
liberal application of `[[nodiscard]]`.

For this reason libc++ provides an extension that does just that! The
extension must be enabled by defining `_LIBCPP_ENABLE_NODISCARD`. The extended
applications of `[[nodiscard]]` takes two forms:

1. Backporting `[[nodiscard]]` to entities declared as such by the
   standard in newer dialects, but not in the present one.

2. Extended applications of `[[nodiscard]]`, at the libraries discretion,
   applied to entities never declared as such by the standard.

Users may also opt-out of additional applications `[[nodiscard]]` using
additional macros.

Applications of the first form, which backport `[[nodiscard]]` from a newer
dialect may be disabled using macros specific to the dialect it was added. For
example `_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17`.

Applications of the second form, which are pure extensions, may be disabled
by defining `_LIBCPP_DISABLE_NODISCARD_EXT`.

This patch was originally written by me (Roman Lebedev),
then but then reworked by Eric Fiselier.

Reviewers: mclow.lists, thakis, EricWF

Reviewed By: thakis, EricWF

Subscribers: llvm-commits, mclow.lists, lebedev.ri, EricWF, rjmccall, Quuxplusone, cfe-commits, christof

Differential Revision: https://reviews.llvm.org/D45179

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342808 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-22 17:54:48 +00:00
..
DesignDocs fix some typos in the doc 2018-09-20 08:05:01 +00:00
BuildingLibcxx.rst [libcxx] By default, do not use internal_linkage to hide symbols from the ABI 2018-08-16 12:44:28 +00:00
CMakeLists.txt docs: Fix Sphinx detection with out-of-tree builds 2017-05-09 11:18:03 +00:00
conf.py fix some typos in the doc 2018-09-20 08:05:01 +00:00
index.rst refresh the libc++ homepage 2018-09-20 07:57:31 +00:00
Makefile.sphinx Add design docs for upcoming file_time_type change. 2018-07-25 02:53:53 +00:00
README.txt Remove test commit. 2015-09-05 05:38:50 +00:00
ReleaseNotes.rst ReleaseNotes: update links to use https 2018-09-10 08:57:12 +00:00
TestingLibcxx.rst Teach test suite about C++2a dialect flag. 2017-11-07 20:26:23 +00:00
UsingLibcxx.rst [libc++] Add _LIBCPP_ENABLE_NODISCARD and _LIBCPP_NODISCARD_EXT to allow pre-C++2a [[nodiscard]] 2018-09-22 17:54:48 +00:00

libc++ Documentation
====================

The libc++ documentation is written using the Sphinx documentation generator. It is
currently tested with Sphinx 1.1.3.

To build the documents into html configure libc++ with the following cmake options:

  * -DLLVM_ENABLE_SPHINX=ON
  * -DLIBCXX_INCLUDE_DOCS=ON

After configuring libc++ with these options the make rule `docs-libcxx-html`
should be available.