From 2dae0ef0db0141c3625d02007b111d3aa0fd6eec Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 3 Jun 2019 09:02:55 -0600 Subject: [PATCH] mm/mm_heap/mm_sem.c: Fix error that occurs when CONFIG_CPP_HAVE_VARARGS is not defined. In that case, the arguments to the debug macro will all be evaluated even though they are not used any variables that are references must at least be defined. --- libs/libc/syslog/lib_syslog.c | 2 ++ mm/mm_heap/mm_sem.c | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/libs/libc/syslog/lib_syslog.c b/libs/libc/syslog/lib_syslog.c index 8bbe16f2c0..311579c5b3 100644 --- a/libs/libc/syslog/lib_syslog.c +++ b/libs/libc/syslog/lib_syslog.c @@ -40,6 +40,7 @@ #include +#include #include #include @@ -110,3 +111,4 @@ void syslog(int priority, FAR const IPTR char *fmt, ...) vsyslog(priority, fmt, ap); va_end(ap); } + diff --git a/mm/mm_heap/mm_sem.c b/mm/mm_heap/mm_sem.c index 7391c0179b..f59018ef94 100644 --- a/mm/mm_heap/mm_sem.c +++ b/mm/mm_heap/mm_sem.c @@ -294,16 +294,12 @@ void mm_givesemaphore(FAR struct mm_heap_s *heap) #ifdef CONFIG_SMP irqstate_t flags = enter_critical_section(); #endif -#if defined(CONFIG_DEBUG_ASSERTIONS) || \ - (defined(MONITOR_MM_SEMAPHORE) && defined(CONFIG_DEBUG_INFO)) - pid_t my_pid = getpid(); -#endif /* The current task should be holding at least one reference to the * semaphore. */ - DEBUGASSERT(heap->mm_holder == my_pid); + DEBUGASSERT(heap->mm_holder == getpid()); /* Does the current task hold multiple references to the semaphore */ @@ -319,7 +315,7 @@ void mm_givesemaphore(FAR struct mm_heap_s *heap) { /* Nope, this is the last reference held by the current task. */ - mseminfo("PID=%d giving\n", my_pid); + mseminfo("PID=%d giving\n", getpid()); heap->mm_holder = NO_HOLDER; heap->mm_counts_held = 0;