Skip to content

Conversation

@var-const
Copy link
Member

With P3878 applied to the Standard, a Hardened implementation is no
longer allowed to use the observe semantic (the new wording requires
a terminating semantic to be used); update the documentation to note
that using observe is same as ignore, i.e., does not result in
a conforming Hardened implementation.

With P3878 applied to the Standard, a Hardened implementation is no
longer allowed to use the `observe` semantic (the new wording requires
a terminating semantic to be used); update the documentation to note
that using `observe` is same as `ignore`, i.e., does not result in
a conforming Hardened implementation.
@var-const var-const requested a review from a team as a code owner November 4, 2025 03:20
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Nov 4, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 4, 2025

@llvm/pr-subscribers-libcxx

Author: Konstantin Varlamov (var-const)

Changes

With P3878 applied to the Standard, a Hardened implementation is no
longer allowed to use the observe semantic (the new wording requires
a terminating semantic to be used); update the documentation to note
that using observe is same as ignore, i.e., does not result in
a conforming Hardened implementation.


Full diff: https://github.com/llvm/llvm-project/pull/166294.diff

2 Files Affected:

  • (modified) libcxx/docs/Hardening.rst (+5-5)
  • (modified) libcxx/include/__config (+4-4)
diff --git a/libcxx/docs/Hardening.rst b/libcxx/docs/Hardening.rst
index 1cdb3605c38ab..206e8c34b94d0 100644
--- a/libcxx/docs/Hardening.rst
+++ b/libcxx/docs/Hardening.rst
@@ -305,11 +305,11 @@ Notes:
   behavior; the ``observe`` semantic is meant to make adopting hardening easier
   but should not be used outside of the adoption period;
 - C++26 wording for Library Hardening precludes a conforming Hardened
-  implementation from using the Contracts ``ignore`` semantic when evaluating
-  hardened preconditions in the Library. Libc++ allows using this semantic for
-  hardened preconditions, but please be aware that using ``ignore`` does not
-  produce a conforming "Hardened" implementation, unlike the other semantics
-  above.
+  implementation from using a Contracts' non-terminating semantic (i.e.,
+  ``ignore`` or ``observe``) when evaluating hardened preconditions in the
+  Library. Libc++ allows using these semantics for hardened preconditions, but
+  please be aware that using ``ignore`` or ``observe`` does not produce
+  a conforming "Hardened" implementation, unlike the terminating semantics above.
 
 The default assertion semantics are as follows:
 
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 357f77b7d27d6..851131a15adb8 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -193,10 +193,10 @@ _LIBCPP_HARDENING_MODE_DEBUG
 // Notes:
 // - Continuing execution after a hardening check fails results in undefined behavior; the `observe` semantic is meant
 //   to make adopting hardening easier but should not be used outside of this scenario;
-// - C++26 wording for Library Hardening precludes a conforming Hardened implementation from using the Contracts
-//   `ignore` semantic when evaluating hardened preconditions in the Library. Libc++ allows using this semantic for
-//   hardened preconditions, however, be aware that using `ignore` does not produce a conforming "Hardened"
-//   implementation, unlike the other semantics above.
+// - C++26 wording for Library Hardening precludes a conforming Hardened implementation from using a Contracts'
+//   non-terminating semantic (i.e., `ignore` or ``observe``) when evaluating hardened preconditions in the Library.
+//   Libc++ allows using these semantics for hardened preconditions, however, be aware that using `ignore` or `observe`
+//   does not produce a conforming "Hardened" implementation, unlike the terminating semantics above.
 // clang-format off
 #  define _LIBCPP_ASSERTION_SEMANTIC_IGNORE        (1 << 1)
 #  define _LIBCPP_ASSERTION_SEMANTIC_OBSERVE       (1 << 2)

@var-const var-const added the hardening Issues related to the hardening effort label Nov 4, 2025
``ignore`` or ``observe``) when evaluating hardened preconditions in the
Library. Libc++ allows using these semantics for hardened preconditions, but
please be aware that using ``ignore`` or ``observe`` does not produce
a conforming "Hardened" implementation, unlike the terminating semantics above.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
a conforming "Hardened" implementation, unlike the terminating semantics above.
a "Hardened" implementation, unlike the terminating semantics above.

Would be better IMO - we're not a hardened implementation in these cases so there isn't much of a point in claiming "we're a non-conforming implementation", which makes it sound like we're just technically not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hardening Issues related to the hardening effort libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants