Add jerryscript-compiler.h public header to cover compiler incompatibilities (#2313)

In general, public headers should not have compiler-specific
constructs but both the core and the port headers have attributes,
which are non-standard. It's better to factor out such constructs
to a common place (a new header) and hide them behind macros, which
can then be defined on a per-compiler basis.

This patch moves the existing definitions of function attributes and
likely/unlikely builtins to the new header. At the same time, it
unifies the names of these attribute defines and where they are
used. Moreover, it touches on jerry-main and removes the uses of
`__attribute__((unused))` entirely and replaces them with the
elsewhere used `(void) ...` pattern.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss
2018-05-14 02:41:26 +02:00
committed by yichoi
parent 0e131da4f7
commit 65ae949dc3
58 changed files with 433 additions and 340 deletions
+12 -12
View File
@@ -87,7 +87,7 @@ DECLARE_ROUTINES_FOR (number)
*
* @return pointer to allocated memory
*/
inline ecma_object_t * __attr_always_inline___
inline ecma_object_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_object (void)
{
#ifdef JMEM_STATS
@@ -100,7 +100,7 @@ ecma_alloc_object (void)
/**
* Dealloc memory from an ecma-object
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_object (ecma_object_t *object_p) /**< object to be freed */
{
#ifdef JMEM_STATS
@@ -115,7 +115,7 @@ ecma_dealloc_object (ecma_object_t *object_p) /**< object to be freed */
*
* @return pointer to allocated memory
*/
inline ecma_extended_object_t * __attr_always_inline___
inline ecma_extended_object_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_extended_object (size_t size) /**< size of object */
{
#ifdef JMEM_STATS
@@ -128,7 +128,7 @@ ecma_alloc_extended_object (size_t size) /**< size of object */
/**
* Dealloc memory of an extended object
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_extended_object (ecma_object_t *object_p, /**< extended object */
size_t size) /**< size of object */
{
@@ -144,7 +144,7 @@ ecma_dealloc_extended_object (ecma_object_t *object_p, /**< extended object */
*
* @return pointer to allocated memory
*/
inline ecma_string_t * __attr_always_inline___
inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_string (void)
{
#ifdef JMEM_STATS
@@ -157,7 +157,7 @@ ecma_alloc_string (void)
/**
* Dealloc memory from ecma-string descriptor
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_string (ecma_string_t *string_p) /**< string to be freed */
{
#ifdef JMEM_STATS
@@ -172,7 +172,7 @@ ecma_dealloc_string (ecma_string_t *string_p) /**< string to be freed */
*
* @return pointer to allocated memory
*/
inline ecma_string_t * __attr_always_inline___
inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_string_buffer (size_t size) /**< size of string */
{
#ifdef JMEM_STATS
@@ -185,7 +185,7 @@ ecma_alloc_string_buffer (size_t size) /**< size of string */
/**
* Dealloc memory of a string with character data
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_string_buffer (ecma_string_t *string_p, /**< string with data */
size_t size) /**< size of string */
{
@@ -201,7 +201,7 @@ ecma_dealloc_string_buffer (ecma_string_t *string_p, /**< string with data */
*
* @return pointer to allocated memory
*/
inline ecma_getter_setter_pointers_t * __attr_always_inline___
inline ecma_getter_setter_pointers_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_getter_setter_pointers (void)
{
#ifdef JMEM_STATS
@@ -214,7 +214,7 @@ ecma_alloc_getter_setter_pointers (void)
/**
* Dealloc memory from getter-setter pointer pair
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_getter_setter_pointers (ecma_getter_setter_pointers_t *getter_setter_pointers_p) /**< pointer pair
* to be freed */
{
@@ -230,7 +230,7 @@ ecma_dealloc_getter_setter_pointers (ecma_getter_setter_pointers_t *getter_sette
*
* @return pointer to allocated memory
*/
inline ecma_property_pair_t * __attr_always_inline___
inline ecma_property_pair_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_property_pair (void)
{
#ifdef JMEM_STATS
@@ -243,7 +243,7 @@ ecma_alloc_property_pair (void)
/**
* Dealloc memory of an ecma-property
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_property_pair (ecma_property_pair_t *property_pair_p) /**< property pair to be freed */
{
#ifdef JMEM_STATS