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>
diff --git a/pw_assert/BUILD.gn b/pw_assert/BUILD.gn
index bf65d47..c9ba261 100644
--- a/pw_assert/BUILD.gn
+++ b/pw_assert/BUILD.gn
@@ -58,6 +58,7 @@
     # problem that light asserts are designed to solve.
     "public/pw_assert/options.h",
   ]
+  public_deps = [ dir_pw_preprocessor ]
 }
 
 # Note: While this is technically a test, doesn't verify any of the output and
diff --git a/pw_assert/assert_backend_compile_test_c.c b/pw_assert/assert_backend_compile_test_c.c
index 6743554..c602f37 100644
--- a/pw_assert/assert_backend_compile_test_c.c
+++ b/pw_assert/assert_backend_compile_test_c.c
@@ -32,6 +32,9 @@
   PW_CHECK_NOTNULL(0x0);
 }
 
+#include <stdbool.h>
+
+#include "pw_assert/light.h"
 #include "pw_status/status.h"
 
 #ifdef __cplusplus
@@ -196,7 +199,7 @@
     CHECK_INT_LE(x_int, y_int, "INT: " FAIL_IF_DISPLAYED_ARGS, z);
   }
 
-  {  // Compile tests for PW_ASSERT_OK().
+  {  // Compile tests for PW_CHECK_OK().
     PW_CHECK_OK(PW_STATUS_OK);
     PW_CHECK_OK(PW_STATUS_OK, "msg");
     PW_CHECK_OK(PW_STATUS_OK, "msg: %d", 5);
@@ -205,5 +208,19 @@
     PW_DCHECK_OK(PW_STATUS_OK, "msg: %d", 5);
   }
 
+  {  // TEST(Assert, Basic)
+    MAYBE_SKIP_TEST;
+    PW_ASSERT(false);
+    PW_ASSERT(123 == 456);
+  }
+
+  {  // Compile tests for PW_ASSERT().
+    PW_ASSERT(true);
+    PW_ASSERT(123 != 456);
+
+    PW_DASSERT(true);
+    PW_DASSERT(123 != 456);
+  }
+
   EnsureNullIsIncluded();
 }
diff --git a/pw_assert/public/pw_assert/light.h b/pw_assert/public/pw_assert/light.h
index f653338..95457a8 100644
--- a/pw_assert/public/pw_assert/light.h
+++ b/pw_assert/public/pw_assert/light.h
@@ -14,8 +14,13 @@
 #pragma once
 
 #include "pw_assert/options.h"  // For PW_ASSERT_ENABLE_DEBUG
+#include "pw_preprocessor/util.h"
 
-extern "C" void pw_assert_HandleFailure();
+PW_EXTERN_C_START
+
+void pw_assert_HandleFailure(void);
+
+PW_EXTERN_C_END
 
 // A header- and constexpr-safe version of PW_CHECK().
 //
diff --git a/pw_assert_basic/assert_basic.cc b/pw_assert_basic/assert_basic.cc
index 6db08ac..9af097c 100644
--- a/pw_assert_basic/assert_basic.cc
+++ b/pw_assert_basic/assert_basic.cc
@@ -156,7 +156,7 @@
   }
 }
 
-extern "C" void pw_assert_HandleFailure() {
+extern "C" void pw_assert_HandleFailure(void) {
 #if PW_ASSERT_DEBUG_ENABLED
   pw_Crash("", 0, "", "Crash: PW_ASSERT() or PW_DASSERT() failure");
 #else
diff --git a/pw_assert_log/assert_log.cc b/pw_assert_log/assert_log.cc
index 779af1b..2d835d9 100644
--- a/pw_assert_log/assert_log.cc
+++ b/pw_assert_log/assert_log.cc
@@ -14,7 +14,7 @@
 
 #include "pw_assert_log/assert_log.h"
 
-extern "C" void pw_assert_HandleFailure() {
+extern "C" void pw_assert_HandleFailure(void) {
 #if PW_ASSERT_DEBUG_ENABLED
   PW_LOG(PW_LOG_LEVEL_CRITICAL,
          PW_LOG_ASSERT_FAILED_FLAG,