From ca21aed0a11903db04fc96056f8a08e452aaf504 Mon Sep 17 00:00:00 2001
From: Damien George <damien.p.george@gmail.com>
Date: Thu, 31 Aug 2017 17:00:14 +1000
Subject: [PATCH] py: Make m_malloc_fail() have void return type, since it
 doesn't return.

---
 py/malloc.c  | 8 ++++----
 py/misc.h    | 2 +-
 py/runtime.c | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/py/malloc.c b/py/malloc.c
index af4ccf2e8..ea1d4c4b9 100644
--- a/py/malloc.c
+++ b/py/malloc.c
@@ -74,7 +74,7 @@ STATIC void *realloc_ext(void *ptr, size_t n_bytes, bool allow_move) {
 void *m_malloc(size_t num_bytes) {
     void *ptr = malloc(num_bytes);
     if (ptr == NULL && num_bytes != 0) {
-        return m_malloc_fail(num_bytes);
+        m_malloc_fail(num_bytes);
     }
 #if MICROPY_MEM_STATS
     MP_STATE_MEM(total_bytes_allocated) += num_bytes;
@@ -100,7 +100,7 @@ void *m_malloc_maybe(size_t num_bytes) {
 void *m_malloc_with_finaliser(size_t num_bytes) {
     void *ptr = malloc_with_finaliser(num_bytes);
     if (ptr == NULL && num_bytes != 0) {
-        return m_malloc_fail(num_bytes);
+        m_malloc_fail(num_bytes);
     }
 #if MICROPY_MEM_STATS
     MP_STATE_MEM(total_bytes_allocated) += num_bytes;
@@ -115,7 +115,7 @@ void *m_malloc_with_finaliser(size_t num_bytes) {
 void *m_malloc0(size_t num_bytes) {
     void *ptr = m_malloc(num_bytes);
     if (ptr == NULL && num_bytes != 0) {
-        return m_malloc_fail(num_bytes);
+        m_malloc_fail(num_bytes);
     }
     // If this config is set then the GC clears all memory, so we don't need to.
     #if !MICROPY_GC_CONSERVATIVE_CLEAR
@@ -131,7 +131,7 @@ void *m_realloc(void *ptr, size_t new_num_bytes) {
 #endif
     void *new_ptr = realloc(ptr, new_num_bytes);
     if (new_ptr == NULL && new_num_bytes != 0) {
-        return m_malloc_fail(new_num_bytes);
+        m_malloc_fail(new_num_bytes);
     }
 #if MICROPY_MEM_STATS
     // At first thought, "Total bytes allocated" should only grow,
diff --git a/py/misc.h b/py/misc.h
index 71425b85e..b9f2dae90 100644
--- a/py/misc.h
+++ b/py/misc.h
@@ -92,7 +92,7 @@ void *m_realloc(void *ptr, size_t new_num_bytes);
 void *m_realloc_maybe(void *ptr, size_t new_num_bytes, bool allow_move);
 void m_free(void *ptr);
 #endif
-NORETURN void *m_malloc_fail(size_t num_bytes);
+NORETURN void m_malloc_fail(size_t num_bytes);
 
 #if MICROPY_MEM_STATS
 size_t m_get_total_bytes_allocated(void);
diff --git a/py/runtime.c b/py/runtime.c
index 1db6c93c3..21ef42577 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -1408,7 +1408,7 @@ mp_obj_t mp_parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t parse_i
 
 #endif // MICROPY_ENABLE_COMPILER
 
-NORETURN void *m_malloc_fail(size_t num_bytes) {
+NORETURN void m_malloc_fail(size_t num_bytes) {
     DEBUG_printf("memory allocation failed, allocating %u bytes\n", (uint)num_bytes);
     #if MICROPY_ENABLE_GC
     if (gc_is_locked()) {
-- 
GitLab