Commit Graph

2 Commits

Author SHA1 Message Date
Keir Mierle
854adece94 pw_assert: Add new "light" PW_ASSERT macros
This introduces two new macros: PW_ASSERT() and PW_DASSERT(). These
exist to offer a lightweight assert that is safe to use in headers and
is safe for constexpr. Most of the time, these macros should not be
used, and instead the PW_CHECK() and PW_DCHECK() variants used instead.

Other changes:

- Renames PW_ASSERT_ENABLE_DCHECK to PW_ASSERT_ENABLE_DEBUG, to reflect
  that the setting applies to both PW_CHECK and PW_ASSERT.
- Updates Roadamp & Status documentation sections

Testing: Since currently it is not possible to test the PW_ASSERT macros
due to needing to swap the backend, this is manually tested by flipping
the #if in pw_assert/light_test.cc to 1, and verifying that it crashes
as expected.

Change-Id: I6d2c68f772da4280e61a52576bfb6ab60e280bdf
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/17462
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Keir Mierle <keir@google.com>
2020-09-25 20:14:31 +00:00
Keir Mierle
b776cb2b83 pw_assert_log: Route asserts through log
This adds a new module, pw_assert_log, which routes asserts into the
logging backend with a flag set, which can be detected to terminate
execution. This will enable clean assert tokenization.

Change-Id: Id7d14bb35ee0aefd465f4ce109ac270d523a3ec1
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/16103
Commit-Queue: Keir Mierle <keir@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
2020-08-17 21:53:18 +00:00