-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[libc++][hardening] Update documentation in the light of P3878. #166294
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
base: main
Are you sure you want to change the base?
[libc++][hardening] Update documentation in the light of P3878. #166294
Conversation
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.
|
@llvm/pr-subscribers-libcxx Author: Konstantin Varlamov (var-const) ChangesWith P3878 applied to the Standard, a Hardened implementation is no Full diff: https://github.com/llvm/llvm-project/pull/166294.diff 2 Files Affected:
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)
|
| ``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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
With P3878 applied to the Standard, a Hardened implementation is no
longer allowed to use the
observesemantic (the new wording requiresa terminating semantic to be used); update the documentation to note
that using
observeis same asignore, i.e., does not result ina conforming Hardened implementation.