diff --git a/jerry-core/ecma/base/ecma-alloc.cpp b/jerry-core/ecma/base/ecma-alloc.cpp index c22f24e2e3..5a49265aaa 100644 --- a/jerry-core/ecma/base/ecma-alloc.cpp +++ b/jerry-core/ecma/base/ecma-alloc.cpp @@ -78,8 +78,8 @@ JERRY_STATIC_ASSERT (sizeof (ecma_getter_setter_pointers_t) <= sizeof (uint64_t) * Declaration of alloc/free routine for specified ecma-type. */ #define DECLARE_ROUTINES_FOR(ecma_type) \ - ALLOC(ecma_type) \ - DEALLOC(ecma_type) + ALLOC (ecma_type) \ + DEALLOC (ecma_type) DECLARE_ROUTINES_FOR (object) DECLARE_ROUTINES_FOR (property) diff --git a/jerry-core/ecma/base/ecma-gc.cpp b/jerry-core/ecma/base/ecma-gc.cpp index 2edd99912b..32641e060e 100644 --- a/jerry-core/ecma/base/ecma-gc.cpp +++ b/jerry-core/ecma/base/ecma-gc.cpp @@ -55,7 +55,7 @@ typedef enum /** * List of marked (visited during current GC session) and umarked objects */ -static ecma_object_t *ecma_gc_objects_lists [ECMA_GC_COLOR__COUNT]; +static ecma_object_t *ecma_gc_objects_lists[ECMA_GC_COLOR__COUNT]; /** * Current state of an object's visited flag that indicates whether the object is in visited state: @@ -177,8 +177,8 @@ ecma_init_gc_info (ecma_object_t *object_p) /**< object */ { ecma_gc_set_object_refs (object_p, 1); - ecma_gc_set_object_next (object_p, ecma_gc_objects_lists [ECMA_GC_COLOR_WHITE_GRAY]); - ecma_gc_objects_lists [ECMA_GC_COLOR_WHITE_GRAY] = object_p; + ecma_gc_set_object_next (object_p, ecma_gc_objects_lists[ECMA_GC_COLOR_WHITE_GRAY]); + ecma_gc_objects_lists[ECMA_GC_COLOR_WHITE_GRAY] = object_p; /* Should be set to false at the beginning of garbage collection */ ecma_gc_set_object_visited (object_p, false); @@ -199,7 +199,7 @@ ecma_ref_object (ecma_object_t *object_p) /**< object */ void ecma_deref_object (ecma_object_t *object_p) /**< object */ { - JERRY_ASSERT(ecma_gc_get_object_refs (object_p) > 0); + JERRY_ASSERT (ecma_gc_get_object_refs (object_p) > 0); ecma_gc_set_object_refs (object_p, ecma_gc_get_object_refs (object_p) - 1); } /* ecma_deref_object */ @@ -209,8 +209,8 @@ ecma_deref_object (ecma_object_t *object_p) /**< object */ void ecma_gc_init (void) { - ecma_gc_objects_lists [ECMA_GC_COLOR_WHITE_GRAY] = NULL; - ecma_gc_objects_lists [ECMA_GC_COLOR_BLACK] = NULL; + ecma_gc_objects_lists[ECMA_GC_COLOR_WHITE_GRAY] = NULL; + ecma_gc_objects_lists[ECMA_GC_COLOR_BLACK] = NULL; } /* ecma_gc_init */ /** @@ -219,7 +219,7 @@ ecma_gc_init (void) void ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */ { - JERRY_ASSERT(object_p != NULL); + JERRY_ASSERT (object_p != NULL); JERRY_ASSERT (ecma_gc_is_object_visited (object_p)); bool traverse_properties = true; @@ -302,7 +302,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */ case ECMA_INTERNAL_PROPERTY_NUMBER_INDEXED_ARRAY_VALUES: /* a collection of ecma-values */ case ECMA_INTERNAL_PROPERTY_STRING_INDEXED_ARRAY_VALUES: /* a collection of ecma-values */ { - JERRY_UNIMPLEMENTED("Indexed array storage is not implemented yet."); + JERRY_UNIMPLEMENTED ("Indexed array storage is not implemented yet."); } case ECMA_INTERNAL_PROPERTY_PROTOTYPE: /* the property's value is located in ecma_object_t @@ -312,7 +312,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */ case ECMA_INTERNAL_PROPERTY__COUNT: /* not a real internal property type, * but number of the real internal property types */ { - JERRY_UNREACHABLE(); + JERRY_UNREACHABLE (); } case ECMA_INTERNAL_PROPERTY_FORMAL_PARAMETERS: /* a collection of strings */ @@ -336,7 +336,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */ case ECMA_INTERNAL_PROPERTY_SCOPE: /* a lexical environment */ case ECMA_INTERNAL_PROPERTY_PARAMETERS_MAP: /* an object */ { - ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER(ecma_object_t, property_value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, property_value); ecma_gc_set_object_visited (obj_p, true); @@ -357,9 +357,9 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */ void ecma_gc_sweep (ecma_object_t *object_p) /**< object to free */ { - JERRY_ASSERT(object_p != NULL - && !ecma_gc_is_object_visited (object_p) - && ecma_gc_get_object_refs (object_p) == 0); + JERRY_ASSERT (object_p != NULL + && !ecma_gc_is_object_visited (object_p) + && ecma_gc_get_object_refs (object_p) == 0); if (!ecma_is_lexical_environment (object_p)) { @@ -405,10 +405,10 @@ ecma_gc_sweep (ecma_object_t *object_p) /**< object to free */ void ecma_gc_run (void) { - JERRY_ASSERT (ecma_gc_objects_lists [ECMA_GC_COLOR_BLACK] == NULL); + JERRY_ASSERT (ecma_gc_objects_lists[ECMA_GC_COLOR_BLACK] == NULL); /* if some object is referenced from stack or globals (i.e. it is root), mark it */ - for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists [ECMA_GC_COLOR_WHITE_GRAY]; + for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists[ECMA_GC_COLOR_WHITE_GRAY]; obj_iter_p != NULL; obj_iter_p = ecma_gc_get_object_next (obj_iter_p)) { @@ -445,7 +445,7 @@ ecma_gc_run (void) { marked_anything_during_current_iteration = false; - for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists [ECMA_GC_COLOR_WHITE_GRAY], *obj_prev_p = NULL, *obj_next_p; + for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists[ECMA_GC_COLOR_WHITE_GRAY], *obj_prev_p = NULL, *obj_next_p; obj_iter_p != NULL; obj_iter_p = obj_next_p) { @@ -454,8 +454,8 @@ ecma_gc_run (void) if (ecma_gc_is_object_visited (obj_iter_p)) { /* Moving the object to list of marked objects */ - ecma_gc_set_object_next (obj_iter_p, ecma_gc_objects_lists [ECMA_GC_COLOR_BLACK]); - ecma_gc_objects_lists [ECMA_GC_COLOR_BLACK] = obj_iter_p; + ecma_gc_set_object_next (obj_iter_p, ecma_gc_objects_lists[ECMA_GC_COLOR_BLACK]); + ecma_gc_objects_lists[ECMA_GC_COLOR_BLACK] = obj_iter_p; if (likely (obj_prev_p != NULL)) { @@ -465,7 +465,7 @@ ecma_gc_run (void) } else { - ecma_gc_objects_lists [ECMA_GC_COLOR_WHITE_GRAY] = obj_next_p; + ecma_gc_objects_lists[ECMA_GC_COLOR_WHITE_GRAY] = obj_next_p; } ecma_gc_mark (obj_iter_p); @@ -476,10 +476,11 @@ ecma_gc_run (void) obj_prev_p = obj_iter_p; } } - } while (marked_anything_during_current_iteration); + } + while (marked_anything_during_current_iteration); /* Sweeping objects that are currently unmarked */ - for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists [ECMA_GC_COLOR_WHITE_GRAY], *obj_next_p; + for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists[ECMA_GC_COLOR_WHITE_GRAY], *obj_next_p; obj_iter_p != NULL; obj_iter_p = obj_next_p) { @@ -491,8 +492,8 @@ ecma_gc_run (void) } /* Unmarking all objects */ - ecma_gc_objects_lists [ECMA_GC_COLOR_WHITE_GRAY] = ecma_gc_objects_lists [ECMA_GC_COLOR_BLACK]; - ecma_gc_objects_lists [ECMA_GC_COLOR_BLACK] = NULL; + ecma_gc_objects_lists[ECMA_GC_COLOR_WHITE_GRAY] = ecma_gc_objects_lists[ECMA_GC_COLOR_BLACK]; + ecma_gc_objects_lists[ECMA_GC_COLOR_BLACK] = NULL; ecma_gc_visited_flip_flag = !ecma_gc_visited_flip_flag; } /* ecma_gc_run */ diff --git a/jerry-core/ecma/base/ecma-helpers-conversion.cpp b/jerry-core/ecma/base/ecma-helpers-conversion.cpp index df34932b75..05f70be801 100644 --- a/jerry-core/ecma/base/ecma-helpers-conversion.cpp +++ b/jerry-core/ecma/base/ecma-helpers-conversion.cpp @@ -71,10 +71,10 @@ ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name_copy_to); \ ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name_copy_from); \ \ - name_copy_to[0] = name_copy_from [0]; \ - name_copy_to[1] = name_copy_from [1]; \ - name_copy_to[2] = name_copy_from [2]; \ - name_copy_to[3] = name_copy_from [3]; \ + name_copy_to[0] = name_copy_from[0]; \ + name_copy_to[1] = name_copy_from[1]; \ + name_copy_to[2] = name_copy_from[2]; \ + name_copy_to[3] = name_copy_from[3]; \ } /** @@ -176,13 +176,13 @@ { \ ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name); \ \ - name [0] += 1ull; \ - name [1] += (name [0] >> 32u); \ - name [0] = (uint32_t) name [0]; \ - name [2] += (name [1] >> 32u); \ - name [1] = (uint32_t) name [1]; \ - name [3] += (name [2] >> 32u); \ - name [2] = (uint32_t) name [2]; \ + name[0] += 1ull; \ + name[1] += (name[0] >> 32u); \ + name[0] = (uint32_t) name[0]; \ + name[2] += (name[1] >> 32u); \ + name[1] = (uint32_t) name[1]; \ + name[3] += (name[2] >> 32u); \ + name[2] = (uint32_t) name[2]; \ \ ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name); \ } @@ -195,17 +195,17 @@ ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name_add_to); \ ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name_to_add); \ \ - name_add_to [0] += name_to_add [0]; \ - name_add_to [1] += name_to_add [1]; \ - name_add_to [2] += name_to_add [2]; \ - name_add_to [3] += name_to_add [3]; \ + name_add_to[0] += name_to_add[0]; \ + name_add_to[1] += name_to_add[1]; \ + name_add_to[2] += name_to_add[2]; \ + name_add_to[3] += name_to_add[3]; \ \ - name_add_to [1] += (name_add_to [0] >> 32u); \ - name_add_to [0] = (uint32_t) name_add_to [0]; \ - name_add_to [2] += (name_add_to [1] >> 32u); \ - name_add_to [1] = (uint32_t) name_add_to [1]; \ - name_add_to [3] += (name_add_to [2] >> 32u); \ - name_add_to [2] = (uint32_t) name_add_to [2]; \ + name_add_to[1] += (name_add_to[0] >> 32u); \ + name_add_to[0] = (uint32_t) name_add_to[0]; \ + name_add_to[2] += (name_add_to[1] >> 32u); \ + name_add_to[1] = (uint32_t) name_add_to[1]; \ + name_add_to[3] += (name_add_to[2] >> 32u); \ + name_add_to[2] = (uint32_t) name_add_to[2]; \ \ ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name_add_to); \ ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name_to_add); \ @@ -244,7 +244,7 @@ const uint64_t div10_p_mid = 0x99999999ul; \ const uint64_t div10_p_high = 0x19999999ul; \ \ - uint64_t intermediate [8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; \ + uint64_t intermediate[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; \ uint64_t l0, l1, l2, l3, m0, m1, m2, m3, h0, h1, h2, h3; \ l0 = name[0] * div10_p_low; \ l1 = name[1] * div10_p_low; \ @@ -297,25 +297,25 @@ intermediate[6] += (uint32_t) h3; \ intermediate[7] += h3 >> 32u; \ \ - intermediate [1] += intermediate[0] >> 32u; \ - intermediate [0] = (uint32_t) intermediate[0]; \ - intermediate [2] += intermediate[1] >> 32u; \ - intermediate [1] = (uint32_t) intermediate[1]; \ - intermediate [3] += intermediate[2] >> 32u; \ - intermediate [2] = (uint32_t) intermediate[2]; \ - intermediate [4] += intermediate[3] >> 32u; \ - intermediate [3] = (uint32_t) intermediate[3]; \ - intermediate [5] += intermediate[4] >> 32u; \ - intermediate [4] = (uint32_t) intermediate[4]; \ - intermediate [6] += intermediate[5] >> 32u; \ - intermediate [5] = (uint32_t) intermediate[5]; \ - intermediate [7] += intermediate[6] >> 32u; \ - intermediate [6] = (uint32_t) intermediate[6]; \ + intermediate[1] += intermediate[0] >> 32u; \ + intermediate[0] = (uint32_t) intermediate[0]; \ + intermediate[2] += intermediate[1] >> 32u; \ + intermediate[1] = (uint32_t) intermediate[1]; \ + intermediate[3] += intermediate[2] >> 32u; \ + intermediate[2] = (uint32_t) intermediate[2]; \ + intermediate[4] += intermediate[3] >> 32u; \ + intermediate[3] = (uint32_t) intermediate[3]; \ + intermediate[5] += intermediate[4] >> 32u; \ + intermediate[4] = (uint32_t) intermediate[4]; \ + intermediate[6] += intermediate[5] >> 32u; \ + intermediate[5] = (uint32_t) intermediate[5]; \ + intermediate[7] += intermediate[6] >> 32u; \ + intermediate[6] = (uint32_t) intermediate[6]; \ \ - name[0] = intermediate [4]; \ - name[1] = intermediate [5]; \ - name[2] = intermediate [6]; \ - name[3] = intermediate [7]; \ + name[0] = intermediate[4]; \ + name[1] = intermediate[5]; \ + name[2] = intermediate[6]; \ + name[3] = intermediate[7]; \ \ ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name); \ } @@ -342,7 +342,7 @@ ecma_zt_string_to_number (const ecma_char_t *str_p) /**< zero-terminated string const ecma_char_t hex_upper_digits_range[10] = { 'A', 'F' }; const ecma_char_t hex_x_chars[2] = { 'x', 'X' }; const ecma_char_t white_space[2] = { ' ', '\n' }; - const ecma_char_t e_chars [2] = { 'e', 'E' }; + const ecma_char_t e_chars[2] = { 'e', 'E' }; const ecma_char_t plus_char = '+'; const ecma_char_t minus_char = '-'; const ecma_char_t dot_char = '.'; @@ -393,8 +393,8 @@ ecma_zt_string_to_number (const ecma_char_t *str_p) /**< zero-terminated string { int32_t digit_value; - if (*iter_p >= dec_digits_range [0] - && *iter_p <= dec_digits_range [1]) + if (*iter_p >= dec_digits_range[0] + && *iter_p <= dec_digits_range[1]) { digit_value = (*iter_p - dec_digits_range[0]); } @@ -464,8 +464,8 @@ ecma_zt_string_to_number (const ecma_char_t *str_p) /**< zero-terminated string { int32_t digit_value; - if (*begin_p >= dec_digits_range [0] - && *begin_p <= dec_digits_range [1]) + if (*begin_p >= dec_digits_range[0] + && *begin_p <= dec_digits_range[1]) { digit_value = (*begin_p - dec_digits_range[0]); } @@ -502,8 +502,8 @@ ecma_zt_string_to_number (const ecma_char_t *str_p) /**< zero-terminated string { int32_t digit_value; - if (*begin_p >= dec_digits_range [0] - && *begin_p <= dec_digits_range [1]) + if (*begin_p >= dec_digits_range[0] + && *begin_p <= dec_digits_range[1]) { digit_value = (*begin_p - dec_digits_range[0]); } @@ -556,8 +556,8 @@ ecma_zt_string_to_number (const ecma_char_t *str_p) /**< zero-terminated string { int32_t digit_value; - if (*begin_p >= dec_digits_range [0] - && *begin_p <= dec_digits_range [1]) + if (*begin_p >= dec_digits_range[0] + && *begin_p <= dec_digits_range[1]) { digit_value = (*begin_p - dec_digits_range[0]); } @@ -1120,7 +1120,7 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */ ssize_t buffer_size) /**< size of buffer */ { const ecma_char_t digits[10] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; - const ecma_char_t e_chars [2] = { 'e', 'E' }; + const ecma_char_t e_chars[2] = { 'e', 'E' }; const ecma_char_t plus_char = '+'; const ecma_char_t minus_char = '-'; const ecma_char_t dot_char = '.'; @@ -1324,12 +1324,12 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */ for (int32_t i = 0; i < n - k; i++) { - *--dst_p = digits [0]; + *--dst_p = digits[0]; } for (int32_t i = 0; i < k; i++) { - *--dst_p = digits [s % 10]; + *--dst_p = digits[s % 10]; s /= 10; } } @@ -1343,7 +1343,7 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */ for (int32_t i = 0; i < k - n; i++) { - *--dst_p = digits [s % 10]; + *--dst_p = digits[s % 10]; s /= 10; } @@ -1351,7 +1351,7 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */ for (int32_t i = 0; i < n; i++) { - *--dst_p = digits [s % 10]; + *--dst_p = digits[s % 10]; s /= 10; } } @@ -1365,13 +1365,13 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */ for (int32_t i = 0; i < k; i++) { - *--dst_p = digits [s % 10]; + *--dst_p = digits[s % 10]; s /= 10; } for (int32_t i = 0; i < -n; i++) { - *--dst_p = digits [0]; + *--dst_p = digits[0]; } *--dst_p = dot_char; @@ -1384,7 +1384,7 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */ // 9. JERRY_ASSERT ((ssize_t) sizeof (ecma_char_t) <= buffer_size); - *dst_p++ = digits [s % 10]; + *dst_p++ = digits[s % 10]; s /= 10; } else @@ -1395,7 +1395,7 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */ for (int32_t i = 0; i < k - 1; i++) { - *--dst_p = digits [s % 10]; + *--dst_p = digits[s % 10]; s /= 10; } @@ -1415,7 +1415,7 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */ if (t == 0) { JERRY_ASSERT ((ssize_t) sizeof (ecma_char_t) * (dst_p - buffer_p + 1) <= buffer_size); - *dst_p++ = digits [0]; + *dst_p++ = digits[0]; } else { @@ -1431,7 +1431,7 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */ while (t_mod != 0) { JERRY_ASSERT ((ssize_t) sizeof (ecma_char_t) * (dst_p - buffer_p + 1) <= buffer_size); - *dst_p++ = digits [t / t_mod]; + *dst_p++ = digits[t / t_mod]; t -= (t / t_mod) * t_mod; t_mod /= 10; diff --git a/jerry-core/ecma/base/ecma-helpers-string.cpp b/jerry-core/ecma/base/ecma-helpers-string.cpp index 5db16a6377..fedccd55a1 100644 --- a/jerry-core/ecma/base/ecma-helpers-string.cpp +++ b/jerry-core/ecma/base/ecma-helpers-string.cpp @@ -49,7 +49,7 @@ JERRY_STATIC_ASSERT ((uint32_t) ((int32_t) ECMA_STRING_MAX_CONCATENATION_LENGTH) /** * Lengths of magic strings */ -static ecma_length_t ecma_magic_string_lengths [ECMA_MAGIC_STRING__COUNT]; +static ecma_length_t ecma_magic_string_lengths[ECMA_MAGIC_STRING__COUNT]; #ifndef JERRY_NDEBUG /** @@ -286,10 +286,10 @@ ecma_strings_init (void) id < ECMA_MAGIC_STRING__COUNT; id = (ecma_magic_string_id_t) (id + 1)) { - ecma_magic_string_lengths [id] = ecma_zt_string_length (ecma_get_magic_string_zt (id)); + ecma_magic_string_lengths[id] = ecma_zt_string_length (ecma_get_magic_string_zt (id)); #ifndef JERRY_NDEBUG - ecma_magic_string_max_length = JERRY_MAX (ecma_magic_string_max_length, ecma_magic_string_lengths [id]); + ecma_magic_string_max_length = JERRY_MAX (ecma_magic_string_max_length, ecma_magic_string_lengths[id]); JERRY_ASSERT (ecma_magic_string_max_length <= ECMA_STRING_MAGIC_STRING_LENGTH_LIMIT); #endif /* !JERRY_NDEBUG */ @@ -348,7 +348,7 @@ ecma_init_ecma_string_from_magic_string_id (ecma_string_t *string_p, /**< descri string_p->is_stack_var = (is_stack_var != 0); string_p->container = ECMA_STRING_CONTAINER_MAGIC_STRING; string_p->hash = ecma_chars_buffer_calc_hash_last_chars (ecma_get_magic_string_zt (magic_string_id), - ecma_magic_string_lengths [magic_string_id]); + ecma_magic_string_lengths[magic_string_id]); string_p->u.common_field = 0; string_p->u.magic_string_id = magic_string_id; @@ -413,10 +413,10 @@ ecma_new_ecma_string_from_uint32 (uint32_t uint32_number) /**< UInt32-represente FIXME (/* Use digit to char conversion routine */); const ecma_char_t digits[10] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; const bool is_one_char_or_more = (uint32_number >= 10); - const ecma_char_t last_chars [ECMA_STRING_HASH_LAST_CHARS_COUNT] = + const ecma_char_t last_chars[ECMA_STRING_HASH_LAST_CHARS_COUNT] = { - is_one_char_or_more ? digits [digit_pl] : digits[digit_l], - is_one_char_or_more ? digits [digit_l] : ECMA_CHAR_NULL + is_one_char_or_more ? digits[digit_pl] : digits[digit_l], + is_one_char_or_more ? digits[digit_l] : ECMA_CHAR_NULL }; /* Only last two chars are really used for hash calculation */ @@ -424,7 +424,7 @@ ecma_new_ecma_string_from_uint32 (uint32_t uint32_number) /**< UInt32-represente is_one_char_or_more ? 2 : 1); #ifndef JERRY_NDEBUG - ecma_char_t char_buf [ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32]; + ecma_char_t char_buf[ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32]; ssize_t chars_copied = ecma_uint32_to_string (uint32_number, char_buf, ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32); @@ -962,7 +962,7 @@ ecma_string_to_zt_string (const ecma_string_t *string_desc_p, /**< ecma-string d case ECMA_STRING_CONTAINER_MAGIC_STRING: { const ecma_magic_string_id_t id = string_desc_p->u.magic_string_id; - const size_t length = ecma_magic_string_lengths [id]; + const size_t length = ecma_magic_string_lengths[id]; size_t bytes_to_copy = (length + 1) * sizeof (ecma_char_t); @@ -1184,8 +1184,8 @@ ecma_compare_ecma_strings_relational (const ecma_string_t *string1_p, /**< ecma- const ecma_char_t *zt_string1_p, *zt_string2_p; bool is_zt_string1_on_heap = false, is_zt_string2_on_heap = false; - ecma_char_t zt_string1_buffer [ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER + 1]; - ecma_char_t zt_string2_buffer [ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER + 1]; + ecma_char_t zt_string1_buffer[ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER + 1]; + ecma_char_t zt_string2_buffer[ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER + 1]; if (string1_p->container == ECMA_STRING_CONTAINER_LIT_TABLE) { @@ -1292,7 +1292,7 @@ ecma_string_get_length (const ecma_string_t *string_p) /**< ecma-string */ } else if (container == ECMA_STRING_CONTAINER_MAGIC_STRING) { - return ecma_magic_string_lengths [string_p->u.magic_string_id]; + return ecma_magic_string_lengths[string_p->u.magic_string_id]; } else if (container == ECMA_STRING_CONTAINER_UINT32_IN_DESC) { @@ -1315,7 +1315,7 @@ ecma_string_get_length (const ecma_string_t *string_p) /**< ecma-string */ int32_t length = 1; while (length < max_uint32_len - && uint32_number >= nums_with_ascending_length [length]) + && uint32_number >= nums_with_ascending_length[length]) { length++; } @@ -1376,7 +1376,7 @@ ecma_string_get_char_at_pos (const ecma_string_t *string_p, /**< ecma-string */ ecma_string_to_zt_string (string_p, zt_str_p, (ssize_t) buffer_size); - ecma_char_t ch = zt_str_p [index]; + ecma_char_t ch = zt_str_p[index]; mem_heap_free_block (zt_str_p); @@ -1586,7 +1586,7 @@ ecma_zt_string_length (const ecma_char_t *string_p) /**< zero-terminated string const ecma_char_t* ecma_get_magic_string_zt (ecma_magic_string_id_t id) /**< magic string id */ { - TODO(Support UTF-16); + TODO (Support UTF-16); switch (id) { @@ -1598,7 +1598,7 @@ ecma_get_magic_string_zt (ecma_magic_string_id_t id) /**< magic string id */ case ECMA_MAGIC_STRING__COUNT: break; } - JERRY_UNREACHABLE(); + JERRY_UNREACHABLE (); } /* ecma_get_magic_string_zt */ /** @@ -1655,7 +1655,7 @@ static bool ecma_is_string_magic_longpath (const ecma_string_t *string_p, /**< ecma-string */ ecma_magic_string_id_t *out_id_p) /**< out: magic string's id */ { - ecma_char_t zt_string_buffer [ECMA_STRING_MAGIC_STRING_LENGTH_LIMIT + 1]; + ecma_char_t zt_string_buffer[ECMA_STRING_MAGIC_STRING_LENGTH_LIMIT + 1]; ssize_t copied = ecma_string_to_zt_string (string_p, zt_string_buffer, (ssize_t) sizeof (zt_string_buffer)); JERRY_ASSERT (copied > 0); diff --git a/jerry-core/ecma/base/ecma-helpers-value.cpp b/jerry-core/ecma/base/ecma-helpers-value.cpp index 709672566c..85103f7d99 100644 --- a/jerry-core/ecma/base/ecma-helpers-value.cpp +++ b/jerry-core/ecma/base/ecma-helpers-value.cpp @@ -226,7 +226,7 @@ ecma_make_simple_value (const ecma_simple_value_t value) /**< simple value */ ecma_value_t __attr_const___ ecma_make_number_value (const ecma_number_t* num_p) /**< number to reference in value */ { - JERRY_ASSERT(num_p != NULL); + JERRY_ASSERT (num_p != NULL); mem_cpointer_t num_cp; ECMA_SET_NON_NULL_POINTER (num_cp, num_p); @@ -245,7 +245,7 @@ ecma_make_number_value (const ecma_number_t* num_p) /**< number to reference in ecma_value_t __attr_const___ ecma_make_string_value (const ecma_string_t* ecma_string_p) /**< string to reference in value */ { - JERRY_ASSERT(ecma_string_p != NULL); + JERRY_ASSERT (ecma_string_p != NULL); mem_cpointer_t string_cp; ECMA_SET_NON_NULL_POINTER (string_cp, ecma_string_p); @@ -264,7 +264,7 @@ ecma_make_string_value (const ecma_string_t* ecma_string_p) /**< string to refer ecma_value_t __attr_const___ ecma_make_object_value (const ecma_object_t* object_p) /**< object to reference in value */ { - JERRY_ASSERT(object_p != NULL); + JERRY_ASSERT (object_p != NULL); mem_cpointer_t object_cp; ECMA_SET_NON_NULL_POINTER (object_cp, object_p); @@ -591,10 +591,10 @@ ecma_make_label_completion_value (ecma_completion_type_t type, /**< type */ ecma_completion_value_t __attr_const___ __attr_always_inline___ ecma_make_simple_completion_value (ecma_simple_value_t simple_value) /**< simple ecma-value */ { - JERRY_ASSERT(simple_value == ECMA_SIMPLE_VALUE_UNDEFINED - || simple_value == ECMA_SIMPLE_VALUE_NULL - || simple_value == ECMA_SIMPLE_VALUE_FALSE - || simple_value == ECMA_SIMPLE_VALUE_TRUE); + JERRY_ASSERT (simple_value == ECMA_SIMPLE_VALUE_UNDEFINED + || simple_value == ECMA_SIMPLE_VALUE_NULL + || simple_value == ECMA_SIMPLE_VALUE_FALSE + || simple_value == ECMA_SIMPLE_VALUE_TRUE); return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL, ecma_make_simple_value (simple_value)); @@ -630,8 +630,8 @@ ecma_make_throw_completion_value (ecma_value_t value) /**< value */ ecma_completion_value_t __attr_const___ ecma_make_throw_obj_completion_value (ecma_object_t *exception_p) /**< an object */ { - JERRY_ASSERT(exception_p != NULL - && !ecma_is_lexical_environment (exception_p)); + JERRY_ASSERT (exception_p != NULL + && !ecma_is_lexical_environment (exception_p)); ecma_value_t exception = ecma_make_object_value (exception_p); @@ -781,7 +781,7 @@ ecma_free_completion_value (ecma_completion_value_t completion_value) /**< compl case ECMA_COMPLETION_TYPE_EXIT: { ecma_value_t v = ecma_get_completion_value_value_field (completion_value); - JERRY_ASSERT(ecma_get_value_type_field (v) == ECMA_TYPE_SIMPLE); + JERRY_ASSERT (ecma_get_value_type_field (v) == ECMA_TYPE_SIMPLE); break; } case ECMA_COMPLETION_TYPE_CONTINUE: diff --git a/jerry-core/ecma/base/ecma-helpers.cpp b/jerry-core/ecma/base/ecma-helpers.cpp index 114f33f4ce..dc94ae486b 100644 --- a/jerry-core/ecma/base/ecma-helpers.cpp +++ b/jerry-core/ecma/base/ecma-helpers.cpp @@ -140,8 +140,8 @@ ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, /**< out ecma_object_t *binding_obj_p, /**< binding object */ bool provide_this) /**< provideThis flag */ { - JERRY_ASSERT(binding_obj_p != NULL - && !ecma_is_lexical_environment (binding_obj_p)); + JERRY_ASSERT (binding_obj_p != NULL + && !ecma_is_lexical_environment (binding_obj_p)); ecma_object_t *new_lexical_environment_p = ecma_alloc_object (); @@ -432,7 +432,7 @@ ecma_create_internal_property (ecma_object_t *object_p, /**< the object */ new_property_p->type = ECMA_PROPERTY_INTERNAL; ecma_property_t *list_head_p = ecma_get_property_list (object_p); - ECMA_SET_POINTER(new_property_p->next_property_p, list_head_p); + ECMA_SET_POINTER (new_property_p->next_property_p, list_head_p); ecma_set_property_list (object_p, new_property_p); JERRY_STATIC_ASSERT (ECMA_INTERNAL_PROPERTY__COUNT <= (1ull << ECMA_PROPERTY_INTERNAL_PROPERTY_TYPE_WIDTH)); @@ -454,10 +454,10 @@ ecma_property_t* ecma_find_internal_property (ecma_object_t *object_p, /**< object descriptor */ ecma_internal_property_id_t property_id) /**< internal property identifier */ { - JERRY_ASSERT(object_p != NULL); + JERRY_ASSERT (object_p != NULL); - JERRY_ASSERT(property_id != ECMA_INTERNAL_PROPERTY_PROTOTYPE - && property_id != ECMA_INTERNAL_PROPERTY_EXTENSIBLE); + JERRY_ASSERT (property_id != ECMA_INTERNAL_PROPERTY_PROTOTYPE + && property_id != ECMA_INTERNAL_PROPERTY_EXTENSIBLE); for (ecma_property_t *property_p = ecma_get_property_list (object_p); property_p != NULL; @@ -489,7 +489,7 @@ ecma_get_internal_property (ecma_object_t *object_p, /**< object descriptor */ { ecma_property_t *property_p = ecma_find_internal_property (object_p, property_id); - JERRY_ASSERT(property_p != NULL); + JERRY_ASSERT (property_p != NULL); return property_p; } /* ecma_get_internal_property */ @@ -507,15 +507,15 @@ ecma_create_named_data_property (ecma_object_t *obj_p, /**< object */ bool is_enumerable, /**< 'Enumerable' attribute */ bool is_configurable) /**< 'Configurable' attribute */ { - JERRY_ASSERT(obj_p != NULL && name_p != NULL); - JERRY_ASSERT(ecma_find_named_property (obj_p, name_p) == NULL); + JERRY_ASSERT (obj_p != NULL && name_p != NULL); + JERRY_ASSERT (ecma_find_named_property (obj_p, name_p) == NULL); ecma_property_t *prop_p = ecma_alloc_property (); prop_p->type = ECMA_PROPERTY_NAMEDDATA; name_p = ecma_copy_or_ref_ecma_string (name_p); - ECMA_SET_NON_NULL_POINTER(prop_p->u.named_data_property.name_p, name_p); + ECMA_SET_NON_NULL_POINTER (prop_p->u.named_data_property.name_p, name_p); prop_p->u.named_data_property.writable = is_writable ? ECMA_PROPERTY_WRITABLE : ECMA_PROPERTY_NOT_WRITABLE; prop_p->u.named_data_property.enumerable = is_enumerable ? ECMA_PROPERTY_ENUMERABLE : ECMA_PROPERTY_NOT_ENUMERABLE; @@ -529,7 +529,7 @@ ecma_create_named_data_property (ecma_object_t *obj_p, /**< object */ ecma_lcache_invalidate (obj_p, name_p, NULL); ecma_property_t *list_head_p = ecma_get_property_list (obj_p); - ECMA_SET_POINTER(prop_p->next_property_p, list_head_p); + ECMA_SET_POINTER (prop_p->next_property_p, list_head_p); ecma_set_property_list (obj_p, prop_p); return prop_p; @@ -548,15 +548,15 @@ ecma_create_named_accessor_property (ecma_object_t *obj_p, /**< object */ bool is_enumerable, /**< 'enumerable' attribute */ bool is_configurable) /**< 'configurable' attribute */ { - JERRY_ASSERT(obj_p != NULL && name_p != NULL); - JERRY_ASSERT(ecma_find_named_property (obj_p, name_p) == NULL); + JERRY_ASSERT (obj_p != NULL && name_p != NULL); + JERRY_ASSERT (ecma_find_named_property (obj_p, name_p) == NULL); ecma_property_t *prop_p = ecma_alloc_property (); prop_p->type = ECMA_PROPERTY_NAMEDACCESSOR; name_p = ecma_copy_or_ref_ecma_string (name_p); - ECMA_SET_NON_NULL_POINTER(prop_p->u.named_accessor_property.name_p, name_p); + ECMA_SET_NON_NULL_POINTER (prop_p->u.named_accessor_property.name_p, name_p); prop_p->u.named_accessor_property.enumerable = (is_enumerable ? ECMA_PROPERTY_ENUMERABLE : ECMA_PROPERTY_NOT_ENUMERABLE); @@ -568,7 +568,7 @@ ecma_create_named_accessor_property (ecma_object_t *obj_p, /**< object */ ecma_lcache_invalidate (obj_p, name_p, NULL); ecma_property_t *list_head_p = ecma_get_property_list (obj_p); - ECMA_SET_POINTER(prop_p->next_property_p, list_head_p); + ECMA_SET_POINTER (prop_p->next_property_p, list_head_p); ecma_set_property_list (obj_p, prop_p); ecma_getter_setter_pointers_t *getter_setter_pointers_p = ecma_alloc_getter_setter_pointers (); @@ -593,8 +593,8 @@ ecma_property_t* ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in */ ecma_string_t *name_p) /**< property's name */ { - JERRY_ASSERT(obj_p != NULL); - JERRY_ASSERT(name_p != NULL); + JERRY_ASSERT (obj_p != NULL); + JERRY_ASSERT (name_p != NULL); ecma_property_t *property_p; @@ -616,15 +616,15 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in } else if (property_p->type == ECMA_PROPERTY_NAMEDACCESSOR) { - property_name_p = ECMA_GET_NON_NULL_POINTER(ecma_string_t, - property_p->u.named_accessor_property.name_p); + property_name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t, + property_p->u.named_accessor_property.name_p); } else { continue; } - JERRY_ASSERT(property_name_p != NULL); + JERRY_ASSERT (property_name_p != NULL); if (ecma_compare_ecma_strings (name_p, property_name_p)) { @@ -650,12 +650,12 @@ ecma_property_t* ecma_get_named_property (ecma_object_t *obj_p, /**< object to find property in */ ecma_string_t *name_p) /**< property's name */ { - JERRY_ASSERT(obj_p != NULL); - JERRY_ASSERT(name_p != NULL); + JERRY_ASSERT (obj_p != NULL); + JERRY_ASSERT (name_p != NULL); ecma_property_t *property_p = ecma_find_named_property (obj_p, name_p); - JERRY_ASSERT(property_p != NULL); + JERRY_ASSERT (property_p != NULL); return property_p; } /* ecma_get_named_property */ @@ -871,14 +871,14 @@ ecma_delete_property (ecma_object_t *obj_p, /**< object */ } else { - ECMA_SET_POINTER(prev_prop_p->next_property_p, next_prop_p); + ECMA_SET_POINTER (prev_prop_p->next_property_p, next_prop_p); } return; } } - JERRY_UNREACHABLE(); + JERRY_UNREACHABLE (); } /* ecma_delete_property */ /** diff --git a/jerry-core/ecma/base/ecma-stack.cpp b/jerry-core/ecma/base/ecma-stack.cpp index 6371ebf6d9..006698617b 100644 --- a/jerry-core/ecma/base/ecma-stack.cpp +++ b/jerry-core/ecma/base/ecma-stack.cpp @@ -88,7 +88,7 @@ ecma_stack_add_frame (ecma_stack_frame_t *frame_p, /**< frame to initialize */ for (int32_t i = 0; i < regs_num; i++) { - regs_p [i] = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY); + regs_p[i] = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY); } } /* ecma_stack_add_frame */ @@ -115,7 +115,7 @@ ecma_stack_free_frame (ecma_stack_frame_t *frame_p) /**< frame to initialize */ reg_index < frame_p->regs_number; reg_index++) { - ecma_free_value (frame_p->regs_p [reg_index], false); + ecma_free_value (frame_p->regs_p[reg_index], false); } } /* ecma_stack_free_frame */ @@ -130,7 +130,7 @@ ecma_stack_frame_get_reg_value (ecma_stack_frame_t *frame_p, /**< frame */ { JERRY_ASSERT (reg_index >= 0 && reg_index < frame_p->regs_number); - return frame_p->regs_p [reg_index]; + return frame_p->regs_p[reg_index]; } /* ecma_stack_frame_get_reg_value */ /** @@ -143,7 +143,7 @@ ecma_stack_frame_set_reg_value (ecma_stack_frame_t *frame_p, /**< frame */ { JERRY_ASSERT (reg_index >= 0 && reg_index < frame_p->regs_number); - frame_p->regs_p [reg_index] = value; + frame_p->regs_p[reg_index] = value; } /* ecma_stack_frame_set_reg_value */ /** @@ -199,7 +199,7 @@ ecma_stack_push_value (ecma_stack_frame_t *frame_p, /**< ecma-stack frame */ JERRY_ASSERT (frame_p->current_slot_index < ecma_stack_slots_in_top_chunk (frame_p)); - frame_p->dynamically_allocated_value_slots_p [frame_p->current_slot_index] = value; + frame_p->dynamically_allocated_value_slots_p[frame_p->current_slot_index] = value; } /* ecma_stack_push_value */ /** @@ -212,7 +212,7 @@ ecma_stack_top_value (ecma_stack_frame_t *frame_p) /**< ecma-stack frame */ JERRY_ASSERT (frame_p->current_slot_index < slots_in_top_chunk); - return frame_p->dynamically_allocated_value_slots_p [frame_p->current_slot_index]; + return frame_p->dynamically_allocated_value_slots_p[frame_p->current_slot_index]; } /* ecma_stack_top_value */ /** diff --git a/jerry-core/ecma/base/ecma-stack.h b/jerry-core/ecma/base/ecma-stack.h index 1c2b54da54..2f8c2da12d 100644 --- a/jerry-core/ecma/base/ecma-stack.h +++ b/jerry-core/ecma/base/ecma-stack.h @@ -49,9 +49,9 @@ typedef struct ecma_stack_frame_t ecma_value_t *dynamically_allocated_value_slots_p; /**< pointer to dynamically allocated value slots * in the top-most chunk */ uint32_t current_slot_index; /**< index of first free slot in the top chunk */ - ecma_value_t inlined_values [ECMA_STACK_FRAME_INLINED_VALUES_NUMBER]; /**< place for values inlined in stack frame - * (instead of being dynamically allocated - * on the heap) */ + ecma_value_t inlined_values[ECMA_STACK_FRAME_INLINED_VALUES_NUMBER]; /**< place for values inlined in stack frame + * (instead of being dynamically allocated + * on the heap) */ ecma_value_t *regs_p; /**< register variables */ int32_t regs_number; /**< number of register variables */ } ecma_stack_frame_t; diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.cpp b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.cpp index add4f8a52d..28f873aad0 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.cpp @@ -181,7 +181,7 @@ ecma_builtin_array_prototype_object_push (ecma_value_t this_arg, /**< this argum { JERRY_ASSERT (argument_list_p == NULL || arguments_number > 0); - ecma_completion_value_t ret_value = ecma_make_empty_completion_value(); + ecma_completion_value_t ret_value = ecma_make_empty_completion_value (); // 1. ECMA_TRY_CATCH (obj_this_value, ecma_op_to_object (this_arg), ret_value); @@ -240,7 +240,7 @@ ecma_builtin_array_prototype_object_push (ecma_value_t this_arg, /**< this argum true); if (unlikely (ecma_is_completion_value_throw (completion) - || ecma_is_completion_value_exit(completion))) + || ecma_is_completion_value_exit (completion))) { ret_value = completion; diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.cpp b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.cpp index ee2207d167..d59c8fa214 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.cpp @@ -63,7 +63,7 @@ ecma_builtin_boolean_dispatch_call (const ecma_value_t *arguments_list_p, /**< a } else { - arg_value = arguments_list_p [0]; + arg_value = arguments_list_p[0]; } return ecma_op_to_boolean (arg_value); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-error.cpp b/jerry-core/ecma/builtin-objects/ecma-builtin-error.cpp index 942c2e5f5c..62c095af40 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-error.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-error.cpp @@ -55,7 +55,7 @@ ecma_builtin_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arg JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); if (arguments_list_len != 0 - && !ecma_is_value_undefined (arguments_list_p [0])) + && !ecma_is_value_undefined (arguments_list_p[0])) { ecma_completion_value_t ret_value = ecma_make_empty_completion_value (); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.cpp b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.cpp index a3677358fd..1a75ee9c6e 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.cpp @@ -55,7 +55,7 @@ ecma_builtin_eval_error_dispatch_call (const ecma_value_t *arguments_list_p, /** JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); if (arguments_list_len != 0 - && !ecma_is_value_undefined (arguments_list_p [0])) + && !ecma_is_value_undefined (arguments_list_p[0])) { ecma_completion_value_t ret_value = ecma_make_empty_completion_value (); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.cpp b/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.cpp index 84888f6423..961313a12d 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.cpp @@ -105,7 +105,7 @@ ecma_builtin_function_prototype_object_call (ecma_value_t this_arg, /**< this ar else { return ecma_op_function_call (func_obj_p, - arguments_list_p [0], + arguments_list_p[0], (arguments_number == 1u) ? NULL : (arguments_list_p + 1), (ecma_length_t) (arguments_number - 1u)); } diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h index 3e791abb68..9a2deac9a2 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h @@ -73,14 +73,14 @@ SORT_PROPERTY_NAMES_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (void) swapped = false; for (ecma_length_t i = 1; - i < (sizeof (ecma_builtin_property_names) / sizeof (ecma_builtin_property_names [0])); + i < (sizeof (ecma_builtin_property_names) / sizeof (ecma_builtin_property_names[0])); i++) { - if (ecma_builtin_property_names [i] < ecma_builtin_property_names [i - 1]) + if (ecma_builtin_property_names[i] < ecma_builtin_property_names[i - 1]) { - ecma_magic_string_id_t id_temp = ecma_builtin_property_names [i - 1]; - ecma_builtin_property_names [i - 1] = ecma_builtin_property_names [i]; - ecma_builtin_property_names [i] = id_temp; + ecma_magic_string_id_t id_temp = ecma_builtin_property_names[i - 1]; + ecma_builtin_property_names[i - 1] = ecma_builtin_property_names[i]; + ecma_builtin_property_names[i] = id_temp; swapped = true; } @@ -115,7 +115,7 @@ TRY_TO_INSTANTIATE_PROPERTY_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (ecma_object_t } const ecma_length_t property_numbers = (ecma_length_t) (sizeof (ecma_builtin_property_names) / - sizeof (ecma_builtin_property_names [0])); + sizeof (ecma_builtin_property_names[0])); int32_t index; index = ecma_builtin_bin_search_for_magic_string_id_in_array (ecma_builtin_property_names, property_numbers, @@ -279,7 +279,7 @@ DISPATCH_ROUTINE_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (uint16_t builtin_routine identifier */ ecma_value_t this_arg_value, /**< 'this' argument value */ - const ecma_value_t arguments_list [], /**< list of arguments + const ecma_value_t arguments_list[], /**< list of arguments passed to routine */ ecma_length_t arguments_number) /**< length of arguments' list */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-jerry.cpp b/jerry-core/ecma/builtin-objects/ecma-builtin-jerry.cpp index 80811556d7..b1b3cd370c 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-jerry.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-jerry.cpp @@ -118,8 +118,8 @@ ecma_builtin_jerry_try_to_instantiate_property (ecma_object_t *obj_p, /**< objec ecma_completion_value_t ecma_builtin_jerry_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide identifier of routine */ ecma_value_t this_arg_value __attr_unused___, /**< 'this' argument value */ - const ecma_value_t arguments_list [], /**< list of arguments - * passed to routine */ + const ecma_value_t arguments_list[], /**< list of arguments + * passed to routine */ ecma_length_t arguments_number) /**< length of arguments' list */ { uint32_t extension_object_index = builtin_routine_id / ECMA_EXTENSION_MAX_FUNCTIONS_IN_EXTENSION; @@ -138,7 +138,7 @@ ecma_builtin_jerry_dispatch_routine (uint16_t builtin_routine_id, /**< built-in JERRY_ASSERT (desc_p != NULL); JERRY_ASSERT (function_index < desc_p->functions_count); - jerry_extension_function_t *function_p = &desc_p->functions_p [function_index]; + jerry_extension_function_t *function_p = &desc_p->functions_p[function_index]; bool throw_type_error = false; if (function_p->args_number != arguments_number) @@ -150,8 +150,8 @@ ecma_builtin_jerry_dispatch_routine (uint16_t builtin_routine_id, /**< built-in uint32_t arg_index; for (arg_index = 0; arg_index < function_p->args_number; arg_index++) { - jerry_api_value_t *arg_p = &function_p->args_p [arg_index]; - const ecma_value_t arg_value = arguments_list [arg_index]; + jerry_api_value_t *arg_p = &function_p->args_p[arg_index]; + const ecma_value_t arg_value = arguments_list[arg_index]; if (arg_p->type == JERRY_API_DATA_TYPE_BOOLEAN) { @@ -234,7 +234,7 @@ ecma_builtin_jerry_dispatch_routine (uint16_t builtin_routine_id, /**< built-in arg_index < initialized_args_count; arg_index++) { - jerry_api_value_t *arg_p = &function_p->args_p [arg_index]; + jerry_api_value_t *arg_p = &function_p->args_p[arg_index]; if (arg_p->type == JERRY_API_DATA_TYPE_STRING) { @@ -342,8 +342,8 @@ ecma_extension_register (jerry_extension_descriptor_t *extension_desc_p) /**< ex for (uint32_t j = 0; j < extension_desc_p->fields_count; j++) { if (i != j - && !strcmp (extension_desc_p->fields_p [i].field_name_p, - extension_desc_p->fields_p [j].field_name_p)) + && !strcmp (extension_desc_p->fields_p[i].field_name_p, + extension_desc_p->fields_p[j].field_name_p)) { return false; } @@ -352,14 +352,14 @@ ecma_extension_register (jerry_extension_descriptor_t *extension_desc_p) /**< ex for (uint32_t i = 0; i < extension_desc_p->functions_count; i++) { - if (extension_desc_p->functions_p [i].args_number >= ECMA_EXTENSION_MAX_ARGUMENTS_IN_FUNCTION) + if (extension_desc_p->functions_p[i].args_number >= ECMA_EXTENSION_MAX_ARGUMENTS_IN_FUNCTION) { return false; } #if CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT32 /* Check if we can represent the arguments' values */ - for (uint32_t j = 0; j < extension_desc_p->functions_p [i].args_number; j++) + for (uint32_t j = 0; j < extension_desc_p->functions_p[i].args_number; j++) { if (extension_desc_p->functions_p[i].args_p[j].type == JERRY_API_DATA_TYPE_FLOAT64) { @@ -371,8 +371,8 @@ ecma_extension_register (jerry_extension_descriptor_t *extension_desc_p) /**< ex for (uint32_t j = 0; j < extension_desc_p->functions_count; j++) { if (i != j - && !strcmp (extension_desc_p->functions_p [i].function_name_p, - extension_desc_p->functions_p [j].function_name_p)) + && !strcmp (extension_desc_p->functions_p[i].function_name_p, + extension_desc_p->functions_p[j].function_name_p)) { return false; } @@ -399,8 +399,8 @@ ecma_extension_register (jerry_extension_descriptor_t *extension_desc_p) /**< ex for (uint32_t j = 0; j < extension_desc_p->functions_count; j++) { - if (!strcmp (extension_desc_p->fields_p [i].field_name_p, - extension_desc_p->functions_p [j].function_name_p)) + if (!strcmp (extension_desc_p->fields_p[i].field_name_p, + extension_desc_p->functions_p[j].function_name_p)) { return false; } @@ -480,7 +480,7 @@ ecma_op_extension_object_get_own_property (ecma_object_t *obj_p, /**< the extens field_index < desc_p->fields_count; field_index++) { - if (!strcmp (name_p, desc_p->fields_p [field_index].field_name_p)) + if (!strcmp (name_p, desc_p->fields_p[field_index].field_name_p)) { break; } @@ -488,7 +488,7 @@ ecma_op_extension_object_get_own_property (ecma_object_t *obj_p, /**< the extens if (field_index < desc_p->fields_count) { - const jerry_extension_field_t *field_p = &desc_p->fields_p [field_index]; + const jerry_extension_field_t *field_p = &desc_p->fields_p[field_index]; ecma_value_t value; prop_p = ecma_create_named_data_property (obj_p, @@ -549,7 +549,7 @@ ecma_op_extension_object_get_own_property (ecma_object_t *obj_p, /**< the extens function_index < desc_p->functions_count; function_index++) { - if (!strcmp (name_p, desc_p->functions_p [function_index].function_name_p)) + if (!strcmp (name_p, desc_p->functions_p[function_index].function_name_p)) { break; } @@ -557,7 +557,7 @@ ecma_op_extension_object_get_own_property (ecma_object_t *obj_p, /**< the extens if (function_index < desc_p->functions_count) { - const jerry_extension_function_t *function_p = &desc_p->functions_p [function_index]; + const jerry_extension_function_t *function_p = &desc_p->functions_p[function_index]; /* Currently, combined identifier of extension object and extension function should fit in uint16_t. */ JERRY_STATIC_ASSERT (ECMA_EXTENSION_MAX_NUMBER_OF_EXTENSIONS * ECMA_EXTENSION_MAX_FUNCTIONS_IN_EXTENSION diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-number.cpp b/jerry-core/ecma/builtin-objects/ecma-builtin-number.cpp index 95d45921d6..835277c35e 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-number.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-number.cpp @@ -66,7 +66,7 @@ ecma_builtin_number_dispatch_call (const ecma_value_t *arguments_list_p, /**< ar } else { - ret_value = ecma_op_to_number (arguments_list_p [0]); + ret_value = ecma_op_to_number (arguments_list_p[0]); } return ret_value; diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-object.cpp b/jerry-core/ecma/builtin-objects/ecma-builtin-object.cpp index 553574f1f3..9f279bbdcf 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-object.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-object.cpp @@ -57,13 +57,13 @@ ecma_builtin_object_dispatch_call (const ecma_value_t *arguments_list_p, /**< ar if (arguments_list_len == 0 || ecma_is_value_undefined (arguments_list_p[0]) - || ecma_is_value_null (arguments_list_p [0])) + || ecma_is_value_null (arguments_list_p[0])) { ret_value = ecma_builtin_object_dispatch_construct (arguments_list_p, arguments_list_len); } else { - ret_value = ecma_op_to_object (arguments_list_p [0]); + ret_value = ecma_op_to_object (arguments_list_p[0]); } return ret_value; @@ -88,7 +88,7 @@ ecma_builtin_object_dispatch_construct (const ecma_value_t *arguments_list_p, /* } else { - ecma_completion_value_t new_obj_value = ecma_op_create_object_object_arg (arguments_list_p [0]); + ecma_completion_value_t new_obj_value = ecma_op_create_object_object_arg (arguments_list_p[0]); if (!ecma_is_completion_value_normal (new_obj_value)) { diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.cpp b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.cpp index cb8529a225..9723ff9591 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.cpp @@ -55,7 +55,7 @@ ecma_builtin_range_error_dispatch_call (const ecma_value_t *arguments_list_p, /* JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); if (arguments_list_len != 0 - && !ecma_is_value_undefined (arguments_list_p [0])) + && !ecma_is_value_undefined (arguments_list_p[0])) { ecma_completion_value_t ret_value = ecma_make_empty_completion_value (); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.cpp b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.cpp index 4fa65f3f4a..d8bc2261a5 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.cpp @@ -55,7 +55,7 @@ ecma_builtin_reference_error_dispatch_call (const ecma_value_t *arguments_list_p JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); if (arguments_list_len != 0 - && !ecma_is_value_undefined (arguments_list_p [0])) + && !ecma_is_value_undefined (arguments_list_p[0])) { ecma_completion_value_t ret_value = ecma_make_empty_completion_value (); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string.cpp b/jerry-core/ecma/builtin-objects/ecma-builtin-string.cpp index 7fee5680de..08abaf0926 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-string.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string.cpp @@ -64,7 +64,7 @@ ecma_builtin_string_object_from_char_code (ecma_value_t this_arg __attr_unused__ ecma_char_t *ret_zt_str_p = (ecma_char_t*) mem_heap_alloc_block (zt_str_buffer_size, MEM_HEAP_ALLOC_SHORT_TERM); - ret_zt_str_p [args_number] = ECMA_CHAR_NULL; + ret_zt_str_p[args_number] = ECMA_CHAR_NULL; for (ecma_length_t arg_index = 0; arg_index < args_number; @@ -82,10 +82,10 @@ ecma_builtin_string_object_from_char_code (ecma_value_t this_arg __attr_unused__ } else { - ret_zt_str_p [arg_index] = (ecma_char_t) uint16_char_code; + ret_zt_str_p[arg_index] = (ecma_char_t) uint16_char_code; } #elif CONFIG_ECMA_CHAR_ENCODING == CONFIG_ECMA_CHAR_UTF16 - ret_zt_str_p [arg_index] = (ecma_char_t) uint16_char_code; + ret_zt_str_p[arg_index] = (ecma_char_t) uint16_char_code; #endif /* CONFIG_ECMA_CHAR_ENCODING == CONFIG_ECMA_CHAR_UTF16 */ ECMA_OP_TO_NUMBER_FINALIZE (arg_num); @@ -129,7 +129,7 @@ ecma_builtin_string_dispatch_call (const ecma_value_t *arguments_list_p, /**< ar } else { - ret_value = ecma_op_to_string (arguments_list_p [0]); + ret_value = ecma_op_to_string (arguments_list_p[0]); } return ret_value; diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.cpp b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.cpp index 92b44808ad..87dbe484d2 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.cpp @@ -55,7 +55,7 @@ ecma_builtin_syntax_error_dispatch_call (const ecma_value_t *arguments_list_p, / JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); if (arguments_list_len != 0 - && !ecma_is_value_undefined (arguments_list_p [0])) + && !ecma_is_value_undefined (arguments_list_p[0])) { ecma_completion_value_t ret_value = ecma_make_empty_completion_value (); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.cpp b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.cpp index 2472f726aa..06b2220a6e 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.cpp @@ -55,7 +55,7 @@ ecma_builtin_type_error_dispatch_call (const ecma_value_t *arguments_list_p, /** JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); if (arguments_list_len != 0 - && !ecma_is_value_undefined (arguments_list_p [0])) + && !ecma_is_value_undefined (arguments_list_p[0])) { ecma_completion_value_t ret_value = ecma_make_empty_completion_value (); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.cpp b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.cpp index 957c1b69dd..75f9cc52e2 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.cpp @@ -55,7 +55,7 @@ ecma_builtin_uri_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); if (arguments_list_len != 0 - && !ecma_is_value_undefined (arguments_list_p [0])) + && !ecma_is_value_undefined (arguments_list_p[0])) { ecma_completion_value_t ret_value = ecma_make_empty_completion_value (); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtins-internal.h b/jerry-core/ecma/builtin-objects/ecma-builtins-internal.h index 44000a6ad6..fdc5f87342 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtins-internal.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtins-internal.h @@ -71,7 +71,7 @@ ecma_builtin_ ## lowercase_name ## _dispatch_construct (const ecma_value_t *argu extern ecma_completion_value_t \ ecma_builtin_ ## lowercase_name ## _dispatch_routine (uint16_t builtin_routine_id, \ ecma_value_t this_arg_value, \ - const ecma_value_t arguments_list [], \ + const ecma_value_t arguments_list[], \ ecma_length_t arguments_number); \ extern ecma_property_t* \ ecma_builtin_ ## lowercase_name ## _try_to_instantiate_property (ecma_object_t *obj_p, \ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtins.cpp b/jerry-core/ecma/builtin-objects/ecma-builtins.cpp index f228254a07..93596108d1 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtins.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtins.cpp @@ -35,14 +35,14 @@ static ecma_completion_value_t ecma_builtin_dispatch_routine (ecma_builtin_id_t builtin_object_id, uint16_t builtin_routine_id, ecma_value_t this_arg_value, - const ecma_value_t arguments_list [], + const ecma_value_t arguments_list[], ecma_length_t arguments_number); static void ecma_instantiate_builtin (ecma_builtin_id_t id); /** * Pointer to instances of built-in objects */ -static ecma_object_t* ecma_builtin_objects [ECMA_BUILTIN_ID__COUNT]; +static ecma_object_t* ecma_builtin_objects[ECMA_BUILTIN_ID__COUNT]; /** * Check if passed object is the instance of specified built-in. @@ -54,12 +54,12 @@ ecma_builtin_is (ecma_object_t *obj_p, /**< pointer to an object */ JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p)); JERRY_ASSERT (builtin_id < ECMA_BUILTIN_ID__COUNT); - if (unlikely (ecma_builtin_objects [builtin_id] == NULL)) + if (unlikely (ecma_builtin_objects[builtin_id] == NULL)) { ecma_instantiate_builtin (builtin_id); } - return (obj_p == ecma_builtin_objects [builtin_id]); + return (obj_p == ecma_builtin_objects[builtin_id]); } /* ecma_builtin_is */ /** @@ -72,14 +72,14 @@ ecma_builtin_get (ecma_builtin_id_t builtin_id) /**< id of built-in to check on { JERRY_ASSERT (builtin_id < ECMA_BUILTIN_ID__COUNT); - if (unlikely (ecma_builtin_objects [builtin_id] == NULL)) + if (unlikely (ecma_builtin_objects[builtin_id] == NULL)) { ecma_instantiate_builtin (builtin_id); } - ecma_ref_object (ecma_builtin_objects [builtin_id]); + ecma_ref_object (ecma_builtin_objects[builtin_id]); - return ecma_builtin_objects [builtin_id]; + return ecma_builtin_objects[builtin_id]; } /* ecma_builtin_get */ /** @@ -169,7 +169,7 @@ ecma_init_builtins (void) id < ECMA_BUILTIN_ID__COUNT; id = (ecma_builtin_id_t) (id + 1)) { - ecma_builtin_objects [id] = NULL; + ecma_builtin_objects[id] = NULL; } } /* ecma_init_builtins */ @@ -190,7 +190,7 @@ ecma_instantiate_builtin (ecma_builtin_id_t id) /**< built-in id */ lowercase_name) \ case builtin_id: \ { \ - JERRY_ASSERT (ecma_builtin_objects [builtin_id] == NULL); \ + JERRY_ASSERT (ecma_builtin_objects[builtin_id] == NULL); \ if (is_static) \ { \ ecma_builtin_ ## lowercase_name ## _sort_property_names (); \ @@ -203,11 +203,11 @@ ecma_instantiate_builtin (ecma_builtin_id_t id) /**< built-in id */ } \ else \ { \ - if (ecma_builtin_objects [object_prototype_builtin_id] == NULL) \ + if (ecma_builtin_objects[object_prototype_builtin_id] == NULL) \ { \ ecma_instantiate_builtin (object_prototype_builtin_id); \ } \ - prototype_obj_p = ecma_builtin_objects [object_prototype_builtin_id]; \ + prototype_obj_p = ecma_builtin_objects[object_prototype_builtin_id]; \ JERRY_ASSERT (prototype_obj_p != NULL); \ } \ \ @@ -216,7 +216,7 @@ ecma_instantiate_builtin (ecma_builtin_id_t id) /**< built-in id */ object_type, \ object_class, \ is_extensible); \ - ecma_builtin_objects [builtin_id] = builtin_obj_p; \ + ecma_builtin_objects[builtin_id] = builtin_obj_p; \ \ break; \ } @@ -241,11 +241,11 @@ ecma_finalize_builtins (void) id < ECMA_BUILTIN_ID__COUNT; id = (ecma_builtin_id_t) (id + 1)) { - if (ecma_builtin_objects [id] != NULL) + if (ecma_builtin_objects[id] != NULL) { - ecma_deref_object (ecma_builtin_objects [id]); + ecma_deref_object (ecma_builtin_objects[id]); - ecma_builtin_objects [id] = NULL; + ecma_builtin_objects[id] = NULL; } } } /* ecma_finalize_builtins */ @@ -523,7 +523,7 @@ ecma_builtin_dispatch_routine (ecma_builtin_id_t builtin_object_id, /**< built-i * of the built-in object's * routine property */ ecma_value_t this_arg_value, /**< 'this' argument value */ - const ecma_value_t arguments_list [], /**< list of arguments passed to routine */ + const ecma_value_t arguments_list[], /**< list of arguments passed to routine */ ecma_length_t arguments_number) /**< length of arguments' list */ { switch (builtin_object_id) @@ -583,7 +583,7 @@ ecma_builtin_bin_search_for_magic_string_id_in_array (const ecma_magic_string_id id_index < array_length; id_index++) { - JERRY_ASSERT (ids [id_index - 1] < ids [id_index]); + JERRY_ASSERT (ids[id_index - 1] < ids[id_index]); } #endif /* !JERRY_NDEBUG */ diff --git a/jerry-core/ecma/operations/ecma-array-object.cpp b/jerry-core/ecma/operations/ecma-array-object.cpp index f7d344425b..32ea8797fe 100644 --- a/jerry-core/ecma/operations/ecma-array-object.cpp +++ b/jerry-core/ecma/operations/ecma-array-object.cpp @@ -133,7 +133,7 @@ ecma_op_create_array_object (const ecma_value_t *arguments_list_p, /**< list of ecma_property_descriptor_t item_prop_desc = ecma_make_empty_property_descriptor (); { item_prop_desc.is_value_defined = true; - item_prop_desc.value = array_items_p [index]; + item_prop_desc.value = array_items_p[index]; item_prop_desc.is_writable_defined = true; item_prop_desc.is_writable = true; @@ -377,7 +377,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o return ret_value; } - JERRY_UNREACHABLE(); + JERRY_UNREACHABLE (); } else { @@ -453,7 +453,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE); } - JERRY_UNREACHABLE(); + JERRY_UNREACHABLE (); } /* ecma_op_array_object_define_own_property */ /** diff --git a/jerry-core/ecma/operations/ecma-comparison.cpp b/jerry-core/ecma/operations/ecma-comparison.cpp index 5731ad7057..c06e4003d3 100644 --- a/jerry-core/ecma/operations/ecma-comparison.cpp +++ b/jerry-core/ecma/operations/ecma-comparison.cpp @@ -120,7 +120,7 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */ } else { // f. - JERRY_ASSERT(is_x_object); + JERRY_ASSERT (is_x_object); bool is_equal = (ecma_get_object_from_value (x) == ecma_get_object_from_value (y)); @@ -339,12 +339,12 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */ ecma_value_t second_converted_value = left_first ? y : x; // 1., 2. - ECMA_TRY_CATCH(prim_first_converted_value, - ecma_op_to_primitive (first_converted_value, ECMA_PREFERRED_TYPE_NUMBER), - ret_value); - ECMA_TRY_CATCH(prim_second_converted_value, - ecma_op_to_primitive (second_converted_value, ECMA_PREFERRED_TYPE_NUMBER), - ret_value); + ECMA_TRY_CATCH (prim_first_converted_value, + ecma_op_to_primitive (first_converted_value, ECMA_PREFERRED_TYPE_NUMBER), + ret_value); + ECMA_TRY_CATCH (prim_second_converted_value, + ecma_op_to_primitive (second_converted_value, ECMA_PREFERRED_TYPE_NUMBER), + ret_value); const ecma_value_t &px = left_first ? prim_first_converted_value : prim_second_converted_value; const ecma_value_t &py = left_first ? prim_second_converted_value : prim_first_converted_value; @@ -448,8 +448,8 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */ : ECMA_SIMPLE_VALUE_FALSE); } - ECMA_FINALIZE(prim_second_converted_value); - ECMA_FINALIZE(prim_first_converted_value); + ECMA_FINALIZE (prim_second_converted_value); + ECMA_FINALIZE (prim_first_converted_value); return ret_value; } /* ecma_op_abstract_relational_compare */ diff --git a/jerry-core/ecma/operations/ecma-conversion.cpp b/jerry-core/ecma/operations/ecma-conversion.cpp index c34acd7193..b00d348197 100644 --- a/jerry-core/ecma/operations/ecma-conversion.cpp +++ b/jerry-core/ecma/operations/ecma-conversion.cpp @@ -142,7 +142,7 @@ ecma_op_same_value (ecma_value_t x, /**< ecma-value */ return (ecma_is_value_true (x) == ecma_is_value_true (y)); } - JERRY_ASSERT(is_x_object); + JERRY_ASSERT (is_x_object); return (ecma_get_object_from_value (x) == ecma_get_object_from_value (y)); } /* ecma_op_same_value */ diff --git a/jerry-core/ecma/operations/ecma-function-object.cpp b/jerry-core/ecma/operations/ecma-function-object.cpp index 62618c1e20..034f4bfcc2 100644 --- a/jerry-core/ecma/operations/ecma-function-object.cpp +++ b/jerry-core/ecma/operations/ecma-function-object.cpp @@ -49,7 +49,7 @@ ecma_pack_code_internal_property_value (bool is_strict, /**< is code strict? */ uint32_t value = opcode_idx; const uint32_t is_strict_bit_offset = (uint32_t) (sizeof (value) * JERRY_BITSINBYTE - 1); - JERRY_ASSERT(((value) & (1u << is_strict_bit_offset)) == 0); + JERRY_ASSERT (((value) & (1u << is_strict_bit_offset)) == 0); if (is_strict) { @@ -69,7 +69,7 @@ static opcode_counter_t ecma_unpack_code_internal_property_value (uint32_t value, /**< packed value */ bool* out_is_strict_p) /**< out: is code strict? */ { - JERRY_ASSERT(out_is_strict_p != NULL); + JERRY_ASSERT (out_is_strict_p != NULL); const uint32_t is_strict_bit_offset = (uint32_t) (sizeof (value) * JERRY_BITSINBYTE - 1); @@ -99,8 +99,8 @@ ecma_op_is_callable (ecma_value_t value) /**< ecma-value */ ecma_object_t *obj_p = ecma_get_object_from_value (value); - JERRY_ASSERT(obj_p != NULL); - JERRY_ASSERT(!ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (obj_p != NULL); + JERRY_ASSERT (!ecma_is_lexical_environment (obj_p)); return (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_FUNCTION || ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_BOUND_FUNCTION @@ -124,8 +124,8 @@ ecma_is_constructor (ecma_value_t value) /**< ecma-value */ ecma_object_t *obj_p = ecma_get_object_from_value (value); - JERRY_ASSERT(obj_p != NULL); - JERRY_ASSERT(!ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (obj_p != NULL); + JERRY_ASSERT (!ecma_is_lexical_environment (obj_p)); return (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_FUNCTION || ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_BOUND_FUNCTION @@ -166,7 +166,7 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f // 9. ecma_property_t *scope_prop_p = ecma_create_internal_property (f, ECMA_INTERNAL_PROPERTY_SCOPE); - ECMA_SET_POINTER(scope_prop_p->u.internal_property.value, scope_p); + ECMA_SET_POINTER (scope_prop_p->u.internal_property.value, scope_p); // 10., 11. ecma_property_t *formal_parameters_prop_p = ecma_create_internal_property (f, @@ -434,8 +434,8 @@ ecma_completion_value_t ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object */ ecma_value_t value) /**< argument 'V' */ { - JERRY_ASSERT(func_obj_p != NULL - && !ecma_is_lexical_environment (func_obj_p)); + JERRY_ASSERT (func_obj_p != NULL + && !ecma_is_lexical_environment (func_obj_p)); if (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_FUNCTION) { @@ -516,10 +516,10 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */ const ecma_value_t* arguments_list_p, /**< arguments list */ ecma_length_t arguments_list_len) /**< length of arguments list */ { - JERRY_ASSERT(func_obj_p != NULL - && !ecma_is_lexical_environment (func_obj_p)); - JERRY_ASSERT(ecma_op_is_callable (ecma_make_object_value (func_obj_p))); - JERRY_ASSERT(arguments_list_len == 0 || arguments_list_p != NULL); + JERRY_ASSERT (func_obj_p != NULL + && !ecma_is_lexical_environment (func_obj_p)); + JERRY_ASSERT (ecma_op_is_callable (ecma_make_object_value (func_obj_p))); + JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); ecma_completion_value_t ret_value = ecma_make_empty_completion_value (); @@ -622,7 +622,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */ } else { - JERRY_ASSERT(ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BOUND_FUNCTION); + JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BOUND_FUNCTION); JERRY_UNIMPLEMENTED ("Bound functions are not implemented."); } @@ -727,10 +727,10 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */ const ecma_value_t* arguments_list_p, /**< arguments list */ ecma_length_t arguments_list_len) /**< length of arguments list */ { - JERRY_ASSERT(func_obj_p != NULL - && !ecma_is_lexical_environment (func_obj_p)); - JERRY_ASSERT(ecma_is_constructor (ecma_make_object_value (func_obj_p))); - JERRY_ASSERT(arguments_list_len == 0 || arguments_list_p != NULL); + JERRY_ASSERT (func_obj_p != NULL + && !ecma_is_lexical_environment (func_obj_p)); + JERRY_ASSERT (ecma_is_constructor (ecma_make_object_value (func_obj_p))); + JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); if (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_FUNCTION) { @@ -748,7 +748,7 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */ } else { - JERRY_ASSERT(ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BOUND_FUNCTION); + JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BOUND_FUNCTION); JERRY_UNIMPLEMENTED ("Bound functions are not implemented."); } diff --git a/jerry-core/ecma/operations/ecma-get-put-value.cpp b/jerry-core/ecma/operations/ecma-get-put-value.cpp index 766a6aa2a1..ab3d07b8c4 100644 --- a/jerry-core/ecma/operations/ecma-get-put-value.cpp +++ b/jerry-core/ecma/operations/ecma-get-put-value.cpp @@ -56,8 +56,8 @@ ecma_op_get_value_lex_env_base (ecma_object_t *ref_base_lex_env_p, /**< referenc } // 5. - JERRY_ASSERT(ref_base_lex_env_p != NULL - && ecma_is_lexical_environment (ref_base_lex_env_p)); + JERRY_ASSERT (ref_base_lex_env_p != NULL + && ecma_is_lexical_environment (ref_base_lex_env_p)); // 5.a return ecma_op_get_binding_value (ref_base_lex_env_p, @@ -94,8 +94,8 @@ ecma_op_get_value_object_base (ecma_reference_t ref) /**< ECMA-reference */ // 4.b case 1 ecma_object_t *obj_p = ecma_get_object_from_value (base); - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); return ecma_op_object_get (obj_p, ECMA_GET_NON_NULL_POINTER (ecma_string_t, ref.referenced_name_cp)); @@ -156,16 +156,16 @@ ecma_op_put_value_lex_env_base (ecma_object_t *ref_base_lex_env_p, /**< referenc ecma_deref_object (global_object_p); - JERRY_ASSERT(ecma_is_completion_value_normal_true (completion) - || ecma_is_completion_value_normal_false (completion)); + JERRY_ASSERT (ecma_is_completion_value_normal_true (completion) + || ecma_is_completion_value_normal_false (completion)); return ecma_make_empty_completion_value (); } } // 5. - JERRY_ASSERT(ref_base_lex_env_p != NULL - && ecma_is_lexical_environment (ref_base_lex_env_p)); + JERRY_ASSERT (ref_base_lex_env_p != NULL + && ecma_is_lexical_environment (ref_base_lex_env_p)); // 5.a return ecma_op_set_mutable_binding (ref_base_lex_env_p, diff --git a/jerry-core/ecma/operations/ecma-lex-env.cpp b/jerry-core/ecma/operations/ecma-lex-env.cpp index 30ba374302..6ceb3b0344 100644 --- a/jerry-core/ecma/operations/ecma-lex-env.cpp +++ b/jerry-core/ecma/operations/ecma-lex-env.cpp @@ -92,8 +92,8 @@ ecma_get_global_environment (void) bool ecma_is_lexical_environment_global (ecma_object_t *lex_env_p) /**< lexical environment */ { - JERRY_ASSERT(lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (lex_env_p != NULL + && ecma_is_lexical_environment (lex_env_p)); return (lex_env_p == ecma_global_lex_env_p); } /* ecma_is_lexical_environment_global */ @@ -113,8 +113,8 @@ bool ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */ ecma_string_t *name_p) /**< argument N */ { - JERRY_ASSERT(lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (lex_env_p != NULL + && ecma_is_lexical_environment (lex_env_p)); if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE) { @@ -145,9 +145,9 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme ecma_string_t *name_p, /**< argument N */ bool is_deletable) /**< argument D */ { - JERRY_ASSERT(lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); - JERRY_ASSERT(name_p != NULL); + JERRY_ASSERT (lex_env_p != NULL + && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (name_p != NULL); if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE) { @@ -209,9 +209,9 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment ecma_value_t value, /**< argument V */ bool is_strict) /**< argument S */ { - JERRY_ASSERT(lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); - JERRY_ASSERT(name_p != NULL); + JERRY_ASSERT (lex_env_p != NULL + && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (name_p != NULL); if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE) { @@ -284,9 +284,9 @@ ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */ ecma_string_t *name_p, /**< argument N */ bool is_strict) /**< argument S */ { - JERRY_ASSERT(lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); - JERRY_ASSERT(name_p != NULL); + JERRY_ASSERT (lex_env_p != NULL + && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (name_p != NULL); if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE) { @@ -366,9 +366,9 @@ ecma_completion_value_t ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */ ecma_string_t *name_p) /**< argument N */ { - JERRY_ASSERT(lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); - JERRY_ASSERT(name_p != NULL); + JERRY_ASSERT (lex_env_p != NULL + && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (name_p != NULL); if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE) @@ -382,7 +382,7 @@ ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */ } else { - JERRY_ASSERT(prop_p->type == ECMA_PROPERTY_NAMEDDATA); + JERRY_ASSERT (prop_p->type == ECMA_PROPERTY_NAMEDDATA); if (!ecma_is_property_configurable (prop_p)) { @@ -419,8 +419,8 @@ ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */ ecma_completion_value_t ecma_op_implicit_this_value (ecma_object_t *lex_env_p) /**< lexical environment */ { - JERRY_ASSERT(lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (lex_env_p != NULL + && ecma_is_lexical_environment (lex_env_p)); if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE) { @@ -453,8 +453,8 @@ void ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */ ecma_string_t *name_p) /**< argument N */ { - JERRY_ASSERT(lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (lex_env_p != NULL + && ecma_is_lexical_environment (lex_env_p)); JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE); /* @@ -465,7 +465,7 @@ ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environ name_p, false, false, false); - JERRY_ASSERT(ecma_is_value_undefined (ecma_get_named_data_property_value (prop_p))); + JERRY_ASSERT (ecma_is_value_undefined (ecma_get_named_data_property_value (prop_p))); ecma_set_named_data_property_value (prop_p, ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY)); @@ -481,15 +481,15 @@ ecma_op_initialize_immutable_binding (ecma_object_t *lex_env_p, /**< lexical env ecma_string_t *name_p, /**< argument N */ ecma_value_t value) /**< argument V */ { - JERRY_ASSERT(lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (lex_env_p != NULL + && ecma_is_lexical_environment (lex_env_p)); JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE); ecma_property_t *prop_p = ecma_get_named_data_property (lex_env_p, name_p); /* The binding must be unitialized immutable binding */ - JERRY_ASSERT(!ecma_is_property_writable (prop_p) - && ecma_is_value_empty (ecma_get_named_data_property_value (prop_p))); + JERRY_ASSERT (!ecma_is_property_writable (prop_p) + && ecma_is_value_empty (ecma_get_named_data_property_value (prop_p))); ecma_named_data_property_assign_value (lex_env_p, prop_p, value); } /* ecma_op_initialize_immutable_binding */ diff --git a/jerry-core/ecma/operations/ecma-objects-arguments.cpp b/jerry-core/ecma/operations/ecma-objects-arguments.cpp index 42a599f1f2..505ad1628f 100644 --- a/jerry-core/ecma/operations/ecma-objects-arguments.cpp +++ b/jerry-core/ecma/operations/ecma-objects-arguments.cpp @@ -192,11 +192,11 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */ ecma_property_t *parameters_map_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_PARAMETERS_MAP); - ECMA_SET_POINTER(parameters_map_prop_p->u.internal_property.value, map_p); + ECMA_SET_POINTER (parameters_map_prop_p->u.internal_property.value, map_p); ecma_property_t *scope_prop_p = ecma_create_internal_property (map_p, ECMA_INTERNAL_PROPERTY_SCOPE); - ECMA_SET_POINTER(scope_prop_p->u.internal_property.value, lex_env_p); + ECMA_SET_POINTER (scope_prop_p->u.internal_property.value, lex_env_p); ecma_deref_object (map_p); } @@ -281,8 +281,8 @@ ecma_arguments_get_mapped_arg_value (ecma_object_t *map_p, /**< [[ParametersMap] ecma_property_t *scope_prop_p = ecma_get_internal_property (map_p, ECMA_INTERNAL_PROPERTY_SCOPE); ecma_object_t *lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, scope_prop_p->u.internal_property.value); - JERRY_ASSERT(lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (lex_env_p != NULL + && ecma_is_lexical_environment (lex_env_p)); ecma_value_t arg_name_prop_value = ecma_get_named_data_property_value (arg_name_prop_p); diff --git a/jerry-core/ecma/operations/ecma-objects-general.cpp b/jerry-core/ecma/operations/ecma-objects-general.cpp index 3eab0fea16..ccff89266d 100644 --- a/jerry-core/ecma/operations/ecma-objects-general.cpp +++ b/jerry-core/ecma/operations/ecma-objects-general.cpp @@ -118,9 +118,9 @@ ecma_completion_value_t ecma_op_general_object_get (ecma_object_t *obj_p, /**< the object */ ecma_string_t *property_name_p) /**< property name */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); - JERRY_ASSERT(property_name_p != NULL); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (property_name_p != NULL); // 1. const ecma_property_t* prop_p = ecma_op_object_get_property (obj_p, property_name_p); @@ -156,7 +156,7 @@ ecma_op_general_object_get (ecma_object_t *obj_p, /**< the object */ } } - JERRY_UNREACHABLE(); + JERRY_UNREACHABLE (); } /* ecma_op_general_object_get */ /** @@ -173,9 +173,9 @@ ecma_property_t* ecma_op_general_object_get_own_property (ecma_object_t *obj_p, /**< the object */ ecma_string_t *property_name_p) /**< property name */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); - JERRY_ASSERT(property_name_p != NULL); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (property_name_p != NULL); return ecma_find_named_property (obj_p, property_name_p); } /* ecma_op_general_object_get_own_property */ @@ -194,9 +194,9 @@ ecma_property_t* ecma_op_general_object_get_property (ecma_object_t *obj_p, /**< the object */ ecma_string_t *property_name_p) /**< property name */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); - JERRY_ASSERT(property_name_p != NULL); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (property_name_p != NULL); // 1. ecma_property_t *prop_p = ecma_op_object_get_own_property (obj_p, property_name_p); @@ -237,9 +237,9 @@ ecma_op_general_object_put (ecma_object_t *obj_p, /**< the object */ ecma_value_t value, /**< ecma-value */ bool is_throw) /**< flag that controls failure handling */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); - JERRY_ASSERT(property_name_p != NULL); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (property_name_p != NULL); // 1. if (!ecma_op_object_can_put (obj_p, property_name_p)) @@ -286,7 +286,7 @@ ecma_op_general_object_put (ecma_object_t *obj_p, /**< the object */ { // a. ecma_object_t *setter_p = ecma_get_named_accessor_property_setter (desc_p); - JERRY_ASSERT(setter_p != NULL); + JERRY_ASSERT (setter_p != NULL); ecma_completion_value_t ret_value = ecma_make_empty_completion_value (); @@ -330,7 +330,7 @@ ecma_op_general_object_put (ecma_object_t *obj_p, /**< the object */ is_throw); } - JERRY_UNREACHABLE(); + JERRY_UNREACHABLE (); } /* ecma_op_general_object_put */ /** @@ -347,9 +347,9 @@ bool ecma_op_general_object_can_put (ecma_object_t *obj_p, /**< the object */ ecma_string_t *property_name_p) /**< property name */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); - JERRY_ASSERT(property_name_p != NULL); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (property_name_p != NULL); // 1. ecma_property_t *prop_p = ecma_op_object_get_own_property (obj_p, property_name_p); @@ -375,7 +375,7 @@ ecma_op_general_object_can_put (ecma_object_t *obj_p, /**< the object */ { // b. - JERRY_ASSERT(prop_p->type == ECMA_PROPERTY_NAMEDDATA); + JERRY_ASSERT (prop_p->type == ECMA_PROPERTY_NAMEDDATA); return ecma_is_property_writable (prop_p); } @@ -416,7 +416,7 @@ ecma_op_general_object_can_put (ecma_object_t *obj_p, /**< the object */ else { // 8. - JERRY_ASSERT(inherited_p->type == ECMA_PROPERTY_NAMEDDATA); + JERRY_ASSERT (inherited_p->type == ECMA_PROPERTY_NAMEDDATA); // a. if (!ecma_get_object_extensible (obj_p)) @@ -430,7 +430,7 @@ ecma_op_general_object_can_put (ecma_object_t *obj_p, /**< the object */ } } - JERRY_UNREACHABLE(); + JERRY_UNREACHABLE (); } /* ecma_op_general_object_can_put */ /** @@ -448,9 +448,9 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */ ecma_string_t *property_name_p, /**< property name */ bool is_throw) /**< flag that controls failure handling */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); - JERRY_ASSERT(property_name_p != NULL); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (property_name_p != NULL); // 1. ecma_property_t *desc_p = ecma_op_object_get_own_property (obj_p, property_name_p); @@ -481,7 +481,7 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */ return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE); } - JERRY_UNREACHABLE(); + JERRY_UNREACHABLE (); } /* ecma_op_general_object_delete */ /** @@ -498,8 +498,8 @@ ecma_completion_value_t ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */ ecma_preferred_type_hint_t hint) /**< hint on preferred result type */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); if (hint == ECMA_PREFERRED_TYPE_NO) { @@ -589,9 +589,9 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec * descriptor */ bool is_throw) /**< flag that controls failure handling */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); - JERRY_ASSERT(property_name_p != NULL); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (property_name_p != NULL); const bool is_property_desc_generic_descriptor = (!property_desc_p->is_value_defined && !property_desc_p->is_writable_defined @@ -633,7 +633,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec else { // b. - JERRY_ASSERT(is_property_desc_accessor_descriptor); + JERRY_ASSERT (is_property_desc_accessor_descriptor); ecma_create_named_accessor_property (obj_p, property_name_p, @@ -659,7 +659,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec const bool is_current_data_descriptor = (current_p->type == ECMA_PROPERTY_NAMEDDATA); const bool is_current_accessor_descriptor = (current_p->type == ECMA_PROPERTY_NAMEDACCESSOR); - JERRY_ASSERT(is_current_data_descriptor || is_current_accessor_descriptor); + JERRY_ASSERT (is_current_data_descriptor || is_current_accessor_descriptor); bool is_every_field_in_desc_also_occurs_in_current_desc_with_same_value = true; if (property_desc_p->is_value_defined) @@ -796,7 +796,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec } else { - JERRY_ASSERT(is_property_desc_accessor_descriptor && is_current_accessor_descriptor); + JERRY_ASSERT (is_property_desc_accessor_descriptor && is_current_accessor_descriptor); // 11. @@ -818,28 +818,28 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec // 12. if (property_desc_p->is_value_defined) { - JERRY_ASSERT(is_current_data_descriptor); + JERRY_ASSERT (is_current_data_descriptor); ecma_named_data_property_assign_value (obj_p, current_p, property_desc_p->value); } if (property_desc_p->is_writable_defined) { - JERRY_ASSERT(is_current_data_descriptor); + JERRY_ASSERT (is_current_data_descriptor); ecma_set_property_writable_attr (current_p, property_desc_p->is_writable); } if (property_desc_p->is_get_defined) { - JERRY_ASSERT(is_current_accessor_descriptor); + JERRY_ASSERT (is_current_accessor_descriptor); ecma_set_named_accessor_property_getter (obj_p, current_p, property_desc_p->get_p); } if (property_desc_p->is_set_defined) { - JERRY_ASSERT(is_current_accessor_descriptor); + JERRY_ASSERT (is_current_accessor_descriptor); ecma_set_named_accessor_property_setter (obj_p, current_p, property_desc_p->set_p); } diff --git a/jerry-core/ecma/operations/ecma-objects.cpp b/jerry-core/ecma/operations/ecma-objects.cpp index a460add6ba..0ee1682ca1 100644 --- a/jerry-core/ecma/operations/ecma-objects.cpp +++ b/jerry-core/ecma/operations/ecma-objects.cpp @@ -62,9 +62,9 @@ ecma_completion_value_t ecma_op_object_get (ecma_object_t *obj_p, /**< the object */ ecma_string_t *property_name_p) /**< property name */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); - JERRY_ASSERT(property_name_p != NULL); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (property_name_p != NULL); const ecma_object_type_t type = ecma_get_object_type (obj_p); ecma_assert_object_type_is_valid (type); @@ -173,9 +173,9 @@ ecma_property_t* ecma_op_object_get_own_property (ecma_object_t *obj_p, /**< the object */ ecma_string_t *property_name_p) /**< property name */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); - JERRY_ASSERT(property_name_p != NULL); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (property_name_p != NULL); ecma_property_t *prop_p = NULL; @@ -202,9 +202,9 @@ ecma_property_t* ecma_op_object_get_property (ecma_object_t *obj_p, /**< the object */ ecma_string_t *property_name_p) /**< property name */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); - JERRY_ASSERT(property_name_p != NULL); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (property_name_p != NULL); const ecma_object_type_t type = ecma_get_object_type (obj_p); ecma_assert_object_type_is_valid (type); @@ -245,9 +245,9 @@ ecma_op_object_put (ecma_object_t *obj_p, /**< the object */ ecma_value_t value, /**< ecma-value */ bool is_throw) /**< flag that controls failure handling */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); - JERRY_ASSERT(property_name_p != NULL); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (property_name_p != NULL); const ecma_object_type_t type = ecma_get_object_type (obj_p); ecma_assert_object_type_is_valid (type); @@ -286,9 +286,9 @@ bool ecma_op_object_can_put (ecma_object_t *obj_p, /**< the object */ ecma_string_t *property_name_p) /**< property name */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); - JERRY_ASSERT(property_name_p != NULL); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (property_name_p != NULL); const ecma_object_type_t type = ecma_get_object_type (obj_p); ecma_assert_object_type_is_valid (type); @@ -328,9 +328,9 @@ ecma_op_object_delete (ecma_object_t *obj_p, /**< the object */ ecma_string_t *property_name_p, /**< property name */ bool is_throw) /**< flag that controls failure handling */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); - JERRY_ASSERT(property_name_p != NULL); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (property_name_p != NULL); const ecma_object_type_t type = ecma_get_object_type (obj_p); ecma_assert_object_type_is_valid (type); @@ -377,8 +377,8 @@ ecma_completion_value_t ecma_op_object_default_value (ecma_object_t *obj_p, /**< the object */ ecma_preferred_type_hint_t hint) /**< hint on preferred result type */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); const ecma_object_type_t type = ecma_get_object_type (obj_p); ecma_assert_object_type_is_valid (type); @@ -420,9 +420,9 @@ ecma_op_object_define_own_property (ecma_object_t *obj_p, /**< the object */ * descriptor */ bool is_throw) /**< flag that controls failure handling */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); - JERRY_ASSERT(property_name_p != NULL); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (property_name_p != NULL); const ecma_object_type_t type = ecma_get_object_type (obj_p); ecma_assert_object_type_is_valid (type); @@ -475,8 +475,8 @@ ecma_completion_value_t ecma_op_object_has_instance (ecma_object_t *obj_p, /**< the object */ ecma_value_t value) /**< argument 'V' */ { - JERRY_ASSERT(obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (obj_p != NULL + && !ecma_is_lexical_environment (obj_p)); const ecma_object_type_t type = ecma_get_object_type (obj_p); ecma_assert_object_type_is_valid (type); @@ -501,7 +501,7 @@ ecma_op_object_has_instance (ecma_object_t *obj_p, /**< the object */ } } - JERRY_UNREACHABLE(); + JERRY_UNREACHABLE (); } /* ecma_op_object_has_instance */ /** diff --git a/jerry-core/ecma/operations/ecma-reference.cpp b/jerry-core/ecma/operations/ecma-reference.cpp index edc7b87504..b72dcfdd39 100644 --- a/jerry-core/ecma/operations/ecma-reference.cpp +++ b/jerry-core/ecma/operations/ecma-reference.cpp @@ -40,7 +40,7 @@ ecma_object_t* ecma_op_resolve_reference_base (ecma_object_t *lex_env_p, /**< starting lexical environment */ ecma_string_t *name_p) /**< identifier's name */ { - JERRY_ASSERT(lex_env_p != NULL); + JERRY_ASSERT (lex_env_p != NULL); ecma_object_t *lex_env_iter_p = lex_env_p; @@ -68,7 +68,7 @@ ecma_op_get_identifier_reference (ecma_object_t *lex_env_p, /**< lexical environ ecma_string_t *name_p, /**< identifier's name */ bool is_strict) /**< strict reference flag */ { - JERRY_ASSERT(lex_env_p != NULL); + JERRY_ASSERT (lex_env_p != NULL); ecma_object_t *base_lex_env_p = ecma_op_resolve_reference_base (lex_env_p, name_p); diff --git a/jerry-core/ecma/operations/ecma-string-object.cpp b/jerry-core/ecma/operations/ecma-string-object.cpp index 408b635f24..740162246a 100644 --- a/jerry-core/ecma/operations/ecma-string-object.cpp +++ b/jerry-core/ecma/operations/ecma-string-object.cpp @@ -57,7 +57,7 @@ ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of } else { - ecma_completion_value_t to_str_arg_value = ecma_op_to_string (arguments_list_p [0]); + ecma_completion_value_t to_str_arg_value = ecma_op_to_string (arguments_list_p[0]); if (ecma_is_completion_value_throw (to_str_arg_value)) { @@ -187,7 +187,7 @@ ecma_op_string_object_get_own_property (ecma_object_t *obj_p, /**< the string ob ecma_char_t c = ecma_string_get_char_at_pos (prim_value_str_p, uint32_index); // 9. - ecma_char_t new_prop_zt_str_p [2] = { c, ECMA_CHAR_NULL }; + ecma_char_t new_prop_zt_str_p[2] = { c, ECMA_CHAR_NULL }; ecma_string_t *new_prop_str_value_p = ecma_new_ecma_string (new_prop_zt_str_p); new_prop_p = ecma_create_named_data_property (obj_p, diff --git a/jerry-core/ecma/operations/ecma-try-catch-macro.h b/jerry-core/ecma/operations/ecma-try-catch-macro.h index 5be485cdf7..de23d3e80e 100644 --- a/jerry-core/ecma/operations/ecma-try-catch-macro.h +++ b/jerry-core/ecma/operations/ecma-try-catch-macro.h @@ -39,7 +39,7 @@ } \ else \ { \ - JERRY_ASSERT(ecma_is_completion_value_normal (var ## _completion)); \ + JERRY_ASSERT (ecma_is_completion_value_normal (var ## _completion)); \ \ ecma_value_t var __attr_unused___ = ecma_get_completion_value_value (var ## _completion) diff --git a/jerry-core/jerry-api.h b/jerry-core/jerry-api.h index 86b197b2fc..1de4a9a1ad 100644 --- a/jerry-core/jerry-api.h +++ b/jerry-core/jerry-api.h @@ -97,7 +97,7 @@ typedef struct jerry_api_value_t typedef bool (*jerry_external_handler_t) (const jerry_api_object_t *function_obj_p, const jerry_api_value_t *this_p, jerry_api_value_t *ret_val_p, - const jerry_api_value_t args_p [], + const jerry_api_value_t args_p[], const uint16_t args_count); /** @@ -163,13 +163,13 @@ extern EXTERN_C bool jerry_api_call_function (jerry_api_object_t *function_object_p, jerry_api_object_t *this_arg_p, jerry_api_value_t *retval_p, - const jerry_api_value_t args_p [], + const jerry_api_value_t args_p[], uint16_t args_count); extern EXTERN_C bool jerry_api_construct_object (jerry_api_object_t *function_object_p, jerry_api_value_t *retval_p, - const jerry_api_value_t args_p [], + const jerry_api_value_t args_p[], uint16_t args_count); extern EXTERN_C diff --git a/jerry-core/jerry-extension.inc.h b/jerry-core/jerry-extension.inc.h index 2ea5b6cce9..fb47259488 100644 --- a/jerry-core/jerry-extension.inc.h +++ b/jerry-core/jerry-extension.inc.h @@ -36,7 +36,7 @@ enum }; /* Fields description */ -static const jerry_extension_field_t jerry_extension_fields [JERRY_EXTENSION_FIELDS_NUMBER + 1] = +static const jerry_extension_field_t jerry_extension_fields[JERRY_EXTENSION_FIELDS_NUMBER + 1] = { #define EXTENSION_FIELD(_field_name, _type, _value) \ { # _field_name, JERRY_API_DATA_TYPE_ ## _type, { _value } }, @@ -49,17 +49,17 @@ static const jerry_extension_field_t jerry_extension_fields [JERRY_EXTENSION_FIE /* Functions wrapper definitions */ #define EXTENSION_ARG_PASS_BOOL(_arg_index) \ - args_p [_arg_index].v_bool + args_p[_arg_index].v_bool #define EXTENSION_ARG_PASS_FLOAT32(_arg_index) \ - args_p [_arg_index].v_float32 + args_p[_arg_index].v_float32 #define EXTENSION_ARG_PASS_FLOAT64(_arg_index) \ - args_p [_arg_index].v_float64 + args_p[_arg_index].v_float64 #define EXTENSION_ARG_PASS_UINT32(_arg_index) \ - args_p [_arg_index].v_uint32 + args_p[_arg_index].v_uint32 #define EXTENSION_ARG_PASS_STRING(_arg_index) \ - args_p [_arg_index].v_string + args_p[_arg_index].v_string #define EXTENSION_ARG_PASS_OBJECT(_arg_index) \ - args_p [_arg_index].v_object + args_p[_arg_index].v_object #define EXTENSION_ARG(_arg_index, _type) EXTENSION_ARG_PASS_ ## _type(_arg_index) #define EXTENSION_RET_VALUE_SET_VOID #define EXTENSION_RET_VALUE_SET_BOOLEAN function_block_p->ret_value.v_bool = @@ -90,7 +90,7 @@ static const jerry_extension_field_t jerry_extension_fields [JERRY_EXTENSION_FIE { false } /* just for initialization, should be overwritten upon call */ \ } #define EXTENSION_FUNCTION(_function_name, _function_to_call, _ret_value_type, _args_number, ...) \ - static jerry_api_value_t jerry_extension_function_ ## _function_name ## _args [_args_number] = { \ + static jerry_api_value_t jerry_extension_function_ ## _function_name ## _args[_args_number] = { \ __VA_ARGS__ \ }; # include EXTENSION_DESCRIPTION_HEADER @@ -98,7 +98,7 @@ static const jerry_extension_field_t jerry_extension_fields [JERRY_EXTENSION_FIE #undef EXTENSION_ARG /* Functions description */ -static jerry_extension_function_t jerry_extension_functions [JERRY_EXTENSION_FUNCTIONS_NUMBER + 1] = +static jerry_extension_function_t jerry_extension_functions[JERRY_EXTENSION_FUNCTIONS_NUMBER + 1] = { #define EXTENSION_FUNCTION(_function_name, _function_to_call, _ret_value_type, _args_number, ...) \ { \ diff --git a/jerry-core/jerry-internal.h b/jerry-core/jerry-internal.h index 8567dfc2b8..348e3b4c25 100644 --- a/jerry-core/jerry-internal.h +++ b/jerry-core/jerry-internal.h @@ -27,7 +27,7 @@ extern ecma_completion_value_t jerry_dispatch_external_function (ecma_object_t *function_object_p, ecma_external_pointer_t handler_p, ecma_value_t this_arg_value, - const ecma_value_t args_p [], + const ecma_value_t args_p[], ecma_length_t args_count); extern void diff --git a/jerry-core/jerry.cpp b/jerry-core/jerry.cpp index ba6bc0f12a..9643014af0 100644 --- a/jerry-core/jerry.cpp +++ b/jerry-core/jerry.cpp @@ -68,7 +68,7 @@ static bool jerry_api_available; /** * Buffer of character data (used for exchange between core and extensions' routines) */ -char jerry_extension_characters_buffer [CONFIG_EXTENSION_CHAR_BUFFER_SIZE]; +char jerry_extension_characters_buffer[CONFIG_EXTENSION_CHAR_BUFFER_SIZE]; /** * Assert that it is correct to call API in current state. @@ -446,7 +446,7 @@ ecma_completion_value_t jerry_dispatch_external_function (ecma_object_t *function_object_p, /**< external function object */ ecma_external_pointer_t handler_p, /**< pointer to the function's native handler */ ecma_value_t this_arg_value, /**< 'this' argument */ - const ecma_value_t args_p [], /**< arguments list */ + const ecma_value_t args_p[], /**< arguments list */ ecma_length_t args_count) /**< number of arguments */ { jerry_assert_api_available (); @@ -459,7 +459,7 @@ jerry_dispatch_external_function (ecma_object_t *function_object_p, /**< externa for (uint32_t i = 0; i < args_count; ++i) { - jerry_api_convert_ecma_value_to_api_value (&api_arg_values [i], args_p [i]); + jerry_api_convert_ecma_value_to_api_value (&api_arg_values[i], args_p[i]); } jerry_api_value_t api_this_arg_value, api_ret_value; @@ -491,7 +491,7 @@ jerry_dispatch_external_function (ecma_object_t *function_object_p, /**< externa jerry_api_release_value (&api_this_arg_value); for (uint32_t i = 0; i < args_count; i++) { - jerry_api_release_value (&api_arg_values [i]); + jerry_api_release_value (&api_arg_values[i]); } MEM_FINALIZE_LOCAL_ARRAY (api_arg_values); @@ -814,8 +814,8 @@ jerry_api_invoke_function (bool is_invoke_as_constructor, /**< true - invoke fun * binding to the global object) */ jerry_api_value_t *retval_p, /**< pointer to place for function's return value * or NULL (to ignore the return value) */ - const jerry_api_value_t args_p [], /**< function's call arguments - * (NULL if arguments number is zero) */ + const jerry_api_value_t args_p[], /**< function's call arguments + * (NULL if arguments number is zero) */ uint16_t args_count) /**< number of the arguments */ { JERRY_ASSERT (args_count == 0 || args_p != NULL); @@ -827,7 +827,7 @@ jerry_api_invoke_function (bool is_invoke_as_constructor, /**< true - invoke fun for (uint32_t i = 0; i < args_count; ++i) { - jerry_api_convert_api_value_to_ecma_value (&arg_values [i], &args_p [i]); + jerry_api_convert_api_value_to_ecma_value (&arg_values[i], &args_p[i]); } ecma_completion_value_t call_completion; @@ -888,7 +888,7 @@ jerry_api_invoke_function (bool is_invoke_as_constructor, /**< true - invoke fun for (uint32_t i = 0; i < args_count; i++) { - ecma_free_value (arg_values [i], true); + ecma_free_value (arg_values[i], true); } MEM_FINALIZE_LOCAL_ARRAY (arg_values); @@ -914,8 +914,8 @@ jerry_api_call_function (jerry_api_object_t *function_object_p, /**< function ob * or NULL (set 'this' binding to the global object) */ jerry_api_value_t *retval_p, /**< pointer to place for function's return value * or NULL (to ignore the return value) */ - const jerry_api_value_t args_p [], /**< function's call arguments - * (NULL if arguments number is zero) */ + const jerry_api_value_t args_p[], /**< function's call arguments + * (NULL if arguments number is zero) */ uint16_t args_count) /**< number of the arguments */ { jerry_assert_api_available (); @@ -945,8 +945,8 @@ bool jerry_api_construct_object (jerry_api_object_t *function_object_p, /**< function object to call */ jerry_api_value_t *retval_p, /**< pointer to place for function's return value * or NULL (to ignore the return value) */ - const jerry_api_value_t args_p [], /**< function's call arguments - * (NULL if arguments number is zero) */ + const jerry_api_value_t args_p[], /**< function's call arguments + * (NULL if arguments number is zero) */ uint16_t args_count) /**< number of the arguments */ { jerry_assert_api_available (); diff --git a/jerry-core/mem/mem-allocator.cpp b/jerry-core/mem/mem-allocator.cpp index 8479b19940..1a79c9a858 100644 --- a/jerry-core/mem/mem-allocator.cpp +++ b/jerry-core/mem/mem-allocator.cpp @@ -98,16 +98,16 @@ mem_get_base_pointer (void) uintptr_t mem_compress_pointer (const void *pointer) /**< pointer to compress */ { - JERRY_ASSERT(pointer != NULL); + JERRY_ASSERT (pointer != NULL); uintptr_t int_ptr = (uintptr_t) pointer; - JERRY_ASSERT(int_ptr % MEM_ALIGNMENT == 0); + JERRY_ASSERT (int_ptr % MEM_ALIGNMENT == 0); int_ptr -= mem_get_base_pointer (); int_ptr >>= MEM_ALIGNMENT_LOG; - JERRY_ASSERT((int_ptr & ~((1u << MEM_HEAP_OFFSET_LOG) - 1)) == 0); + JERRY_ASSERT ((int_ptr & ~((1u << MEM_HEAP_OFFSET_LOG) - 1)) == 0); JERRY_ASSERT (int_ptr != MEM_CP_NULL); diff --git a/jerry-core/mem/mem-heap.cpp b/jerry-core/mem/mem-heap.cpp index 3d6d7b4e1d..747d74c960 100644 --- a/jerry-core/mem/mem-heap.cpp +++ b/jerry-core/mem/mem-heap.cpp @@ -317,7 +317,7 @@ mem_get_next_block_by_direction (const mem_block_header_t* block_p, /**< block * static size_t mem_get_block_chunks_count (const mem_block_header_t *block_header_p) /**< block header */ { - JERRY_ASSERT(block_header_p != NULL); + JERRY_ASSERT (block_header_p != NULL); const mem_block_header_t *next_block_p = mem_get_next_block_by_direction (block_header_p, MEM_DIRECTION_NEXT); size_t dist_till_block_end; @@ -331,8 +331,8 @@ mem_get_block_chunks_count (const mem_block_header_t *block_header_p) /**< block dist_till_block_end = (size_t) ((uint8_t*) next_block_p - (uint8_t*) block_header_p); } - JERRY_ASSERT(dist_till_block_end <= mem_heap.heap_size); - JERRY_ASSERT(dist_till_block_end % MEM_HEAP_CHUNK_SIZE == 0); + JERRY_ASSERT (dist_till_block_end <= mem_heap.heap_size); + JERRY_ASSERT (dist_till_block_end % MEM_HEAP_CHUNK_SIZE == 0); return dist_till_block_end / MEM_HEAP_CHUNK_SIZE; } /* mem_get_block_chunks_count */ @@ -356,7 +356,7 @@ mem_get_block_data_space_size (const mem_block_header_t *block_header_p) /**< bl static size_t mem_get_block_chunks_count_from_data_size (size_t block_allocated_size) /**< size of block's allocated area */ { - return JERRY_ALIGNUP(sizeof (mem_block_header_t) + block_allocated_size, MEM_HEAP_CHUNK_SIZE) / MEM_HEAP_CHUNK_SIZE; + return JERRY_ALIGNUP (sizeof (mem_block_header_t) + block_allocated_size, MEM_HEAP_CHUNK_SIZE) / MEM_HEAP_CHUNK_SIZE; } /* mem_get_block_chunks_count_from_data_size */ /** @@ -378,17 +378,17 @@ void mem_heap_init (uint8_t *heap_start, /**< first address of heap space */ size_t heap_size) /**< heap space size */ { - JERRY_ASSERT(heap_start != NULL); - JERRY_ASSERT(heap_size != 0); - JERRY_ASSERT(heap_size % MEM_HEAP_CHUNK_SIZE == 0); - JERRY_ASSERT((uintptr_t) heap_start % MEM_ALIGNMENT == 0); - JERRY_ASSERT(heap_size <= (1u << MEM_HEAP_OFFSET_LOG)); + JERRY_ASSERT (heap_start != NULL); + JERRY_ASSERT (heap_size != 0); + JERRY_ASSERT (heap_size % MEM_HEAP_CHUNK_SIZE == 0); + JERRY_ASSERT ((uintptr_t) heap_start % MEM_ALIGNMENT == 0); + JERRY_ASSERT (heap_size <= (1u << MEM_HEAP_OFFSET_LOG)); mem_heap.heap_start = heap_start; mem_heap.heap_size = heap_size; mem_heap.limit = CONFIG_MEM_HEAP_DESIRED_LIMIT; - VALGRIND_NOACCESS_SPACE(heap_start, heap_size); + VALGRIND_NOACCESS_SPACE (heap_start, heap_size); mem_init_block_header (mem_heap.heap_start, 0, @@ -408,12 +408,12 @@ mem_heap_init (uint8_t *heap_start, /**< first address of heap space */ void mem_heap_finalize (void) { - VALGRIND_DEFINED_SPACE(mem_heap.heap_start, mem_heap.heap_size); + VALGRIND_DEFINED_SPACE (mem_heap.heap_start, mem_heap.heap_size); - JERRY_ASSERT(mem_heap.first_block_p == mem_heap.last_block_p); + JERRY_ASSERT (mem_heap.first_block_p == mem_heap.last_block_p); JERRY_ASSERT (mem_is_block_free (mem_heap.first_block_p)); - VALGRIND_NOACCESS_SPACE(mem_heap.heap_start, mem_heap.heap_size); + VALGRIND_NOACCESS_SPACE (mem_heap.heap_start, mem_heap.heap_size); memset (&mem_heap, 0, sizeof (mem_heap)); } /* mem_heap_finalize */ @@ -430,13 +430,13 @@ mem_init_block_header (uint8_t *first_chunk_p, /**< address of the first { mem_block_header_t *block_header_p = (mem_block_header_t*) first_chunk_p; - VALGRIND_UNDEFINED_STRUCT(block_header_p); + VALGRIND_UNDEFINED_STRUCT (block_header_p); mem_set_block_prev (block_header_p, prev_block_p); mem_set_block_next (block_header_p, next_block_p); mem_set_block_allocated_bytes (block_header_p, allocated_bytes); - JERRY_ASSERT(allocated_bytes <= mem_get_block_data_space_size (block_header_p)); + JERRY_ASSERT (allocated_bytes <= mem_get_block_data_space_size (block_header_p)); if (block_state == MEM_BLOCK_FREE) { @@ -449,7 +449,7 @@ mem_init_block_header (uint8_t *first_chunk_p, /**< address of the first JERRY_ASSERT (!mem_is_block_free (block_header_p)); } - VALGRIND_NOACCESS_STRUCT(block_header_p); + VALGRIND_NOACCESS_STRUCT (block_header_p); } /* mem_init_block_header */ /** @@ -488,7 +488,7 @@ void* mem_heap_alloc_block_internal (size_t size_in_bytes, /**< size /* searching for appropriate block */ while (block_p != NULL) { - VALGRIND_DEFINED_STRUCT(block_p); + VALGRIND_DEFINED_STRUCT (block_p); if (mem_is_block_free (block_p)) { @@ -504,7 +504,7 @@ void* mem_heap_alloc_block_internal (size_t size_in_bytes, /**< size mem_block_header_t *next_block_p = mem_get_next_block_by_direction (block_p, direction); - VALGRIND_NOACCESS_STRUCT(block_p); + VALGRIND_NOACCESS_STRUCT (block_p); block_p = next_block_p; } @@ -531,7 +531,7 @@ void* mem_heap_alloc_block_internal (size_t size_in_bytes, /**< size size_t new_block_size_in_chunks = mem_get_block_chunks_count_from_data_size (size_in_bytes); size_t found_block_size_in_chunks = mem_get_block_chunks_count (block_p); - JERRY_ASSERT(new_block_size_in_chunks <= found_block_size_in_chunks); + JERRY_ASSERT (new_block_size_in_chunks <= found_block_size_in_chunks); mem_block_header_t *prev_block_p = mem_get_next_block_by_direction (block_p, MEM_DIRECTION_PREV); mem_block_header_t *next_block_p = mem_get_next_block_by_direction (block_p, MEM_DIRECTION_NEXT); @@ -546,11 +546,11 @@ void* mem_heap_alloc_block_internal (size_t size_in_bytes, /**< size uint8_t *block_end_p = (uint8_t*) block_p + found_block_size_in_chunks * MEM_HEAP_CHUNK_SIZE; block_p = (mem_block_header_t*) (block_end_p - new_block_size_in_chunks * MEM_HEAP_CHUNK_SIZE); - VALGRIND_DEFINED_STRUCT(prev_block_p); + VALGRIND_DEFINED_STRUCT (prev_block_p); mem_set_block_next (prev_block_p, block_p); - VALGRIND_NOACCESS_STRUCT(prev_block_p); + VALGRIND_NOACCESS_STRUCT (prev_block_p); if (next_block_p == NULL) { @@ -558,11 +558,11 @@ void* mem_heap_alloc_block_internal (size_t size_in_bytes, /**< size } else { - VALGRIND_DEFINED_STRUCT(next_block_p); + VALGRIND_DEFINED_STRUCT (next_block_p); mem_set_block_prev (next_block_p, block_p); - VALGRIND_NOACCESS_STRUCT(next_block_p); + VALGRIND_NOACCESS_STRUCT (next_block_p); } } else @@ -582,12 +582,12 @@ void* mem_heap_alloc_block_internal (size_t size_in_bytes, /**< size } else { - VALGRIND_DEFINED_STRUCT(next_block_p); + VALGRIND_DEFINED_STRUCT (next_block_p); mem_block_header_t* new_free_block_p = (mem_block_header_t*) new_free_block_first_chunk_p; mem_set_block_prev (next_block_p, new_free_block_p); - VALGRIND_NOACCESS_STRUCT(next_block_p); + VALGRIND_NOACCESS_STRUCT (next_block_p); } next_block_p = new_free_block_p; @@ -600,19 +600,19 @@ void* mem_heap_alloc_block_internal (size_t size_in_bytes, /**< size prev_block_p, next_block_p); - VALGRIND_DEFINED_STRUCT(block_p); + VALGRIND_DEFINED_STRUCT (block_p); MEM_HEAP_STAT_ALLOC_BLOCK (block_p); - JERRY_ASSERT(mem_get_block_data_space_size (block_p) >= size_in_bytes); + JERRY_ASSERT (mem_get_block_data_space_size (block_p) >= size_in_bytes); - VALGRIND_NOACCESS_STRUCT(block_p); + VALGRIND_NOACCESS_STRUCT (block_p); /* return data space beginning address */ uint8_t *data_space_p = (uint8_t*) (block_p + 1); - JERRY_ASSERT((uintptr_t) data_space_p % MEM_ALIGNMENT == 0); + JERRY_ASSERT ((uintptr_t) data_space_p % MEM_ALIGNMENT == 0); - VALGRIND_UNDEFINED_SPACE(data_space_p, size_in_bytes); + VALGRIND_UNDEFINED_SPACE (data_space_p, size_in_bytes); mem_check_heap (); @@ -683,14 +683,14 @@ mem_heap_free_block (void *ptr) /**< pointer to beginning of data space of the b uint8_t *uint8_ptr = (uint8_t*) ptr; /* checking that uint8_ptr points to the heap */ - JERRY_ASSERT(uint8_ptr >= mem_heap.heap_start - && uint8_ptr <= mem_heap.heap_start + mem_heap.heap_size); + JERRY_ASSERT (uint8_ptr >= mem_heap.heap_start + && uint8_ptr <= mem_heap.heap_start + mem_heap.heap_size); mem_check_heap (); mem_block_header_t *block_p = (mem_block_header_t*) uint8_ptr - 1; - VALGRIND_DEFINED_STRUCT(block_p); + VALGRIND_DEFINED_STRUCT (block_p); mem_block_header_t *prev_block_p = mem_get_next_block_by_direction (block_p, MEM_DIRECTION_PREV); mem_block_header_t *next_block_p = mem_get_next_block_by_direction (block_p, MEM_DIRECTION_NEXT); @@ -714,7 +714,7 @@ mem_heap_free_block (void *ptr) /**< pointer to beginning of data space of the b MEM_HEAP_STAT_FREE_BLOCK (block_p); - VALGRIND_NOACCESS_SPACE(uint8_ptr, block_p->allocated_bytes); + VALGRIND_NOACCESS_SPACE (uint8_ptr, block_p->allocated_bytes); JERRY_ASSERT (!mem_is_block_free (block_p)); @@ -723,7 +723,7 @@ mem_heap_free_block (void *ptr) /**< pointer to beginning of data space of the b if (next_block_p != NULL) { - VALGRIND_DEFINED_STRUCT(next_block_p); + VALGRIND_DEFINED_STRUCT (next_block_p); if (mem_is_block_free (next_block_p)) { @@ -732,11 +732,11 @@ mem_heap_free_block (void *ptr) /**< pointer to beginning of data space of the b mem_block_header_t *next_next_block_p = mem_get_next_block_by_direction (next_block_p, MEM_DIRECTION_NEXT); - VALGRIND_NOACCESS_STRUCT(next_block_p); + VALGRIND_NOACCESS_STRUCT (next_block_p); next_block_p = next_next_block_p; - VALGRIND_DEFINED_STRUCT(next_block_p); + VALGRIND_DEFINED_STRUCT (next_block_p); mem_set_block_next (block_p, next_block_p); if (next_block_p != NULL) @@ -749,12 +749,12 @@ mem_heap_free_block (void *ptr) /**< pointer to beginning of data space of the b } } - VALGRIND_NOACCESS_STRUCT(next_block_p); + VALGRIND_NOACCESS_STRUCT (next_block_p); } if (prev_block_p != NULL) { - VALGRIND_DEFINED_STRUCT(prev_block_p); + VALGRIND_DEFINED_STRUCT (prev_block_p); if (mem_is_block_free (prev_block_p)) { @@ -764,12 +764,12 @@ mem_heap_free_block (void *ptr) /**< pointer to beginning of data space of the b mem_set_block_next (prev_block_p, next_block_p); if (next_block_p != NULL) { - VALGRIND_DEFINED_STRUCT(next_block_p); + VALGRIND_DEFINED_STRUCT (next_block_p); mem_block_header_t* prev_block_p = mem_get_next_block_by_direction (block_p, MEM_DIRECTION_PREV); mem_set_block_prev (next_block_p, prev_block_p); - VALGRIND_NOACCESS_STRUCT(next_block_p); + VALGRIND_NOACCESS_STRUCT (next_block_p); } else { @@ -777,10 +777,10 @@ mem_heap_free_block (void *ptr) /**< pointer to beginning of data space of the b } } - VALGRIND_NOACCESS_STRUCT(prev_block_p); + VALGRIND_NOACCESS_STRUCT (prev_block_p); } - VALGRIND_NOACCESS_STRUCT(block_p); + VALGRIND_NOACCESS_STRUCT (block_p); mem_check_heap (); } /* mem_heap_free_block */ @@ -853,8 +853,8 @@ size_t __attr_pure___ mem_heap_recommend_allocation_size (size_t minimum_allocation_size) /**< minimum allocation size */ { size_t minimum_allocation_size_with_block_header = minimum_allocation_size + sizeof (mem_block_header_t); - size_t heap_chunk_aligned_allocation_size = JERRY_ALIGNUP(minimum_allocation_size_with_block_header, - MEM_HEAP_CHUNK_SIZE); + size_t heap_chunk_aligned_allocation_size = JERRY_ALIGNUP (minimum_allocation_size_with_block_header, + MEM_HEAP_CHUNK_SIZE); return heap_chunk_aligned_allocation_size - sizeof (mem_block_header_t); } /* mem_heap_recommend_allocation_size */ @@ -870,7 +870,7 @@ mem_heap_print (bool dump_block_headers, /**< print block headers */ { mem_check_heap (); - JERRY_ASSERT(!dump_block_data || dump_block_headers); + JERRY_ASSERT (!dump_block_data || dump_block_headers); if (dump_block_headers) { @@ -884,7 +884,7 @@ mem_heap_print (bool dump_block_headers, /**< print block headers */ block_p != NULL; block_p = next_block_p) { - VALGRIND_DEFINED_STRUCT(block_p); + VALGRIND_DEFINED_STRUCT (block_p); printf ("Block (%p): state=%s, size in chunks=%lu, previous block->%p next block->%p\n", (void*) block_p, @@ -907,7 +907,7 @@ mem_heap_print (bool dump_block_headers, /**< print block headers */ next_block_p = mem_get_next_block_by_direction (block_p, MEM_DIRECTION_NEXT); - VALGRIND_NOACCESS_STRUCT(block_p); + VALGRIND_NOACCESS_STRUCT (block_p); } } @@ -952,8 +952,8 @@ static void mem_check_heap (void) { #ifndef JERRY_NDEBUG - JERRY_ASSERT((uint8_t*) mem_heap.first_block_p == mem_heap.heap_start); - JERRY_ASSERT(mem_heap.heap_size % MEM_HEAP_CHUNK_SIZE == 0); + JERRY_ASSERT ((uint8_t*) mem_heap.first_block_p == mem_heap.heap_start); + JERRY_ASSERT (mem_heap.heap_size % MEM_HEAP_CHUNK_SIZE == 0); bool is_last_block_was_met = false; size_t chunk_sizes_sum = 0; @@ -963,7 +963,7 @@ mem_check_heap (void) block_p != NULL; block_p = next_block_p) { - VALGRIND_DEFINED_STRUCT(block_p); + VALGRIND_DEFINED_STRUCT (block_p); chunk_sizes_sum += mem_get_block_chunks_count (block_p); @@ -978,19 +978,19 @@ mem_check_heap (void) { is_last_block_was_met = true; - JERRY_ASSERT(next_block_p == NULL); + JERRY_ASSERT (next_block_p == NULL); } else { - JERRY_ASSERT(next_block_p != NULL); + JERRY_ASSERT (next_block_p != NULL); } - VALGRIND_NOACCESS_STRUCT(block_p); + VALGRIND_NOACCESS_STRUCT (block_p); } - JERRY_ASSERT(chunk_sizes_sum * MEM_HEAP_CHUNK_SIZE == mem_heap.heap_size); - JERRY_ASSERT(allocated_sum == mem_heap.allocated_bytes); - JERRY_ASSERT(is_last_block_was_met); + JERRY_ASSERT (chunk_sizes_sum * MEM_HEAP_CHUNK_SIZE == mem_heap.heap_size); + JERRY_ASSERT (allocated_sum == mem_heap.allocated_bytes); + JERRY_ASSERT (is_last_block_was_met); bool is_first_block_was_met = false; chunk_sizes_sum = 0; @@ -999,7 +999,7 @@ mem_check_heap (void) block_p != NULL; block_p = prev_block_p) { - VALGRIND_DEFINED_STRUCT(block_p); + VALGRIND_DEFINED_STRUCT (block_p); chunk_sizes_sum += mem_get_block_chunks_count (block_p); @@ -1009,18 +1009,18 @@ mem_check_heap (void) { is_first_block_was_met = true; - JERRY_ASSERT(prev_block_p == NULL); + JERRY_ASSERT (prev_block_p == NULL); } else { - JERRY_ASSERT(prev_block_p != NULL); + JERRY_ASSERT (prev_block_p != NULL); } - VALGRIND_NOACCESS_STRUCT(block_p); + VALGRIND_NOACCESS_STRUCT (block_p); } - JERRY_ASSERT(chunk_sizes_sum * MEM_HEAP_CHUNK_SIZE == mem_heap.heap_size); - JERRY_ASSERT(is_first_block_was_met); + JERRY_ASSERT (chunk_sizes_sum * MEM_HEAP_CHUNK_SIZE == mem_heap.heap_size); + JERRY_ASSERT (is_first_block_was_met); #endif /* !JERRY_NDEBUG */ } /* mem_check_heap */ @@ -1111,9 +1111,9 @@ mem_heap_stat_alloc_block (mem_block_header_t *block_header_p) /**< allocated bl mem_heap_stats.global_peak_waste_bytes = mem_heap_stats.waste_bytes; } - JERRY_ASSERT(mem_heap_stats.allocated_blocks <= mem_heap_stats.blocks); - JERRY_ASSERT(mem_heap_stats.allocated_bytes <= mem_heap_stats.size); - JERRY_ASSERT(mem_heap_stats.allocated_chunks <= mem_heap_stats.size / MEM_HEAP_CHUNK_SIZE); + JERRY_ASSERT (mem_heap_stats.allocated_blocks <= mem_heap_stats.blocks); + JERRY_ASSERT (mem_heap_stats.allocated_bytes <= mem_heap_stats.size); + JERRY_ASSERT (mem_heap_stats.allocated_chunks <= mem_heap_stats.size / MEM_HEAP_CHUNK_SIZE); } /* mem_heap_stat_alloc_block */ /** @@ -1128,14 +1128,14 @@ mem_heap_stat_free_block (mem_block_header_t *block_header_p) /**< block to be f const size_t bytes = block_header_p->allocated_bytes; const size_t waste_bytes = chunks * MEM_HEAP_CHUNK_SIZE - bytes; - JERRY_ASSERT(mem_heap_stats.allocated_blocks <= mem_heap_stats.blocks); - JERRY_ASSERT(mem_heap_stats.allocated_bytes <= mem_heap_stats.size); - JERRY_ASSERT(mem_heap_stats.allocated_chunks <= mem_heap_stats.size / MEM_HEAP_CHUNK_SIZE); + JERRY_ASSERT (mem_heap_stats.allocated_blocks <= mem_heap_stats.blocks); + JERRY_ASSERT (mem_heap_stats.allocated_bytes <= mem_heap_stats.size); + JERRY_ASSERT (mem_heap_stats.allocated_chunks <= mem_heap_stats.size / MEM_HEAP_CHUNK_SIZE); - JERRY_ASSERT(mem_heap_stats.allocated_blocks >= 1); - JERRY_ASSERT(mem_heap_stats.allocated_chunks >= chunks); - JERRY_ASSERT(mem_heap_stats.allocated_bytes >= bytes); - JERRY_ASSERT(mem_heap_stats.waste_bytes >= waste_bytes); + JERRY_ASSERT (mem_heap_stats.allocated_blocks >= 1); + JERRY_ASSERT (mem_heap_stats.allocated_chunks >= chunks); + JERRY_ASSERT (mem_heap_stats.allocated_bytes >= bytes); + JERRY_ASSERT (mem_heap_stats.waste_bytes >= waste_bytes); mem_heap_stats.allocated_blocks--; mem_heap_stats.allocated_chunks -= chunks; diff --git a/jerry-core/mem/mem-pool.cpp b/jerry-core/mem/mem-pool.cpp index 019e2121f9..cd7d500d62 100644 --- a/jerry-core/mem/mem-pool.cpp +++ b/jerry-core/mem/mem-pool.cpp @@ -65,8 +65,8 @@ mem_pool_is_chunk_inside (mem_pool_state_t *pool_p, /**< pool */ { if (chunk_p >= (uint8_t*) pool_p && chunk_p < (uint8_t*) pool_p + MEM_POOL_SIZE) { - JERRY_ASSERT (chunk_p >= MEM_POOL_SPACE_START(pool_p) - && chunk_p <= MEM_POOL_SPACE_START(pool_p) + MEM_POOL_CHUNKS_NUMBER * MEM_POOL_CHUNK_SIZE); + JERRY_ASSERT (chunk_p >= MEM_POOL_SPACE_START (pool_p) + && chunk_p <= MEM_POOL_SPACE_START (pool_p) + MEM_POOL_CHUNKS_NUMBER * MEM_POOL_CHUNK_SIZE); return true; } @@ -84,12 +84,12 @@ void mem_pool_init (mem_pool_state_t *pool_p, /**< pool */ size_t pool_size) /**< pool size */ { - JERRY_ASSERT(pool_p != NULL); - JERRY_ASSERT((size_t)MEM_POOL_SPACE_START(pool_p) % MEM_ALIGNMENT == 0); + JERRY_ASSERT (pool_p != NULL); + JERRY_ASSERT ((size_t)MEM_POOL_SPACE_START (pool_p) % MEM_ALIGNMENT == 0); - JERRY_STATIC_ASSERT(MEM_POOL_CHUNK_SIZE % MEM_ALIGNMENT == 0); - JERRY_STATIC_ASSERT(MEM_POOL_MAX_CHUNKS_NUMBER_LOG <= sizeof (mem_pool_chunk_index_t) * JERRY_BITSINBYTE); - JERRY_ASSERT(sizeof (mem_pool_chunk_index_t) <= MEM_POOL_CHUNK_SIZE); + JERRY_STATIC_ASSERT (MEM_POOL_CHUNK_SIZE % MEM_ALIGNMENT == 0); + JERRY_STATIC_ASSERT (MEM_POOL_MAX_CHUNKS_NUMBER_LOG <= sizeof (mem_pool_chunk_index_t) * JERRY_BITSINBYTE); + JERRY_ASSERT (sizeof (mem_pool_chunk_index_t) <= MEM_POOL_CHUNK_SIZE); JERRY_ASSERT (MEM_POOL_SIZE == sizeof (mem_pool_state_t) + MEM_POOL_CHUNKS_NUMBER * MEM_POOL_CHUNK_SIZE); JERRY_ASSERT (MEM_POOL_CHUNKS_NUMBER >= CONFIG_MEM_LEAST_CHUNK_NUMBER_IN_POOL); @@ -111,8 +111,8 @@ mem_pool_init (mem_pool_state_t *pool_p, /**< pool */ chunk_index < MEM_POOL_CHUNKS_NUMBER; chunk_index++) { - mem_pool_chunk_index_t *next_free_chunk_index_p = (mem_pool_chunk_index_t*) MEM_POOL_CHUNK_ADDRESS(pool_p, - chunk_index); + mem_pool_chunk_index_t *next_free_chunk_index_p = (mem_pool_chunk_index_t*) MEM_POOL_CHUNK_ADDRESS (pool_p, + chunk_index); *next_free_chunk_index_p = (mem_pool_chunk_index_t) (chunk_index + 1u); @@ -134,7 +134,7 @@ mem_pool_alloc_chunk (mem_pool_state_t *pool_p) /**< pool */ JERRY_ASSERT (pool_p->first_free_chunk < MEM_POOL_CHUNKS_NUMBER); mem_pool_chunk_index_t chunk_index = pool_p->first_free_chunk; - uint8_t *chunk_p = MEM_POOL_CHUNK_ADDRESS(pool_p, chunk_index); + uint8_t *chunk_p = MEM_POOL_CHUNK_ADDRESS (pool_p, chunk_index); VALGRIND_DEFINED_SPACE (chunk_p, MEM_POOL_CHUNK_SIZE); @@ -156,13 +156,13 @@ void mem_pool_free_chunk (mem_pool_state_t *pool_p, /**< pool */ uint8_t *chunk_p) /**< chunk pointer */ { - JERRY_ASSERT(pool_p->free_chunks_number < MEM_POOL_CHUNKS_NUMBER); - JERRY_ASSERT(mem_pool_is_chunk_inside (pool_p, chunk_p)); - JERRY_ASSERT(((uintptr_t) chunk_p - (uintptr_t) MEM_POOL_SPACE_START(pool_p)) % MEM_POOL_CHUNK_SIZE == 0); + JERRY_ASSERT (pool_p->free_chunks_number < MEM_POOL_CHUNKS_NUMBER); + JERRY_ASSERT (mem_pool_is_chunk_inside (pool_p, chunk_p)); + JERRY_ASSERT (((uintptr_t) chunk_p - (uintptr_t) MEM_POOL_SPACE_START (pool_p)) % MEM_POOL_CHUNK_SIZE == 0); mem_check_pool (pool_p); - const size_t chunk_byte_offset = (size_t) (chunk_p - MEM_POOL_SPACE_START(pool_p)); + const size_t chunk_byte_offset = (size_t) (chunk_p - MEM_POOL_SPACE_START (pool_p)); const mem_pool_chunk_index_t chunk_index = (mem_pool_chunk_index_t) (chunk_byte_offset / MEM_POOL_CHUNK_SIZE); mem_pool_chunk_index_t *next_free_chunk_index_p = (mem_pool_chunk_index_t*) chunk_p; @@ -184,14 +184,14 @@ static void mem_check_pool (mem_pool_state_t __attr_unused___ *pool_p) /**< pool (unused #ifdef JERRY_NDEBUG) */ { #ifndef JERRY_NDEBUG - JERRY_ASSERT(pool_p->free_chunks_number <= MEM_POOL_CHUNKS_NUMBER); + JERRY_ASSERT (pool_p->free_chunks_number <= MEM_POOL_CHUNKS_NUMBER); size_t met_free_chunks_number = 0; mem_pool_chunk_index_t chunk_index = pool_p->first_free_chunk; while (chunk_index != MEM_POOL_CHUNKS_NUMBER) { - uint8_t *chunk_p = MEM_POOL_CHUNK_ADDRESS(pool_p, chunk_index); + uint8_t *chunk_p = MEM_POOL_CHUNK_ADDRESS (pool_p, chunk_index); mem_pool_chunk_index_t *next_free_chunk_index_p = (mem_pool_chunk_index_t*) chunk_p; met_free_chunks_number++; @@ -203,7 +203,7 @@ mem_check_pool (mem_pool_state_t __attr_unused___ *pool_p) /**< pool (unused #if VALGRIND_NOACCESS_SPACE (next_free_chunk_index_p, MEM_POOL_CHUNK_SIZE); } - JERRY_ASSERT(met_free_chunks_number == pool_p->free_chunks_number); + JERRY_ASSERT (met_free_chunks_number == pool_p->free_chunks_number); #endif /* !JERRY_NDEBUG */ } /* mem_check_pool */ diff --git a/jerry-core/mem/mem-poolman.cpp b/jerry-core/mem/mem-poolman.cpp index 1d2b2069b7..24936fb9ec 100644 --- a/jerry-core/mem/mem-poolman.cpp +++ b/jerry-core/mem/mem-poolman.cpp @@ -86,8 +86,8 @@ mem_pools_init (void) void mem_pools_finalize (void) { - JERRY_ASSERT(mem_pools == NULL); - JERRY_ASSERT(mem_free_chunks_number == 0); + JERRY_ASSERT (mem_pools == NULL); + JERRY_ASSERT (mem_free_chunks_number == 0); } /* mem_pools_finalize */ /** @@ -234,7 +234,7 @@ mem_pools_free (uint8_t *chunk_p) /**< pointer to the chunk */ void mem_pools_get_stats (mem_pools_stats_t *out_pools_stats_p) /**< out: pools' stats */ { - JERRY_ASSERT(out_pools_stats_p != NULL); + JERRY_ASSERT (out_pools_stats_p != NULL); *out_pools_stats_p = mem_pools_stats; } /* mem_pools_get_stats */ @@ -283,7 +283,7 @@ mem_pools_stat_alloc_pool (void) static void mem_pools_stat_free_pool (void) { - JERRY_ASSERT(mem_pools_stats.pools_count > 0); + JERRY_ASSERT (mem_pools_stats.pools_count > 0); mem_pools_stats.pools_count--; mem_pools_stats.free_chunks = mem_free_chunks_number; @@ -295,7 +295,7 @@ mem_pools_stat_free_pool (void) static void mem_pools_stat_alloc_chunk (void) { - JERRY_ASSERT(mem_pools_stats.free_chunks > 0); + JERRY_ASSERT (mem_pools_stats.free_chunks > 0); mem_pools_stats.allocated_chunks++; mem_pools_stats.free_chunks--; @@ -316,7 +316,7 @@ mem_pools_stat_alloc_chunk (void) static void mem_pools_stat_free_chunk (void) { - JERRY_ASSERT(mem_pools_stats.allocated_chunks > 0); + JERRY_ASSERT (mem_pools_stats.allocated_chunks > 0); mem_pools_stats.allocated_chunks--; mem_pools_stats.free_chunks++; diff --git a/jerry-core/parser/collections/array-list.cpp b/jerry-core/parser/collections/array-list.cpp index 500bc3a6b9..f964aed6e7 100644 --- a/jerry-core/parser/collections/array-list.cpp +++ b/jerry-core/parser/collections/array-list.cpp @@ -22,8 +22,7 @@ typedef struct uint8_t element_size; size_t len; size_t size; -} -array_list_header; +} array_list_header; static array_list_header * extract_header (array_list al) diff --git a/jerry-core/parser/collections/hash-table.cpp b/jerry-core/parser/collections/hash-table.cpp index 61f90292e6..ac5abe6a3c 100644 --- a/jerry-core/parser/collections/hash-table.cpp +++ b/jerry-core/parser/collections/hash-table.cpp @@ -26,8 +26,7 @@ typedef struct uint8_t key_size; uint8_t value_size; mem_heap_alloc_term_t alloc_term; -} -hash_table_int; +} hash_table_int; static hash_table_int * extract_header (hash_table ht) diff --git a/jerry-core/parser/collections/linked-list.cpp b/jerry-core/parser/collections/linked-list.cpp index 96caef1c68..58193c1f4d 100644 --- a/jerry-core/parser/collections/linked-list.cpp +++ b/jerry-core/parser/collections/linked-list.cpp @@ -23,8 +23,7 @@ typedef struct linked_list_header { struct linked_list_header *next; uint16_t element_size; -} -linked_list_header; +} linked_list_header; #define ASSERT_LIST(list) \ do { \ diff --git a/jerry-core/parser/collections/lit-id-hash-table.h b/jerry-core/parser/collections/lit-id-hash-table.h index 73d268d819..2aa48569ad 100644 --- a/jerry-core/parser/collections/lit-id-hash-table.h +++ b/jerry-core/parser/collections/lit-id-hash-table.h @@ -25,8 +25,7 @@ typedef struct size_t current_bucket_pos; literal_index_t *raw_buckets; literal_index_t **buckets; -} -lit_id_hash_table; +} lit_id_hash_table; lit_id_hash_table *lit_id_hash_table_init (size_t, size_t); void lit_id_hash_table_free (lit_id_hash_table *); diff --git a/jerry-core/parser/collections/lp-string.h b/jerry-core/parser/collections/lp-string.h index b93c71b2ad..b5958d5ff1 100644 --- a/jerry-core/parser/collections/lp-string.h +++ b/jerry-core/parser/collections/lp-string.h @@ -24,8 +24,7 @@ typedef struct const ecma_char_t *str; ecma_length_t length; ecma_string_hash_t hash; -} -lp_string; +} lp_string; bool lp_string_equal (lp_string, lp_string); bool lp_string_equal_s (lp_string, const char *); diff --git a/jerry-core/parser/collections/stack.h b/jerry-core/parser/collections/stack.h index 0d175594b5..7cd14f5e82 100644 --- a/jerry-core/parser/collections/stack.h +++ b/jerry-core/parser/collections/stack.h @@ -37,30 +37,30 @@ max_temp_name, temp_names_global_size }; - STACK(temp_names, uint8_t, uint8_t) + STACK (temp_names, uint8_t, uint8_t) #define GLOBAL(NAME, VAR) \ STACK_ELEMENT (NAME, VAR) #define MAX_TEMP_NAME() \ - GLOBAL(temp_names, max_temp_name) + GLOBAL (temp_names, max_temp_name) #define MIN_TEMP_NAME() \ - GLOBAL(temp_names, min_temp_name) + GLOBAL (temp_names, min_temp_name) #define TEMP_NAME() \ - GLOBAL(temp_names, temp_name) + GLOBAL (temp_names, temp_name) void parser_init (void) { - STACK_INIT(temp_names) + STACK_INIT (temp_names) } void parser_free (void) { - STACK_FREE(temp_names) + STACK_FREE (temp_names) } */ #ifndef STACK_H @@ -124,8 +124,7 @@ static TYPE *convert_##NAME##_to_raw_data (void) { \ { \ return NULL; \ } \ - size_t size = mem_heap_recommend_allocation_size ( \ - array_list_len (NAME.data) * sizeof (NAME##_stack_value_type)); \ + size_t size = mem_heap_recommend_allocation_size (array_list_len (NAME.data) * sizeof (NAME##_stack_value_type)); \ TYPE *DATA = (TYPE *) mem_heap_alloc_block (size, MEM_HEAP_ALLOC_LONG_TERM); \ if (DATA == NULL) \ { \ @@ -164,9 +163,9 @@ STACK_HEAD (NAME, 1) #define STACK_SWAP(NAME) \ do { \ - NAME##_stack_value_type temp = STACK_TOP(NAME); \ - STACK_SET_HEAD(NAME, 1, STACK_HEAD(NAME, 2)); \ - STACK_SET_HEAD(NAME, 2, temp); \ + NAME##_stack_value_type temp = STACK_TOP (NAME); \ + STACK_SET_HEAD (NAME, 1, STACK_HEAD (NAME, 2)); \ + STACK_SET_HEAD (NAME, 2, temp); \ } while (0) #define STACK_SIZE(NAME) \ @@ -182,10 +181,10 @@ do { set_##NAME##_stack_element ((size_t) I, VALUE); } while (0) do { DATA = convert_##NAME##_to_raw_data (); } while (0) #define STACK_INCR_ELEMENT(NAME, I) \ -do { STACK_SET_ELEMENT (NAME, I, (NAME##_stack_value_type) (STACK_ELEMENT(NAME, I) + 1)); } while (0) +do { STACK_SET_ELEMENT (NAME, I, (NAME##_stack_value_type) (STACK_ELEMENT (NAME, I) + 1)); } while (0) #define STACK_DECR_ELEMENT(NAME, I) \ -do { STACK_SET_ELEMENT (NAME, I, (NAME##_stack_value_type) (STACK_ELEMENT(NAME, I) - 1)); } while (0) +do { STACK_SET_ELEMENT (NAME, I, (NAME##_stack_value_type) (STACK_ELEMENT (NAME, I) - 1)); } while (0) #define STACK_ITERATE(NAME, VAL, FROM) \ for (size_t NAME##_i = FROM; \ @@ -203,24 +202,24 @@ do { for (size_t i = FROM; i < array_list_len (NAME.data); i++) { \ } } while (0) #define STACK(NAME, TYPE) \ -DEFINE_STACK_TYPE(NAME, TYPE) \ +DEFINE_STACK_TYPE (NAME, TYPE) \ NAME##_stack NAME; \ -DEFINE_STACK_ELEMENT(NAME, TYPE) \ -DEFINE_SET_STACK_ELEMENT(NAME, TYPE) \ -DEFINE_STACK_HEAD(NAME, TYPE) \ -DEFINE_CONVERT_TO_RAW_DATA(NAME, TYPE) \ -DEFINE_SET_STACK_HEAD(NAME, TYPE) \ -DEFINE_STACK_PUSH(NAME, TYPE) +DEFINE_STACK_ELEMENT (NAME, TYPE) \ +DEFINE_SET_STACK_ELEMENT (NAME, TYPE) \ +DEFINE_STACK_HEAD (NAME, TYPE) \ +DEFINE_CONVERT_TO_RAW_DATA (NAME, TYPE) \ +DEFINE_SET_STACK_HEAD (NAME, TYPE) \ +DEFINE_STACK_PUSH (NAME, TYPE) #define STATIC_STACK(NAME, TYPE) \ -DEFINE_STACK_TYPE(NAME, TYPE) \ +DEFINE_STACK_TYPE (NAME, TYPE) \ static NAME##_stack NAME; \ -DEFINE_STACK_ELEMENT(NAME, TYPE) \ -DEFINE_SET_STACK_ELEMENT(NAME, TYPE) \ -DEFINE_STACK_HEAD(NAME, TYPE) \ -DEFINE_CONVERT_TO_RAW_DATA(NAME, TYPE) \ -DEFINE_SET_STACK_HEAD(NAME, TYPE) \ -DEFINE_STACK_PUSH(NAME, TYPE) +DEFINE_STACK_ELEMENT (NAME, TYPE) \ +DEFINE_SET_STACK_ELEMENT (NAME, TYPE) \ +DEFINE_STACK_HEAD (NAME, TYPE) \ +DEFINE_CONVERT_TO_RAW_DATA (NAME, TYPE) \ +DEFINE_SET_STACK_HEAD (NAME, TYPE) \ +DEFINE_STACK_PUSH (NAME, TYPE) #ifndef JERRY_NDEBUG #define STACK_DECLARE_USAGE(NAME) \ diff --git a/jerry-core/parser/js/lexer.h b/jerry-core/parser/js/lexer.h index b9b0f5345f..d987aef6fb 100644 --- a/jerry-core/parser/js/lexer.h +++ b/jerry-core/parser/js/lexer.h @@ -76,8 +76,7 @@ typedef enum __attr_packed___ KW_WHILE, KW_WITH, KW_YIELD -} -keyword; +} keyword; /* Type of tokens. */ @@ -152,8 +151,7 @@ typedef enum __attr_packed___ TOK_DIV, // / TOK_DIV_EQ, // /= TOK_EMPTY, -} -token_type; +} token_type; typedef size_t locus; @@ -163,8 +161,7 @@ typedef struct locus loc; token_type type; literal_index_t uid; -} -token; +} token; void lexer_init (const char *, size_t, bool); void lexer_free (void); diff --git a/jerry-core/parser/js/literal.h b/jerry-core/parser/js/literal.h index f8ace2bebf..6678d71076 100644 --- a/jerry-core/parser/js/literal.h +++ b/jerry-core/parser/js/literal.h @@ -25,8 +25,7 @@ typedef enum __attr_packed___ LIT_STR, LIT_MAGIC_STR, LIT_NUMBER -} -literal_type; +} literal_type; typedef struct { @@ -36,11 +35,9 @@ typedef struct ecma_number_t num; lp_string lp; void *none; - } - data; + } data; literal_type type; -} -literal; +} literal; #define LITERAL_TO_REWRITE (INVALID_VALUE - 1) diff --git a/jerry-core/parser/js/opcodes-dumper.cpp b/jerry-core/parser/js/opcodes-dumper.cpp index b8c0e629ed..e2ea1b0cb5 100644 --- a/jerry-core/parser/js/opcodes-dumper.cpp +++ b/jerry-core/parser/js/opcodes-dumper.cpp @@ -2173,7 +2173,7 @@ rewrite_breaks (void) break_op_meta.op.data.jmp_down.opcode_2 = id2; serializer_rewrite_op_meta (break_oc, break_op_meta); } - STACK_ITERATE_END(); + STACK_ITERATE_END (); STACK_DROP (break_targets, 1); STACK_DROP (breaks, STACK_SIZE (breaks) - STACK_TOP (U8)); @@ -2195,7 +2195,7 @@ rewrite_continues (void) continue_op_meta.op.data.jmp_down.opcode_2 = id2; serializer_rewrite_op_meta (continue_oc, continue_op_meta); } - STACK_ITERATE_END(); + STACK_ITERATE_END (); STACK_DROP (continue_targets, 1); STACK_DROP (continues, STACK_SIZE (continues) - STACK_TOP (U8)); diff --git a/jerry-core/parser/js/opcodes-dumper.h b/jerry-core/parser/js/opcodes-dumper.h index 4789e804c9..ef6165ebf3 100644 --- a/jerry-core/parser/js/opcodes-dumper.h +++ b/jerry-core/parser/js/opcodes-dumper.h @@ -24,8 +24,7 @@ typedef enum __attr_packed___ { OPERAND_LITERAL, OPERAND_TMP -} -operand_type; +} operand_type; typedef struct { @@ -34,10 +33,8 @@ typedef struct { idx_t uid; literal_index_t lit_id; - } - data; -} -operand; + } data; +} operand; typedef enum __attr_packed___ { @@ -47,8 +44,7 @@ typedef enum __attr_packed___ VARG_OBJ_DECL, VARG_CONSTRUCT_EXPR, VARG_CALL_EXPR -} -varg_list_type; +} varg_list_type; operand empty_operand (void); operand literal_operand (literal_index_t); diff --git a/jerry-core/parser/js/parser.cpp b/jerry-core/parser/js/parser.cpp index 2a9cf0f533..ab14fb37a2 100644 --- a/jerry-core/parser/js/parser.cpp +++ b/jerry-core/parser/js/parser.cpp @@ -86,7 +86,7 @@ static void must_be_inside_but_not_in (uint8_t not_in, uint8_t insides_count, ...) { va_list insides_list; - if (STACK_SIZE(nestings) == 0) + if (STACK_SIZE (nestings) == 0) { EMIT_ERROR ("Shall be inside a nesting"); } @@ -111,7 +111,7 @@ must_be_inside_but_not_in (uint8_t not_in, uint8_t insides_count, ...) } if (STACK_ELEMENT (nestings, i - 1) == not_in) { - EMIT_ERROR_VARG ("Shall not be inside a '%s' nesting", NESTING_TO_STRING(not_in)); + EMIT_ERROR_VARG ("Shall not be inside a '%s' nesting", NESTING_TO_STRING (not_in)); } } EMIT_ERROR ("Shall be inside a nesting"); diff --git a/jerry-core/parser/js/scopes-tree.h b/jerry-core/parser/js/scopes-tree.h index 350765fd0a..48b44720c6 100644 --- a/jerry-core/parser/js/scopes-tree.h +++ b/jerry-core/parser/js/scopes-tree.h @@ -29,16 +29,14 @@ typedef struct { literal_index_t lit_id[3]; opcode_t op; -} -op_meta; +} op_meta; typedef struct tree_header { struct tree_header *parent; linked_list children; uint8_t children_num; -} -tree_header; +} tree_header; typedef struct { @@ -46,8 +44,7 @@ typedef struct linked_list opcodes; opcode_counter_t opcodes_num; unsigned strict_mode:1; -} -scopes_tree_int; +} scopes_tree_int; typedef scopes_tree_int * scopes_tree; diff --git a/jerry-core/parser/js/serializer.cpp b/jerry-core/parser/js/serializer.cpp index b6eec71a52..e6d47d2a66 100644 --- a/jerry-core/parser/js/serializer.cpp +++ b/jerry-core/parser/js/serializer.cpp @@ -170,7 +170,7 @@ serializer_print_opcodes (void) opm.op = bytecode_data.opcodes[loc]; for (int i = 0; i < 3; i++) { - opm.lit_id [i] = NOT_A_LITERAL; + opm.lit_id[i] = NOT_A_LITERAL; } pp_op_meta (loc, opm, false); diff --git a/jerry-core/parser/js/syntax-errors.cpp b/jerry-core/parser/js/syntax-errors.cpp index 82a0c344df..e469af9be1 100644 --- a/jerry-core/parser/js/syntax-errors.cpp +++ b/jerry-core/parser/js/syntax-errors.cpp @@ -24,8 +24,7 @@ typedef struct { prop_type type; literal lit; -} -prop_literal; +} prop_literal; enum { diff --git a/jerry-core/parser/js/syntax-errors.h b/jerry-core/parser/js/syntax-errors.h index bf82ddd00e..5259931d6a 100644 --- a/jerry-core/parser/js/syntax-errors.h +++ b/jerry-core/parser/js/syntax-errors.h @@ -85,8 +85,7 @@ typedef enum __attr_packed___ PROP_SET, PROP_GET, VARG -} -prop_type; +} prop_type; void syntax_init (void); void syntax_free (void); diff --git a/jerry-core/vm/opcodes-varg.cpp b/jerry-core/vm/opcodes-varg.cpp index dcaee0cea9..92cbd01e53 100644 --- a/jerry-core/vm/opcodes-varg.cpp +++ b/jerry-core/vm/opcodes-varg.cpp @@ -99,7 +99,7 @@ fill_params_list (int_data_t *int_data, /**< interpreter context */ const literal_index_t param_name_lit_idx = serializer_get_literal_id_by_uid (next_opcode.data.meta.data_1, int_data->pos); - params_names [param_index] = ecma_new_ecma_string_from_lit_index (param_name_lit_idx); + params_names[param_index] = ecma_new_ecma_string_from_lit_index (param_name_lit_idx); int_data->pos++; } diff --git a/jerry-core/vm/opcodes.h b/jerry-core/vm/opcodes.h index d260cc863f..d29ed832aa 100644 --- a/jerry-core/vm/opcodes.h +++ b/jerry-core/vm/opcodes.h @@ -279,7 +279,6 @@ OP_ARGS_LIST (GETOP_DECL) typedef struct { uint8_t uids[4]; -} -raw_opcode; +} raw_opcode; #endif /* OPCODES_H */ diff --git a/jerry-core/vm/pretty-printer.cpp b/jerry-core/vm/pretty-printer.cpp index d83ece4573..229afbb096 100644 --- a/jerry-core/vm/pretty-printer.cpp +++ b/jerry-core/vm/pretty-printer.cpp @@ -203,7 +203,7 @@ pp_printf (const char *format, opcode_t opcode, literal_index_t lit_ids[], opcod } #define PP_OP(op_name, format) \ - case NAME_TO_ID(op_name): pp_printf (format, opm.op, opm.lit_id, oc); break; + case NAME_TO_ID (op_name): pp_printf (format, opm.op, opm.lit_id, oc); break; #define VAR(i) var_to_str (opm.op, opm.lit_id, oc, i) #define OC(i, j) __extension__({ raw_opcode* raw = (raw_opcode *) &opm.op; \ calc_opcode_counter_from_idx_idx (raw->uids[i], raw->uids[j]); }) diff --git a/jerry-core/vm/vm.cpp b/jerry-core/vm/vm.cpp index 4cf9b073db..a7e195f7ee 100644 --- a/jerry-core/vm/vm.cpp +++ b/jerry-core/vm/vm.cpp @@ -119,8 +119,8 @@ interp_mem_stats_context_enter (int_data_t *int_data_p, char indent_prefix[INTERP_MEM_PRINT_INDENTATION_MAX + 2]; memset (indent_prefix, ' ', sizeof (indent_prefix)); - indent_prefix [indentation] = '|'; - indent_prefix [indentation + 1] = '\0'; + indent_prefix[indentation] = '|'; + indent_prefix[indentation + 1] = '\0'; int_data_p->context_peak_allocated_heap_bytes = 0; int_data_p->context_peak_waste_heap_bytes = 0; @@ -157,8 +157,8 @@ interp_mem_stats_context_exit (int_data_t *int_data_p, char indent_prefix[INTERP_MEM_PRINT_INDENTATION_MAX + 2]; memset (indent_prefix, ' ', sizeof (indent_prefix)); - indent_prefix [indentation] = '|'; - indent_prefix [indentation + 1] = '\0'; + indent_prefix[indentation] = '|'; + indent_prefix[indentation + 1] = '\0'; mem_heap_stats_t heap_stats_context_exit; mem_pools_stats_t pools_stats_context_exit; @@ -228,8 +228,8 @@ interp_mem_stats_opcode_enter (opcode_counter_t opcode_position, char indent_prefix[INTERP_MEM_PRINT_INDENTATION_MAX + 2]; memset (indent_prefix, ' ', sizeof (indent_prefix)); - indent_prefix [indentation] = '|'; - indent_prefix [indentation + 1] = '\0'; + indent_prefix[indentation] = '|'; + indent_prefix[indentation + 1] = '\0'; interp_mem_get_stats (out_heap_stats_p, out_pools_stats_p, @@ -238,7 +238,7 @@ interp_mem_stats_opcode_enter (opcode_counter_t opcode_position, opcode_t opcode = read_opcode (opcode_position); printf ("%s-- Opcode: %s (position %u) --\n", - indent_prefix, __op_names [opcode.op_idx], (uint32_t) opcode_position); + indent_prefix, __op_names[opcode.op_idx], (uint32_t) opcode_position); interp_mem_stats_print_indentation += INTERP_MEM_PRINT_INDENTATION_STEP; } @@ -261,8 +261,8 @@ interp_mem_stats_opcode_exit (int_data_t *int_data_p, char indent_prefix[INTERP_MEM_PRINT_INDENTATION_MAX + 2]; memset (indent_prefix, ' ', sizeof (indent_prefix)); - indent_prefix [indentation] = '|'; - indent_prefix [indentation + 1] = '\0'; + indent_prefix[indentation] = '|'; + indent_prefix[indentation + 1] = '\0'; mem_heap_stats_t heap_stats_after; mem_pools_stats_t pools_stats_after; @@ -328,7 +328,7 @@ interp_mem_stats_opcode_exit (int_data_t *int_data_p, } printf ("%s-- End of execution of opcode %s (position %u) --\n\n", - indent_prefix, __op_names [opcode.op_idx], opcode_position); + indent_prefix, __op_names[opcode.op_idx], opcode_position); } #endif /* MEM_STATS */ diff --git a/jerry-libc/jerry-libc-printf.c b/jerry-libc/jerry-libc-printf.c index 8cce984885..ded15247e6 100644 --- a/jerry-libc/jerry-libc-printf.c +++ b/jerry-libc/jerry-libc-printf.c @@ -131,14 +131,14 @@ libc_printf_uint_to_string (uintmax_t value, /**< integer value */ char *str_p = str_buffer_end; *--str_p = '\0'; - LIBC_ASSERT(radix >= 2); + LIBC_ASSERT (radix >= 2); if ((radix & (radix - 1)) != 0) { /* * Radix is not power of 2. Only 32-bit numbers are supported in this mode. */ - LIBC_ASSERT((value >> 32) == 0); + LIBC_ASSERT ((value >> 32) == 0); uint32_t value_lo = (uint32_t) value; @@ -157,7 +157,7 @@ libc_printf_uint_to_string (uintmax_t value, /**< integer value */ { shift++; - LIBC_ASSERT(shift <= 32); + LIBC_ASSERT (shift <= 32); } uint32_t value_lo = (uint32_t) value; @@ -180,7 +180,7 @@ libc_printf_uint_to_string (uintmax_t value, /**< integer value */ *--str_p = '0'; } - LIBC_ASSERT(str_p >= buffer_p && str_p < str_buffer_end); + LIBC_ASSERT (str_p >= buffer_p && str_p < str_buffer_end); return str_p; } /* libc_printf_uint_to_string */ @@ -197,7 +197,7 @@ libc_printf_write_d_i (FILE *stream, /**< stream pointer */ libc_printf_arg_length_type_t length, /**< field's length type */ uint32_t width) /**< minimum field width to output */ { - LIBC_ASSERT((flags & LIBC_PRINTF_ARG_FLAG_SHARP) == 0); + LIBC_ASSERT ((flags & LIBC_PRINTF_ARG_FLAG_SHARP) == 0); bool is_signed = true; uintmax_t value = 0; @@ -261,7 +261,7 @@ libc_printf_write_d_i (FILE *stream, /**< stream pointer */ case LIBC_PRINTF_ARG_LENGTH_TYPE_HIGHL: { - LIBC_UNREACHABLE(); + LIBC_UNREACHABLE (); } } @@ -312,12 +312,12 @@ libc_printf_write_d_i (FILE *stream, /**< stream pointer */ * @return updated va_list */ static void -libc_printf_write_u_o_x_X(FILE *stream, /**< stream pointer */ - char specifier, /**< specifier (u, o, x, X) */ - va_list* args_list_p, /**< args' list */ - libc_printf_arg_flags_mask_t flags, /**< field's flags */ - libc_printf_arg_length_type_t length, /**< field's length type */ - uint32_t width) /**< minimum field width to output */ +libc_printf_write_u_o_x_X (FILE *stream, /**< stream pointer */ + char specifier, /**< specifier (u, o, x, X) */ + va_list* args_list_p, /**< args' list */ + libc_printf_arg_flags_mask_t flags, /**< field's flags */ + libc_printf_arg_length_type_t length, /**< field's length type */ + uint32_t width) /**< minimum field width to output */ { uintmax_t value = 0; @@ -373,7 +373,7 @@ libc_printf_write_u_o_x_X(FILE *stream, /**< stream pointer */ case LIBC_PRINTF_ARG_LENGTH_TYPE_HIGHL: { - LIBC_UNREACHABLE(); + LIBC_UNREACHABLE (); } } @@ -393,7 +393,7 @@ libc_printf_write_u_o_x_X(FILE *stream, /**< stream pointer */ } else { - LIBC_ASSERT(specifier == 'o'); + LIBC_ASSERT (specifier == 'o'); } } } @@ -433,7 +433,7 @@ libc_printf_write_u_o_x_X(FILE *stream, /**< stream pointer */ default: { - LIBC_UNREACHABLE(); + LIBC_UNREACHABLE (); } } @@ -627,7 +627,7 @@ vfprintf (FILE *stream, /**< stream pointer */ case 'x': case 'X': { - libc_printf_write_u_o_x_X(stream, *format_iter_p, &args_copy, flags, length, width); + libc_printf_write_u_o_x_X (stream, *format_iter_p, &args_copy, flags, length, width); break; } @@ -702,12 +702,12 @@ vfprintf (FILE *stream, /**< stream pointer */ } else { - libc_printf_write_u_o_x_X(stream, - 'x', - &args_copy, - flags | LIBC_PRINTF_ARG_FLAG_SHARP, - LIBC_PRINTF_ARG_LENGTH_TYPE_Z, - width); + libc_printf_write_u_o_x_X (stream, + 'x', + &args_copy, + flags | LIBC_PRINTF_ARG_FLAG_SHARP, + LIBC_PRINTF_ARG_LENGTH_TYPE_Z, + width); } break; } diff --git a/jerry-libc/jerry-libc.c b/jerry-libc/jerry-libc.c index 6fdafad950..bac7185860 100644 --- a/jerry-libc/jerry-libc.c +++ b/jerry-libc/jerry-libc.c @@ -31,7 +31,7 @@ FILE *stdin = (FILE*) 0; FILE *stdout = (FILE*) 1; FILE *stderr = (FILE*) 2; -LIBC_UNREACHABLE_STUB_FOR(void abort (void)) +LIBC_UNREACHABLE_STUB_FOR (void abort (void)) #ifdef __GNUC__ /* @@ -42,10 +42,10 @@ LIBC_UNREACHABLE_STUB_FOR(void abort (void)) */ #define CALL_PRAGMA(x) _Pragma (#x) -CALL_PRAGMA(GCC diagnostic push) -CALL_PRAGMA(GCC diagnostic ignored "-Wpragmas") -CALL_PRAGMA(GCC push_options) -CALL_PRAGMA(GCC optimize ("-fno-tree-loop-distribute-patterns")) +CALL_PRAGMA (GCC diagnostic push) +CALL_PRAGMA (GCC diagnostic ignored "-Wpragmas") +CALL_PRAGMA (GCC push_options) +CALL_PRAGMA (GCC optimize ("-fno-tree-loop-distribute-patterns")) #endif /* __GNUC__ */ /** @@ -146,8 +146,8 @@ memmove (void *s1, /**< destination */ } /* memmove */ #ifdef __GNUC__ -CALL_PRAGMA(GCC pop_options) -CALL_PRAGMA(GCC diagnostic pop) +CALL_PRAGMA (GCC pop_options) +CALL_PRAGMA (GCC diagnostic pop) #endif /* __GNUC__ */ /** Compare two strings. return an integer less than, equal to, or greater than zero diff --git a/jerry-libc/target/linux/jerry-libc-target.c b/jerry-libc/target/linux/jerry-libc-target.c index 3a0db31f7b..7de754a5cf 100644 --- a/jerry-libc/target/linux/jerry-libc-target.c +++ b/jerry-libc/target/linux/jerry-libc-target.c @@ -40,7 +40,7 @@ #endif /* !__TARGET_HOST_x64 && !__TARGET_HOST_x86 && !__TARGET_HOST_ARMv7 */ #include "jerry-libc-defs.h" -LIBC_UNREACHABLE_STUB_FOR(int raise (int sig_no __attr_unused___)) +LIBC_UNREACHABLE_STUB_FOR (int raise (int sig_no __attr_unused___)) /** * Exit program with ERR_SYSCALL if syscall_ret_val is negative @@ -70,7 +70,7 @@ syscall_1 (long int syscall_no, /**< syscall number */ { long int ret = syscall_1_asm (syscall_no, arg1); - LIBC_EXIT_ON_ERROR(ret); + LIBC_EXIT_ON_ERROR (ret); return ret; } /* syscall_1 */ @@ -87,7 +87,7 @@ syscall_2 (long int syscall_no, /**< syscall number */ { long int ret = syscall_2_asm (syscall_no, arg1, arg2); - LIBC_EXIT_ON_ERROR(ret); + LIBC_EXIT_ON_ERROR (ret); return ret; } /* syscall_2 */ @@ -105,7 +105,7 @@ syscall_3 (long int syscall_no, /**< syscall number */ { long int ret = syscall_3_asm (syscall_no, arg1, arg2, arg3); - LIBC_EXIT_ON_ERROR(ret); + LIBC_EXIT_ON_ERROR (ret); return ret; } /* syscall_3 */ @@ -169,8 +169,8 @@ fopen (const char *path, /**< file path */ bool create_if_not_exist = false; bool position_at_end = false; - LIBC_ASSERT(path != NULL && mode != NULL); - LIBC_ASSERT(mode[1] == '+' || mode[1] == '\0'); + LIBC_ASSERT (path != NULL && mode != NULL); + LIBC_ASSERT (mode[1] == '+' || mode[1] == '\0'); switch (mode[0]) { @@ -196,13 +196,13 @@ fopen (const char *path, /**< file path */ if (mode[1] == '+') { /* Not supported */ - LIBC_UNREACHABLE(); + LIBC_UNREACHABLE (); } break; } default: { - LIBC_UNREACHABLE(); + LIBC_UNREACHABLE (); } } @@ -218,7 +218,7 @@ fopen (const char *path, /**< file path */ } else { - LIBC_ASSERT(may_read && may_write); + LIBC_ASSERT (may_read && may_write); flags = O_RDWR; } diff --git a/main-mcu.cpp b/main-mcu.cpp index a1478681e0..1057ec71d6 100644 --- a/main-mcu.cpp +++ b/main-mcu.cpp @@ -22,7 +22,7 @@ #define JERRY_STANDALONE_EXIT_CODE_FAIL (1) #include JERRY_MCU_SCRIPT_HEADER -static const char generated_source [] = JERRY_MCU_SCRIPT; +static const char generated_source[] = JERRY_MCU_SCRIPT; int main (void) diff --git a/plugins/io/init.cpp b/plugins/io/init.cpp index 4322e460a7..de44142580 100644 --- a/plugins/io/init.cpp +++ b/plugins/io/init.cpp @@ -48,7 +48,7 @@ plugin_io_print_uint32 (uint32_t num) /**< uint32 to print */ static void plugin_io_print_string (jerry_api_string_t *string_p) /**< string to print */ { - char buffer [32]; + char buffer[32]; ssize_t req_size = jerry_api_string_to_char_buffer (string_p, buffer, (ssize_t) sizeof (buffer)); diff --git a/plugins/lib-device-stm/actuators.cpp b/plugins/lib-device-stm/actuators.cpp index 4a8e75e05c..bf3b5c120e 100644 --- a/plugins/lib-device-stm/actuators.cpp +++ b/plugins/lib-device-stm/actuators.cpp @@ -72,7 +72,7 @@ led_blink_once (uint32_t led_id) /**< index of LED */ /** * LEDs' GPIO pins */ -static const uint16_t led_pins [LED_NUMBER] = +static const uint16_t led_pins[LED_NUMBER] = { GPIO_Pin_12, /* LD4: Green */ GPIO_Pin_13, /* LD3: Orange */ @@ -130,7 +130,7 @@ initialize_leds (void) /** * LEDs' GPIO pins */ -static const uint16_t led_pins [LED_NUMBER] = +static const uint16_t led_pins[LED_NUMBER] = { GPIO_Pin_15, /* LD6 - Green */ GPIO_Pin_14, /* LD8 - Orange */ @@ -189,7 +189,7 @@ led_toggle (uint32_t led_id) /**< index of LED */ { if (led_id < LED_NUMBER) { - leds_port->ODR ^= led_pins [led_id]; + leds_port->ODR ^= led_pins[led_id]; } } /* led_toggle */ diff --git a/plugins/lib-device-stm/common-io.cpp b/plugins/lib-device-stm/common-io.cpp index 6d8e69174b..fab2647629 100644 --- a/plugins/lib-device-stm/common-io.cpp +++ b/plugins/lib-device-stm/common-io.cpp @@ -139,7 +139,7 @@ fake_exit (void) while (1) { led_on (pin); - for ( index = 0; index < dot; index ++) + for (index = 0; index < dot; index ++) { }; led_off (pin); diff --git a/tests/unit/test_api.cpp b/tests/unit/test_api.cpp index 667429b8af..9947f3421d 100644 --- a/tests/unit/test_api.cpp +++ b/tests/unit/test_api.cpp @@ -92,25 +92,25 @@ static bool handler (const jerry_api_object_t *function_obj_p, const jerry_api_value_t *this_p, jerry_api_value_t *ret_val_p, - const jerry_api_value_t args_p [], + const jerry_api_value_t args_p[], const uint16_t args_cnt) { - char buffer [32]; + char buffer[32]; ssize_t sz; printf ("ok %p %p %p %d %p\n", function_obj_p, this_p, args_p, args_cnt, ret_val_p); assert (args_cnt == 2); - assert (args_p [0].type == JERRY_API_DATA_TYPE_STRING); - sz = jerry_api_string_to_char_buffer (args_p [0].v_string, NULL, 0); + assert (args_p[0].type == JERRY_API_DATA_TYPE_STRING); + sz = jerry_api_string_to_char_buffer (args_p[0].v_string, NULL, 0); assert (sz == -2); - sz = jerry_api_string_to_char_buffer (args_p [0].v_string, buffer, -sz); + sz = jerry_api_string_to_char_buffer (args_p[0].v_string, buffer, -sz); assert (sz == 2); assert (!strcmp (buffer, "1")); - assert (args_p [1].type == JERRY_API_DATA_TYPE_BOOLEAN); - assert (args_p [1].v_bool == true); + assert (args_p[1].type == JERRY_API_DATA_TYPE_BOOLEAN); + assert (args_p[1].v_bool == true); test_api_init_api_value_string (ret_val_p, "string from handler"); @@ -130,7 +130,7 @@ static bool handler_construct (const jerry_api_object_t *function_obj_p, const jerry_api_value_t *this_p, jerry_api_value_t *ret_val_p, - const jerry_api_value_t args_p [], + const jerry_api_value_t args_p[], const uint16_t args_cnt) { printf ("ok construct %p %p %p %d %p\n", function_obj_p, this_p, args_p, args_cnt, ret_val_p); @@ -139,10 +139,10 @@ handler_construct (const jerry_api_object_t *function_obj_p, assert (this_p->type == JERRY_API_DATA_TYPE_OBJECT); assert (args_cnt == 1); - assert (args_p [0].type == JERRY_API_DATA_TYPE_BOOLEAN); - assert (args_p [0].v_bool == true); + assert (args_p[0].type == JERRY_API_DATA_TYPE_BOOLEAN); + assert (args_p[0].v_bool == true); - jerry_api_set_object_field_value (this_p->v_object, "value_field", &args_p [0]); + jerry_api_set_object_field_value (this_p->v_object, "value_field", &args_p[0]); jerry_api_set_object_native_handle (this_p->v_object, (uintptr_t) 0x0012345678abcdefull, @@ -162,8 +162,8 @@ main (void) jerry_api_value_t val_external, val_external_construct, val_call_external; jerry_api_object_t* global_obj_p; jerry_api_object_t* external_func_p, *external_construct_p; - jerry_api_value_t res, args [2]; - char buffer [32]; + jerry_api_value_t res, args[2]; + char buffer[32]; is_ok = jerry_parse (test_source, strlen (test_source)); assert (is_ok); @@ -348,7 +348,7 @@ main (void) jerry_cleanup (); - assert(test_api_is_free_callback_was_called); + assert (test_api_is_free_callback_was_called); return 0; } diff --git a/tests/unit/test_heap.cpp b/tests/unit/test_heap.cpp index ca6903cac9..6e2a3d9449 100644 --- a/tests/unit/test_heap.cpp +++ b/tests/unit/test_heap.cpp @@ -113,7 +113,7 @@ main (int __attr_unused___ argc, memset (ptrs[j], 0, sizes[j]); JERRY_ASSERT (ptrs[j] == NULL - || mem_heap_get_block_start (ptrs[j] + (size_t) rand () % sizes [j]) == ptrs[j]); + || mem_heap_get_block_start (ptrs[j] + (size_t) rand () % sizes[j]) == ptrs[j]); } // mem_heap_print (true); @@ -124,11 +124,11 @@ main (int __attr_unused___ argc, { for (size_t k = 0; k < sizes[j]; k++) { - JERRY_ASSERT(ptrs[j][k] == 0); + JERRY_ASSERT (ptrs[j][k] == 0); } - JERRY_ASSERT (sizes [j] == 0 - || mem_heap_get_block_start (ptrs[j] + (size_t) rand () % sizes [j]) == ptrs[j]); + JERRY_ASSERT (sizes[j] == 0 + || mem_heap_get_block_start (ptrs[j] + (size_t) rand () % sizes[j]) == ptrs[j]); mem_heap_free_block (ptrs[j]); diff --git a/tests/unit/test_number_to_string.cpp b/tests/unit/test_number_to_string.cpp index c28298188c..fafc290d55 100644 --- a/tests/unit/test_number_to_string.cpp +++ b/tests/unit/test_number_to_string.cpp @@ -65,7 +65,7 @@ main (int __attr_unused___ argc, ecma_number_to_zt_string (nums[i], zt_str, sizeof (zt_str)); - if (strcmp ((char*)zt_str, (char*)zt_strings [i]) != 0) + if (strcmp ((char*)zt_str, (char*)zt_strings[i]) != 0) { return 1; } diff --git a/tests/unit/test_pool.cpp b/tests/unit/test_pool.cpp index 449828a689..2e2e2dd950 100644 --- a/tests/unit/test_pool.cpp +++ b/tests/unit/test_pool.cpp @@ -37,7 +37,7 @@ const uint32_t test_max_sub_iters = 1024; #define TEST_POOL_SPACE_SIZE (sizeof (mem_pool_state_t) + \ (1ull << MEM_POOL_MAX_CHUNKS_NUMBER_LOG) * MEM_POOL_CHUNK_SIZE) -uint8_t test_pool [TEST_POOL_SPACE_SIZE] __attribute__ ((aligned (MEM_ALIGNMENT))); +uint8_t test_pool[TEST_POOL_SPACE_SIZE] __attribute__ ((aligned (MEM_ALIGNMENT))); uint8_t* ptrs[test_max_sub_iters]; @@ -84,7 +84,7 @@ main (int __attr_unused___ argc, { for (size_t k = 0; k < MEM_POOL_CHUNK_SIZE; k++) { - JERRY_ASSERT(((uint8_t*)ptrs[j])[k] == 0); + JERRY_ASSERT (((uint8_t*)ptrs[j])[k] == 0); } mem_pool_free_chunk (pool_p, ptrs[j]); diff --git a/tests/unit/test_poolman.cpp b/tests/unit/test_poolman.cpp index d0f0a7eb0c..7527bb23f9 100644 --- a/tests/unit/test_poolman.cpp +++ b/tests/unit/test_poolman.cpp @@ -55,7 +55,7 @@ main (int __attr_unused___ argc, for (size_t j = 0; j < subiters; j++) { ptrs[j] = mem_pools_alloc (); - // JERRY_ASSERT(ptrs[j] != NULL); + // JERRY_ASSERT (ptrs[j] != NULL); if (ptrs[j] != NULL) { @@ -71,7 +71,7 @@ main (int __attr_unused___ argc, { for (size_t k = 0; k < MEM_POOL_CHUNK_SIZE; k++) { - JERRY_ASSERT(((uint8_t*) ptrs[j])[k] == 0); + JERRY_ASSERT (((uint8_t*) ptrs[j])[k] == 0); } mem_pools_free (ptrs[j]); diff --git a/tests/unit/test_preparser.cpp b/tests/unit/test_preparser.cpp index 0781fed88d..6e5eb0eb2d 100644 --- a/tests/unit/test_preparser.cpp +++ b/tests/unit/test_preparser.cpp @@ -43,7 +43,7 @@ main (int __attr_unused___ argc, getop_reg_var_decl (128, 129), // var tmp128 .. tmp129; getop_var_decl (0), // var a; getop_assignment (129, 1, 1), // tmp129 = 1: SMALLINT; - getop_assignment (0, 6, 129), // a = tmp129 : TYPEOF(tmp129); + getop_assignment (0, 6, 129), // a = tmp129 : TYPEOF (tmp129); getop_exitval (0) // exit 0; }; diff --git a/tools/vera++/profiles/jerry b/tools/vera++/profiles/jerry index 3865531f91..16f6b3bff0 100644 --- a/tools/vera++/profiles/jerry +++ b/tools/vera++/profiles/jerry @@ -1,4 +1,14 @@ set rules { + jerry_always_curly + jerry_braces_on_separate_line + jerry_braces_same_line_or_column + jerry_funcname_space_parentheses + jerry_identifier_no_space_bracket jerry_indentation + jerry_max_line_length + jerry_no_space_after_opening_parentheses + jerry_no_space_before_closing_parentheses + jerry_no_tabs + jerry_no_trailing_spaces jerry_switch_case } diff --git a/tools/vera++/scripts/rules/jerry_always_curly.tcl b/tools/vera++/scripts/rules/jerry_always_curly.tcl new file mode 100644 index 0000000000..7c2b588074 --- /dev/null +++ b/tools/vera++/scripts/rules/jerry_always_curly.tcl @@ -0,0 +1,87 @@ +#!/usr/bin/tclsh + +# Copyright 2015 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +foreach file_name [getSourceFileNames] { + set state "control" + set do_marks {} + set prev_tok_type "" + set prev_ctrl "" + set expect_while false + set expect_open_brace false + set paren_count 0 + + foreach token [getTokens $file_name 1 0 -1 -1 {if do while else for leftparen rightparen semicolon leftbrace rightbrace}] { + set tok_val [lindex $token 0] + set line_num [lindex $token 1] + set col_num [lindex $token 2] + set tok_type [lindex $token 3] + + if {$state == "expression"} { + # puts "expression $paren_count $tok_type ($line_num , $col_num)" + if {$tok_type == "leftparen"} { + incr paren_count + } elseif {$tok_type == "rightparen"} { + incr paren_count -1 + if {$paren_count == 0} { + set state "control" + set expect_open_brace true + } elseif {$paren_count < 0 } { + report $file_name $line_num "unexpected right parentheses" + } + } elseif {$tok_type != "semicolon"} { + report $file_name $line_num "unexpected token: $tok_type" + } + } else { + if {$expect_open_brace == true} { + if {$tok_type == "if" && $prev_tok_type == "else"} { + # empty + } elseif {$tok_type != "leftbrace"} { + report $file_name [lindex $prev_ctrl 1] "brace after \'[lindex $prev_ctrl 3]\' required" + } + set expect_open_brace false + } + + if {$tok_type == "while" && ($expect_while == true || [lindex $prev_ctrl 3] == "do")} { + set expect_while false + set prev_ctrl "" + } elseif {$tok_type in {if for while}} { + set state "expression" + set prev_ctrl $token + } elseif {$tok_type in {do else}} { + set expect_open_brace true + set prev_ctrl $token + } elseif {$tok_type == "leftbrace"} { + if {[lindex $prev_ctrl 3] == "do"} { + lappend do_marks 1 + } else { + lappend do_marks 0 + } + set prev_ctrl "" + } elseif {$tok_type == "rightbrace"} { + if {[llength $do_marks] > 0} { + if {[lindex $do_marks end] == 1} { + set expect_while true + } + set do_marks [lreplace $do_marks end end] + } else { + report $file_name $line_num "unmatched brace" + } + } + } + + set prev_tok_type $tok_type + } +} diff --git a/tools/vera++/scripts/rules/jerry_braces_on_separate_line.tcl b/tools/vera++/scripts/rules/jerry_braces_on_separate_line.tcl new file mode 100644 index 0000000000..fea8925981 --- /dev/null +++ b/tools/vera++/scripts/rules/jerry_braces_on_separate_line.tcl @@ -0,0 +1,115 @@ +#!/usr/bin/tclsh + +# Copyright 2015 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +foreach file_name [getSourceFileNames] { + set state "normal" + set lines {} + set cols {} + set struct_marks {} + set expect_struct_name false + set prev_tok "" + set def_start false + set expect_newline false + set check_newline true + + foreach token [getTokens $file_name 1 0 -1 -1 {}] { + set tok_val [lindex $token 0] + set line_num [lindex $token 1] + set col_num [lindex $token 2] + set tok_type [lindex $token 3] + + if {$state == "macro"} { + if {$col_num == 0} { + set state "normal" + } else { + continue + } + } + + if {$tok_type in {space ccomment cppcomment newline}} { + continue + } + + if {$tok_type == "pp_define"} { + set state "macro" + set prev_tok "" + set def_start false + continue + } + + if {$expect_struct_name == true} { + if {$tok_type == "identifier" && $line_num != [lindex $prev_tok 1]} { + report $file_name $line_num "type name should be on the same line with the rightbrace" + } + set expect_struct_name false + } + + # check that rightbrace and typename (in struct, union and enum definitons) are on the same line + if {$tok_type in {struct enum union}} { + set def_start true + } elseif {$tok_type == "semicolon"} { + set def_start false + } elseif {$tok_type == "leftbrace"} { + lappend cols $col_num + lappend lines $line_num + if {$def_start == true} { + lappend struct_marks 1 + set def_start false + } elseif {[lindex $prev_tok 3] == "assign"} { + lappend struct_marks 2 + set check_newline false + } else { + lappend struct_marks 0 + } + } elseif {$tok_type == "rightbrace"} { + if {[llength $lines] > 0} { + if {[lindex $struct_marks end] == 1} { + set expect_struct_name true + set check_newline false + } elseif {[lindex $struct_marks end] == 2} { + set check_newline false + } + set lines [lreplace $lines end end] + set cols [lreplace $cols end end] + set struct_marks [lreplace $struct_marks end end] + } else { + report $file_name $line_num "unmatched brace" + } + } + + # check that braces are on separate lines + if {$check_newline == true} { + if {$expect_newline == true} { + if {$tok_type == "semicolon"} { + # empty + } elseif {[lindex $prev_tok 1] == $line_num} { + report $file_name $line_num "brace should be placed on a separate line" + } else { + set expect_newline false + } + } elseif {$tok_type in {leftbrace rightbrace}} { + if {[lindex $prev_tok 1] == $line_num} { + report $file_name $line_num "brace should be placed on a separate line" + } + set expect_newline true + } + } else { + set check_newline true + } + + set prev_tok $token + } +} diff --git a/tools/vera++/scripts/rules/jerry_braces_same_line_or_column.tcl b/tools/vera++/scripts/rules/jerry_braces_same_line_or_column.tcl new file mode 100644 index 0000000000..a8f637f573 --- /dev/null +++ b/tools/vera++/scripts/rules/jerry_braces_same_line_or_column.tcl @@ -0,0 +1,61 @@ +#!/usr/bin/tclsh + +# Copyright 2015 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +foreach file_name [getSourceFileNames] { + set state "normal" + set lines {} + set cols {} + + foreach token [getTokens $file_name 1 0 -1 -1 {}] { + set tok_val [lindex $token 0] + set line_num [lindex $token 1] + set col_num [lindex $token 2] + set tok_type [lindex $token 3] + + if {$state == "macro"} { + if {$col_num == 0} { + set state "normal" + } else { + set prev_tok_line $line_num + continue + } + } + + if {$tok_type in {space ccomment cppcomment newline}} { + continue + } + + if {$tok_type == "pp_define"} { + set state "macro" + continue + } + + if {$tok_type == "leftbrace"} { + lappend cols $col_num + lappend lines $line_num + } elseif {$tok_type == "rightbrace"} { + if {[llength $lines] > 0} { + if {[lindex $lines end] != $line_num && [lindex $cols end] != $col_num} { + report $file_name $line_num "matching braces should be on the same line or column" + } + set lines [lreplace $lines end end] + set cols [lreplace $cols end end] + } else { + report $file_name $line_num "unmatched brace" + } + } + } +} diff --git a/tools/vera++/scripts/rules/jerry_funcname_space_parentheses.tcl b/tools/vera++/scripts/rules/jerry_funcname_space_parentheses.tcl new file mode 100644 index 0000000000..02ccbe90e4 --- /dev/null +++ b/tools/vera++/scripts/rules/jerry_funcname_space_parentheses.tcl @@ -0,0 +1,60 @@ +#!/usr/bin/tclsh + +# Copyright 2015 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +proc check_part_of_the_file {file line_num col_start col_end} { + if {$col_start == $col_end} { + return + } + set line [getLine $file $line_num] + + if {[regexp {^\s*#[ ]*define} $line]} { + return + } + + set line [string range $line $col_start $col_end] + + if {[regexp {([[:alnum:]][\s]{2,}\()|([[:alnum:]]\()} $line]} { + report $file $line_num "there should be exactly one space before left parentheses" + } +} + +foreach fileName [getSourceFileNames] { + set checkLine 1 + set checkColStart 0 + set seenOmitToken false + foreach token [getTokens $fileName 1 0 -1 -1 {}] { + set lineNumber [lindex $token 1] + set colNumber [lindex $token 2] + set tokenType [lindex $token 3] + + if {$checkLine != $lineNumber} { + if {!$seenOmitToken} { + check_part_of_the_file $fileName $checkLine $checkColStart end + } + set checkColStart $colNumber + set checkLine $lineNumber + } elseif {$seenOmitToken} { + set checkColStart $colNumber + } + + if {$tokenType in {ccomment cppcomment stringlit}} { + check_part_of_the_file $fileName $checkLine $checkColStart $colNumber + set seenOmitToken true + } else { + set seenOmitToken false + } + } +} diff --git a/tools/vera++/scripts/rules/jerry_identifier_no_space_bracket.tcl b/tools/vera++/scripts/rules/jerry_identifier_no_space_bracket.tcl new file mode 100644 index 0000000000..48f3de6e06 --- /dev/null +++ b/tools/vera++/scripts/rules/jerry_identifier_no_space_bracket.tcl @@ -0,0 +1,56 @@ +#!/usr/bin/tclsh + +# Copyright 2015 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +proc check_part_of_the_file {file line_num col_start col_end} { + if {$col_start == $col_end} { + return + } + + set line [getLine $file $line_num] + set line [string range $line $col_start $col_end] + + if {[regexp {[[:alnum:]_][\s]+\[} $line]} { + report $file $line_num "there should be no spaces between identifier and left bracket" + } +} + +foreach fileName [getSourceFileNames] { + set checkLine 1 + set checkColStart 0 + set seenOmitToken false + foreach token [getTokens $fileName 1 0 -1 -1 {}] { + set lineNumber [lindex $token 1] + set colNumber [lindex $token 2] + set tokenType [lindex $token 3] + + if {$checkLine != $lineNumber} { + if {!$seenOmitToken} { + check_part_of_the_file $fileName $checkLine $checkColStart end + } + set checkColStart $colNumber + set checkLine $lineNumber + } elseif {$seenOmitToken} { + set checkColStart $colNumber + } + + if {$tokenType in {ccomment cppcomment stringlit}} { + check_part_of_the_file $fileName $checkLine $checkColStart $colNumber + set seenOmitToken true + } else { + set seenOmitToken false + } + } +} diff --git a/tools/vera++/scripts/rules/jerry_max_line_length.tcl b/tools/vera++/scripts/rules/jerry_max_line_length.tcl new file mode 100644 index 0000000000..54c5cd64ff --- /dev/null +++ b/tools/vera++/scripts/rules/jerry_max_line_length.tcl @@ -0,0 +1,27 @@ +#!/usr/bin/tclsh + +# Copyright 2015 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set maxLen 120 + +foreach f [getSourceFileNames] { + set lineNumber 1 + foreach line [getAllLines $f] { + if {[string length $line] > $maxLen} { + report $f $lineNumber "line is longer than ${maxLen} characters" + } + incr lineNumber + } +} diff --git a/tools/vera++/scripts/rules/jerry_no_space_after_opening_parentheses.tcl b/tools/vera++/scripts/rules/jerry_no_space_after_opening_parentheses.tcl new file mode 100644 index 0000000000..12e32b25c7 --- /dev/null +++ b/tools/vera++/scripts/rules/jerry_no_space_after_opening_parentheses.tcl @@ -0,0 +1,56 @@ +#!/usr/bin/tclsh + +# Copyright 2015 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +proc check_part_of_the_file {file line_num col_start col_end} { + if {$col_start == $col_end} { + return + } + + set line [getLine $file $line_num] + set line [string range $line $col_start $col_end] + + if {[regexp {\(+[[:blank:]]} $line]} { + report $file $line_num "there should be no blank characters after opening parentheses" + } +} + +foreach fileName [getSourceFileNames] { + set checkLine 1 + set checkColStart 0 + set seenOmitToken false + foreach token [getTokens $fileName 1 0 -1 -1 {}] { + set lineNumber [lindex $token 1] + set colNumber [lindex $token 2] + set tokenType [lindex $token 3] + + if {$checkLine != $lineNumber} { + if {!$seenOmitToken} { + check_part_of_the_file $fileName $checkLine $checkColStart end + } + set checkColStart $colNumber + set checkLine $lineNumber + } elseif {$seenOmitToken} { + set checkColStart $colNumber + } + + if {$tokenType in {ccomment cppcomment stringlit}} { + check_part_of_the_file $fileName $checkLine $checkColStart $colNumber + set seenOmitToken true + } else { + set seenOmitToken false + } + } +} diff --git a/tools/vera++/scripts/rules/jerry_no_space_before_closing_parentheses.tcl b/tools/vera++/scripts/rules/jerry_no_space_before_closing_parentheses.tcl new file mode 100644 index 0000000000..2353de5000 --- /dev/null +++ b/tools/vera++/scripts/rules/jerry_no_space_before_closing_parentheses.tcl @@ -0,0 +1,25 @@ +#!/usr/bin/tclsh + +# Copyright 2015 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +foreach f [getSourceFileNames] { + set lineNumber 1 + foreach line [getAllLines $f] { + if {[regexp {[[:graph:]][[:blank:]]+\)} $line]} { + report $f $lineNumber "there should be no blank characters before closing parentheses" + } + incr lineNumber + } +} diff --git a/tools/vera++/scripts/rules/jerry_no_tabs.tcl b/tools/vera++/scripts/rules/jerry_no_tabs.tcl new file mode 100644 index 0000000000..f131b5d647 --- /dev/null +++ b/tools/vera++/scripts/rules/jerry_no_tabs.tcl @@ -0,0 +1,25 @@ +#!/usr/bin/tclsh + +# Copyright 2015 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +foreach f [getSourceFileNames] { + set lineNumber 1 + foreach line [getAllLines $f] { + if {[regexp {\t} $line]} { + report $f $lineNumber "tabs are not allowed" + } + incr lineNumber + } +} diff --git a/tools/vera++/scripts/rules/jerry_no_trailing_spaces.tcl b/tools/vera++/scripts/rules/jerry_no_trailing_spaces.tcl new file mode 100644 index 0000000000..78c0200526 --- /dev/null +++ b/tools/vera++/scripts/rules/jerry_no_trailing_spaces.tcl @@ -0,0 +1,25 @@ +#!/usr/bin/tclsh + +# Copyright 2015 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +foreach f [getSourceFileNames] { + set lineNumber 1 + foreach line [getAllLines $f] { + if {[regexp {[[:blank:]]$} $line]} { + report $f $lineNumber "trailing space is not allowed" + } + incr lineNumber + } +} diff --git a/tools/vera++/scripts/rules/jerry_switch_case.tcl b/tools/vera++/scripts/rules/jerry_switch_case.tcl index 30cfb27a59..2d9bb34410 100644 --- a/tools/vera++/scripts/rules/jerry_switch_case.tcl +++ b/tools/vera++/scripts/rules/jerry_switch_case.tcl @@ -27,7 +27,7 @@ foreach fileName [getSourceFileNames] { if {$is_in_comment == "yes"} { set is_in_comment "no" } - + if {$type == "newline"} { set is_in_pp_define "no" } elseif {$type == "ccomment"} { @@ -140,7 +140,7 @@ foreach fileName [getSourceFileNames] { if {$next_token_type == "semicolon"} { set state "break" } - continue + continue } elseif {$state == "wait-for-break"} { if {$next_token_type == "case" || $next_token_type == "default"} { report $fileName [lindex $next_token 1] "Missing break or FALLTHRU comment before case (state $state)"