Mark chreAbort as noreturn

Bug: 310051436
Test: presubmit
Change-Id: I6fa5b7c40f11c30d0edff4e843524580f0b132e1
diff --git a/chre_api/include/chre_api/chre/re.h b/chre_api/include/chre_api/chre/re.h
index b654387..1efa5d3 100644
--- a/chre_api/include/chre_api/chre/re.h
+++ b/chre_api/include/chre_api/chre/re.h
@@ -366,7 +366,7 @@
  * @return Never.  This method does not return, as the CHRE stops nanoapp
  *    execution immediately.
  */
-void chreAbort(uint32_t abortCode);
+void chreAbort(uint32_t abortCode) CHRE_NO_RETURN;
 
 /**
  * Allocate a given number of bytes from the system heap.
diff --git a/platform/include/chre/platform/fatal_error.h b/platform/include/chre/platform/fatal_error.h
index 0c301db..f272eba 100644
--- a/platform/include/chre/platform/fatal_error.h
+++ b/platform/include/chre/platform/fatal_error.h
@@ -40,6 +40,9 @@
   do {                        \
     LOGE(fmt, ##__VA_ARGS__); \
     FATAL_ERROR_QUIT();       \
+    while (1) {               \
+      /* never return */      \
+    }                         \
   } while (0)
 
 /**
diff --git a/platform/shared/nanoapp/nanoapp_stack_check.cc b/platform/shared/nanoapp/nanoapp_stack_check.cc
index 8276630..3f6b24b 100644
--- a/platform/shared/nanoapp/nanoapp_stack_check.cc
+++ b/platform/shared/nanoapp/nanoapp_stack_check.cc
@@ -40,10 +40,7 @@
 void __stack_chk_fail(void) CHRE_NO_RETURN;
 void __stack_chk_fail(void) {
   LOGE("Stack corruption detected");
-  // Enclose in while(true) to satisfy CHRE_NO_RETURN.
-  while (true) {
-    chreAbort(/*abortCode=*/0);
-  }
+  chreAbort(/*abortCode=*/0);
 }
 
 #ifdef __cplusplus