Fix optimized C++ warnings

These are only used in asserts

Closes #13386.

PiperOrigin-RevId: 375891195
diff --git a/src/main/native/unix_jni_darwin.cc b/src/main/native/unix_jni_darwin.cc
index 3cf3480..48ce07b 100644
--- a/src/main/native/unix_jni_darwin.cc
+++ b/src/main/native/unix_jni_darwin.cc
@@ -191,7 +191,7 @@
     assert(g_sleep_state_assertion == kIOPMNullAssertionID);
     CFStringRef reasonForActivity = CFSTR("build.bazel");
 
-    IOReturn success = IOPMAssertionCreateWithName(
+    __unused IOReturn success = IOPMAssertionCreateWithName(
         kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, reasonForActivity,
         &g_sleep_state_assertion);
     assert(success == kIOReturnSuccess);
@@ -207,7 +207,7 @@
   g_sleep_state_stack -= 1;
   if (g_sleep_state_stack == 0) {
     assert(g_sleep_state_assertion != kIOPMNullAssertionID);
-    IOReturn success = IOPMAssertionRelease(g_sleep_state_assertion);
+    __unused IOReturn success = IOPMAssertionRelease(g_sleep_state_assertion);
     assert(success == kIOReturnSuccess);
     g_sleep_state_assertion = kIOPMNullAssertionID;
     log_if_possible("sleep assertion released");