Commit Graph

5 Commits

Author SHA1 Message Date
Ewout van Bekkum
6f38a822ba pw_assert_log: fix pw_assert_HandleFailure to use FATAL
Fixes the pw_assert_HandleFailure implementation provided by
pw_assert_log by using PW_LOG_LEVEL_FATAL instead of
PW_LOG_LEVEL_CRITICAL.

Also updates the stale documentation to refer to the new
mechanism of using the fatal log level instead of a flag.

Change-Id: I738be4e5bea8307975001ab28b55999db32d6787
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/52480
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Ewout van Bekkum <ewout@google.com>
2021-07-08 21:43:30 +00:00
Wyatt Hepler
ebbce4c898 pw_log_tokenized: Log metadata updates
- Add an optional line number to the 32-bit log tokenized payload.
- Update default payload field widths.
       Log level:  3 bits
     Line number: 11 bits (up to 2047, 0 if larger)
           Flags:  2 bits (implementation defined)
    Module token: 16 bits
- Use the maximum log level to indicate that a log is an assert. This
  preserves an additional bit which can be used for the flags or line
  number.
- Store data as key-value pairs in the format string.
- Reorganize pw_log_tokenized tests and add C tests.

Change-Id: I1daa2e6ce40038f96857caeb38976cf48f620dc3
Requires: pigweed-internal:12920
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/47861
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
2021-06-08 02:43:41 +00:00
Ewout van Bekkum
e4d7b690c8 pw_build: add "-Wundef" to strict_warnings
Adds "-Wundef" to "strict_warnings" to catch use of accidentally
undefined macros which otherwise implicitly default to 0.

Updates macros across Pigweed to make it compile.

Drops support for PW_TEST_DONT_DEFINE_* in addition to
GTEST_DONT_DEFINE_*, instead only GTEST_DONT_DEFINE_* is used.

Change-Id: Id89f85f7cb8a52c1619bc0f7262349310203067b
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/21463
Reviewed-by: Alexei Frolov <frolv@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Ewout van Bekkum <ewout@google.com>
2020-10-16 23:28:19 +00:00
Wyatt Hepler
dd3e881a02 pw_assert: Only extern "C" in C++
- Use PW_EXTERN_C_* for the pw_assert_HandleFailure function.
- Specify a void parameter since this is a C function.
- Add C tests for PW_ASSERT.

Change-Id: Ica24e8f4e358381e95b3c95daab8dfc3a8669d43
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19200
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
2020-09-29 21:44:00 +00:00
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