sched/init/nx_start.c: Reinstate logic to remove compiler warning

Revert a portion of eca7059785 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.
This commit is contained in:
Nathan Hartman 2020-05-07 15:06:05 -04:00 committed by patacongo
parent 1ad03a5a13
commit 930a446a7b

View File

@ -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();