nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gn...@apache.org
Subject [incubator-nuttx] branch master updated: sched/init/nx_start.c: Reinstate logic to remove compiler warning
Date Thu, 07 May 2020 19:49:22 GMT
This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 930a446  sched/init/nx_start.c: Reinstate logic to remove compiler warning
930a446 is described below

commit 930a446a7b8e218942f9d9c0c02daf01b2c3856c
Author: Nathan Hartman <59230071+hartmannathan@users.noreply.github.com>
AuthorDate: Thu May 7 15:06:05 2020 -0400

    sched/init/nx_start.c: Reinstate logic to remove compiler warning
    
    Revert a portion of eca70597858bc619d3114901d16e4a30f1ebffbe that
    causes compiler warnings about unused variables if nx_start() is not
    initializing any of the user-mode heap, kernel-mode heap, or page
    allocator:
    
        init/nx_start.c: In function 'nx_start':
        init/nx_start.c:552:14: warning: unused variable 'heap_size'
        [-Wunused-variable]
               size_t heap_size;
                      ^~~~~~~~~
        init/nx_start.c:551:17: warning: unused variable 'heap_start'
        [-Wunused-variable]
               FAR void *heap_start;
                         ^~~~~~~~~~
    
    See dev@nuttx.apache.org mailing list discussion "New unused variables
    warning in nx_start()" starting 6 May 2020, archived here:
    
    https://lists.apache.org/thread.html/r3900727e6a06f4445d6eb881d065119ba6647daab89600c3d45d1424%40%3Cdev.nuttx.apache.org%3E
    
    sched/init/nx_start.c:
    
        * If none of MM_KERNEL_USRHEAP_INIT, CONFIG_MM_KERNEL_HEAP, or
          CONFIG_MM_PGALLOC are defined, the variables heap_start and
          heap_size were declared but never used.
    
        * This change reinstates wrapping the block with a preprocessor
          conditional to prevent the variables being declared if they will
          not be used. This preprocessor condition was removed in the
          above-mentioned commit.
---
 sched/init/nx_start.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c
index 75abadd..b1c4d46 100644
--- a/sched/init/nx_start.c
+++ b/sched/init/nx_start.c
@@ -545,6 +545,8 @@ void nx_start(void)
 
   nxsem_initialize();
 
+#if defined(MM_KERNEL_USRHEAP_INIT) || defined(CONFIG_MM_KERNEL_HEAP) || \
+    defined(CONFIG_MM_PGALLOC)
   /* Initialize the memory manager */
 
     {
@@ -579,6 +581,7 @@ void nx_start(void)
       mm_pginitialize(heap_start, heap_size);
 #endif
     }
+#endif
 
 #ifdef CONFIG_ARCH_USE_MODULE_TEXT
   up_module_text_init();


Mime
View raw message