commit | 70d609ef8264fc3d93c8bfa2c3cdcb9cbd4a6143 | [log] [tgz] |
---|---|---|
author | Victor Berchet <berchet@google.com> | Fri Nov 10 01:28:10 2023 -0800 |
committer | Victor Berchet <berchet@google.com> | Mon Nov 13 07:24:09 2023 +0000 |
tree | 442c4377ec0f9858c49c41e23a73c5d332e3ff0e | |
parent | d96dd729e5d3712476b73e7d5562281aa78254ef [diff] |
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