Ensure that const and pure function attributes are used properly (#1739)

Some functions were incorrectly marked as const but were pure only
(or not even pure). Some functions were marked as pure but
qualified as const. Some functions were not attributed at all but
qualified either as pure or const. Some functions had attributes
at definition but not at declaration. This commit fixes these
inconsistencies.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss
2017-04-18 10:15:34 +02:00
committed by yichoi
parent dc1dc093d9
commit 0f4edbe580
6 changed files with 58 additions and 56 deletions
+2 -2
View File
@@ -56,7 +56,7 @@ jmem_finalize (void)
*
* @return packed pointer
*/
inline jmem_cpointer_t __attr_always_inline___
inline jmem_cpointer_t __attr_pure___ __attr_always_inline___
jmem_compress_pointer (const void *pointer_p) /**< pointer to compress */
{
JERRY_ASSERT (pointer_p != NULL);
@@ -90,7 +90,7 @@ jmem_compress_pointer (const void *pointer_p) /**< pointer to compress */
*
* @return unpacked pointer
*/
inline void * __attr_always_inline___
inline void * __attr_pure___ __attr_always_inline___
jmem_decompress_pointer (uintptr_t compressed_pointer) /**< pointer to decompress */
{
JERRY_ASSERT (compressed_pointer != JMEM_CP_NULL);
+4 -2
View File
@@ -16,6 +16,8 @@
#ifndef JMEM_H
#define JMEM_H
#include "jrt.h"
/** \addtogroup mem Memory allocation
* @{
*
@@ -143,8 +145,8 @@ void jmem_stats_reset_peak (void);
void jmem_stats_print (void);
#endif /* JMEM_STATS */
jmem_cpointer_t jmem_compress_pointer (const void *pointer_p);
void *jmem_decompress_pointer (uintptr_t compressed_pointer);
jmem_cpointer_t jmem_compress_pointer (const void *pointer_p) __attr_pure___;
void *jmem_decompress_pointer (uintptr_t compressed_pointer) __attr_pure___;
/**
* A free memory callback routine type.