Remove the ENABLED/DISABLED macros (#4515)
The removal of these macros enabled cppcheck to reveal new errors. These errors are also fixed by the patch. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
#define JMEM_ALLOCATOR_INTERNAL
|
||||
#include "jmem-allocator-internal.h"
|
||||
|
||||
#if ENABLED (JERRY_MEM_STATS)
|
||||
#if JERRY_MEM_STATS
|
||||
/**
|
||||
* Register byte code allocation.
|
||||
*/
|
||||
@@ -141,7 +141,7 @@ jmem_stats_free_property_bytes (size_t property_size)
|
||||
heap_stats->property_bytes -= property_size;
|
||||
} /* jmem_stats_free_property_bytes */
|
||||
|
||||
#endif /* ENABLED (JERRY_MEM_STATS) */
|
||||
#endif /* JERRY_MEM_STATS */
|
||||
|
||||
/**
|
||||
* Initialize memory allocators.
|
||||
@@ -160,12 +160,12 @@ jmem_finalize (void)
|
||||
{
|
||||
jmem_pools_finalize ();
|
||||
|
||||
#if ENABLED (JERRY_MEM_STATS)
|
||||
#if JERRY_MEM_STATS
|
||||
if (JERRY_CONTEXT (jerry_init_flags) & ECMA_INIT_MEM_STATS)
|
||||
{
|
||||
jmem_heap_stats_print ();
|
||||
}
|
||||
#endif /* ENABLED (JERRY_MEM_STATS) */
|
||||
#endif /* JERRY_MEM_STATS */
|
||||
|
||||
jmem_heap_finalize ();
|
||||
} /* jmem_finalize */
|
||||
@@ -185,21 +185,21 @@ jmem_compress_pointer (const void *pointer_p) /**< pointer to compress */
|
||||
|
||||
JERRY_ASSERT (uint_ptr % JMEM_ALIGNMENT == 0);
|
||||
|
||||
#if defined (ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && ENABLED (JERRY_CPOINTER_32_BIT)
|
||||
#if defined (ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && JERRY_CPOINTER_32_BIT
|
||||
JERRY_ASSERT (((jmem_cpointer_t) uint_ptr) == uint_ptr);
|
||||
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY || !ENABLED (JERRY_CPOINTER_32_BIT) */
|
||||
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY || !JERRY_CPOINTER_32_BIT */
|
||||
const uintptr_t heap_start = (uintptr_t) &JERRY_HEAP_CONTEXT (first);
|
||||
|
||||
uint_ptr -= heap_start;
|
||||
uint_ptr >>= JMEM_ALIGNMENT_LOG;
|
||||
|
||||
#if ENABLED (JERRY_CPOINTER_32_BIT)
|
||||
#if JERRY_CPOINTER_32_BIT
|
||||
JERRY_ASSERT (uint_ptr <= UINT32_MAX);
|
||||
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
|
||||
#else /* !JERRY_CPOINTER_32_BIT */
|
||||
JERRY_ASSERT (uint_ptr <= UINT16_MAX);
|
||||
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
|
||||
#endif /* JERRY_CPOINTER_32_BIT */
|
||||
JERRY_ASSERT (uint_ptr != JMEM_CP_NULL);
|
||||
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY && ENABLED (JERRY_CPOINTER_32_BIT) */
|
||||
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY && JERRY_CPOINTER_32_BIT */
|
||||
|
||||
return (jmem_cpointer_t) uint_ptr;
|
||||
} /* jmem_compress_pointer */
|
||||
@@ -218,16 +218,16 @@ jmem_decompress_pointer (uintptr_t compressed_pointer) /**< pointer to decompres
|
||||
|
||||
JERRY_ASSERT (((jmem_cpointer_t) uint_ptr) == uint_ptr);
|
||||
|
||||
#if defined (ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && ENABLED (JERRY_CPOINTER_32_BIT)
|
||||
#if defined (ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && JERRY_CPOINTER_32_BIT
|
||||
JERRY_ASSERT (uint_ptr % JMEM_ALIGNMENT == 0);
|
||||
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY || !ENABLED (JERRY_CPOINTER_32_BIT) */
|
||||
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY || !JERRY_CPOINTER_32_BIT */
|
||||
const uintptr_t heap_start = (uintptr_t) &JERRY_HEAP_CONTEXT (first);
|
||||
|
||||
uint_ptr <<= JMEM_ALIGNMENT_LOG;
|
||||
uint_ptr += heap_start;
|
||||
|
||||
JERRY_ASSERT (jmem_is_heap_pointer ((void *) uint_ptr));
|
||||
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY && ENABLED (JERRY_CPOINTER_32_BIT) */
|
||||
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY && JERRY_CPOINTER_32_BIT */
|
||||
|
||||
return (void *) uint_ptr;
|
||||
} /* jmem_decompress_pointer */
|
||||
|
||||
Reference in New Issue
Block a user