Style fix: fix comments at the end of function definitions.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
László Langó
2016-01-29 13:57:23 +01:00
parent 41f6cbb3ac
commit d038284bff
23 changed files with 107 additions and 53 deletions
+3 -4
View File
@@ -935,7 +935,7 @@ ecma_string_get_array_index (const ecma_string_t *str_p, /**< ecma-string */
is_array_index = is_array_index && (*out_index_p != ECMA_MAX_VALUE_OF_VALID_ARRAY_INDEX); is_array_index = is_array_index && (*out_index_p != ECMA_MAX_VALUE_OF_VALID_ARRAY_INDEX);
return is_array_index; return is_array_index;
} /* ecma_string_is_array_index */ } /* ecma_string_get_array_index */
/** /**
* Convert ecma-string's contents to a cesu-8 string and put it to the buffer. * Convert ecma-string's contents to a cesu-8 string and put it to the buffer.
@@ -1283,8 +1283,7 @@ ecma_compare_ecma_strings_relational (const ecma_string_t *string1_p, /**< ecma-
} }
return is_first_less_than_second; return is_first_less_than_second;
} } /* ecma_compare_ecma_strings_relational */
/* ecma_compare_ecma_strings_relational */
/** /**
* Get length of ecma-string * Get length of ecma-string
@@ -1629,7 +1628,7 @@ ecma_string_hash (const ecma_string_t *string_p) /**< ecma-string to calculate h
{ {
return (string_p->hash); return (string_p->hash);
} /* ecma_string_try_hash */ } /* ecma_string_hash */
/** /**
* Create a substring from an ecma string * Create a substring from an ecma string
+4 -4
View File
@@ -1019,7 +1019,7 @@ ecma_get_named_accessor_property_getter (const ecma_property_t *prop_p) /**< nam
prop_p->u.named_accessor_property.getter_setter_pair_cp); prop_p->u.named_accessor_property.getter_setter_pair_cp);
return ECMA_GET_POINTER (ecma_object_t, getter_setter_pointers_p->getter_p); return ECMA_GET_POINTER (ecma_object_t, getter_setter_pointers_p->getter_p);
} /* ecma_named_accessor_property_get_getter */ } /* ecma_get_named_accessor_property_getter */
/** /**
* Get setter of named accessor property * Get setter of named accessor property
@@ -1036,7 +1036,7 @@ ecma_get_named_accessor_property_setter (const ecma_property_t *prop_p) /**< nam
prop_p->u.named_accessor_property.getter_setter_pair_cp); prop_p->u.named_accessor_property.getter_setter_pair_cp);
return ECMA_GET_POINTER (ecma_object_t, getter_setter_pointers_p->setter_p); return ECMA_GET_POINTER (ecma_object_t, getter_setter_pointers_p->setter_p);
} /* ecma_named_accessor_property_get_setter */ } /* ecma_get_named_accessor_property_setter */
/** /**
* Set getter of named accessor property * Set getter of named accessor property
@@ -1054,7 +1054,7 @@ ecma_set_named_accessor_property_getter (ecma_object_t *object_p, /**< the prope
prop_p->u.named_accessor_property.getter_setter_pair_cp); prop_p->u.named_accessor_property.getter_setter_pair_cp);
ECMA_SET_POINTER (getter_setter_pointers_p->getter_p, getter_p); ECMA_SET_POINTER (getter_setter_pointers_p->getter_p, getter_p);
} /* ecma_named_accessor_property_set_getter */ } /* ecma_set_named_accessor_property_getter */
/** /**
* Set setter of named accessor property * Set setter of named accessor property
@@ -1072,7 +1072,7 @@ ecma_set_named_accessor_property_setter (ecma_object_t *object_p, /**< the prope
prop_p->u.named_accessor_property.getter_setter_pair_cp); prop_p->u.named_accessor_property.getter_setter_pair_cp);
ECMA_SET_POINTER (getter_setter_pointers_p->setter_p, setter_p); ECMA_SET_POINTER (getter_setter_pointers_p->setter_p, setter_p);
} /* ecma_named_accessor_property_set_setter */ } /* ecma_set_named_accessor_property_setter */
/** /**
* Get property's 'Writable' attribute value * Get property's 'Writable' attribute value
@@ -143,7 +143,7 @@ ecma_builtin_helper_json_create_separated_properties (ecma_collection_header_t *
} }
return properties_str_p; return properties_str_p;
} /* ecma_builtin_json_helper_create_separated_properties */ } /* ecma_builtin_helper_json_create_separated_properties */
/** /**
* Common function to create a formatted JSON string. * Common function to create a formatted JSON string.
@@ -213,7 +213,7 @@ ecma_builtin_helper_json_create_formatted_json (ecma_string_t *left_bracket_p, /
final_str_p = tmp_str_p; final_str_p = tmp_str_p;
return ecma_make_normal_completion_value (ecma_make_string_value (final_str_p)); return ecma_make_normal_completion_value (ecma_make_string_value (final_str_p));
} /* ecma_builtin_json_helper_create_formatted_json */ } /* ecma_builtin_helper_json_create_formatted_json */
/** /**
* Common function to create a non-formatted JSON string. * Common function to create a non-formatted JSON string.
@@ -252,7 +252,7 @@ ecma_builtin_helper_json_create_non_formatted_json (ecma_string_t *left_bracket_
properties_str_p = tmp_str_p; properties_str_p = tmp_str_p;
return ecma_make_normal_completion_value (ecma_make_string_value (properties_str_p)); return ecma_make_normal_completion_value (ecma_make_string_value (properties_str_p));
} /* ecma_builtin_json_helper_create_non_formatted_json */ } /* ecma_builtin_helper_json_create_non_formatted_json */
/** /**
* Convert decimal value to 4 digit hexadecimal string value. * Convert decimal value to 4 digit hexadecimal string value.
@@ -452,7 +452,7 @@ ecma_builtin_list_lazy_property_names (ecma_object_t *object_p, /**< a built-in
JERRY_UNREACHABLE (); JERRY_UNREACHABLE ();
} }
} /* ecma_builtin_list_and_lazy_property_names */ } /* ecma_builtin_list_lazy_property_names */
/** /**
* Construct a Function object for specified built-in routine * Construct a Function object for specified built-in routine
@@ -1167,7 +1167,7 @@ re_match_regexp (re_matcher_ctx_t *re_ctx_p, /**< RegExp matcher context */
JERRY_UNREACHABLE (); JERRY_UNREACHABLE ();
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE); /* fail */ return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE); /* fail */
} /* regexp_match */ } /* re_match_regexp */
/** /**
* Define the necessary properties for the result array (index, input, length). * Define the necessary properties for the result array (index, input, length).
+6 -6
View File
@@ -807,7 +807,7 @@ jerry_api_create_error (jerry_api_error_t error_type, /**< type of error */
return jerry_api_create_error_sz (error_type, return jerry_api_create_error_sz (error_type,
(lit_utf8_byte_t *) message_p, (lit_utf8_byte_t *) message_p,
lit_zt_utf8_string_size (message_p)); lit_zt_utf8_string_size (message_p));
} } /* jerry_api_create_error */
/** /**
* Create an error object * Create an error object
@@ -885,7 +885,7 @@ jerry_api_create_error_sz (jerry_api_error_t error_type, /**< type of error */
return error_object_p; return error_object_p;
} }
} /* jerry_api_create_error */ } /* jerry_api_create_error_sz */
/** /**
* Create an external function object * Create an external function object
@@ -1136,7 +1136,7 @@ bool jerry_api_get_object_field_value (jerry_api_object_t *object_p, /**< object
field_name_p, field_name_p,
lit_zt_utf8_string_size (field_name_p), lit_zt_utf8_string_size (field_name_p),
field_value_p); field_value_p);
} } /* jerry_api_get_object_field_value */
/** /**
* Applies the given function to the every fields in the objects * Applies the given function to the every fields in the objects
@@ -1241,7 +1241,7 @@ jerry_api_get_object_field_value_sz (jerry_api_object_t *object_p, /**< object *
ecma_deref_ecma_string (field_name_str_p); ecma_deref_ecma_string (field_name_str_p);
return is_successful; return is_successful;
} /* jerry_api_get_object_field_value */ } /* jerry_api_get_object_field_value_sz */
/** /**
* Set value of field in the specified object * Set value of field in the specified object
@@ -1259,7 +1259,7 @@ jerry_api_set_object_field_value (jerry_api_object_t *object_p, /**< object */
field_name_p, field_name_p,
lit_zt_utf8_string_size (field_name_p), lit_zt_utf8_string_size (field_name_p),
field_value_p); field_value_p);
} } /* jerry_api_set_object_field_value */
/** /**
* Set value of field in the specified object * Set value of field in the specified object
@@ -1302,7 +1302,7 @@ jerry_api_set_object_field_value_sz (jerry_api_object_t *object_p, /**< object *
ecma_deref_ecma_string (field_name_str_p); ecma_deref_ecma_string (field_name_str_p);
return is_successful; return is_successful;
} /* jerry_api_set_object_field_value */ } /* jerry_api_set_object_field_value_sz */
/** /**
* Get native handle, associated with specified object * Get native handle, associated with specified object
+2 -2
View File
@@ -125,7 +125,7 @@ lit_snapshot_dump (lit_literal_t lit, /**< literal to dump */
JERRY_UNREACHABLE (); JERRY_UNREACHABLE ();
return 0; return 0;
} /* rcs_snapshot_dump */ } /* lit_snapshot_dump */
/** /**
* Dump literals to specified snapshot buffer. * Dump literals to specified snapshot buffer.
@@ -410,6 +410,6 @@ lit_load_literals_from_snapshot (const uint8_t *lit_table_p, /**< buffer with li
mem_heap_free_block (id_map_p); mem_heap_free_block (id_map_p);
return false; return false;
} /* rcs_load_literals_from_snapshot */ } /* lit_load_literals_from_snapshot */
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */ #endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
+1 -1
View File
@@ -847,7 +847,7 @@ lit_code_point_to_cesu8 (lit_code_point_t code_point, /**< code point */
offset += lit_code_unit_to_utf8 (convert_code_point_to_low_surrogate (code_point), buf + offset); offset += lit_code_unit_to_utf8 (convert_code_point_to_low_surrogate (code_point), buf + offset);
return offset; return offset;
} }
} /* lit_code_point_to_utf8 */ } /* lit_code_point_to_cesu8 */
/** /**
* Convert code point to utf-8 representation * Convert code point to utf-8 representation
+2 -2
View File
@@ -201,7 +201,7 @@ re_get_opcode (uint8_t **bc_p) /**< pointer to bytecode start */
uint8_t bytecode = **bc_p; uint8_t bytecode = **bc_p;
(*bc_p) += sizeof (uint8_t); (*bc_p) += sizeof (uint8_t);
return (re_opcode_t) bytecode; return (re_opcode_t) bytecode;
} /* get_opcode */ } /* re_get_opcode */
/** /**
* Get a parameter of a RegExp opcode * Get a parameter of a RegExp opcode
@@ -212,7 +212,7 @@ re_get_value (uint8_t **bc_p) /**< pointer to bytecode start */
uint32_t value = *((uint32_t*) *bc_p); uint32_t value = *((uint32_t*) *bc_p);
(*bc_p) += sizeof (uint32_t); (*bc_p) += sizeof (uint32_t);
return value; return value;
} /* get_value */ } /* re_get_value */
/** /**
* Callback function of character class generation * Callback function of character class generation
+1 -1
View File
@@ -299,7 +299,7 @@ rcs_alloc_record (rcs_record_set_t *rec_set_p, /**< recordset */
rcs_assert_state_is_correct (rec_set_p); rcs_assert_state_is_correct (rec_set_p);
return rec_p; return rec_p;
} /* alloc_record */ } /* rcs_alloc_record */
/** /**
* Free the specified record. * Free the specified record.
+1 -1
View File
@@ -142,7 +142,7 @@ rcs_record_set_alignment_bytes_count (rcs_record_t *rec_p, /**< record */
JERRY_ASSERT (RCS_RECORD_IS_CHARSET (rec_p)); JERRY_ASSERT (RCS_RECORD_IS_CHARSET (rec_p));
rcs_record_set_field (rec_p, RCS_CHARSET_HEADER_ALIGN_POS, RCS_CHARSET_HEADER_ALIGN_WIDTH, count); rcs_record_set_field (rec_p, RCS_CHARSET_HEADER_ALIGN_POS, RCS_CHARSET_HEADER_ALIGN_WIDTH, count);
} /* rcs_record_set_align */ } /* rcs_record_set_alignment_bytes_count */
/** /**
* Set the hash value of the record. * Set the hash value of the record.
+2 -2
View File
@@ -304,7 +304,7 @@ libc_printf_write_d_i (FILE *stream, /**< stream pointer */
width, width,
flags & LIBC_PRINTF_ARG_FLAG_LEFT_JUSTIFY, flags & LIBC_PRINTF_ARG_FLAG_LEFT_JUSTIFY,
flags & LIBC_PRINTF_ARG_FLAG_ZERO_PADDING); flags & LIBC_PRINTF_ARG_FLAG_ZERO_PADDING);
} /** libc_printf_write_d_i */ } /* libc_printf_write_d_i */
/** /**
* printf helper function that prints d and i arguments * printf helper function that prints d and i arguments
@@ -470,7 +470,7 @@ libc_printf_write_u_o_x_X (FILE *stream, /**< stream pointer */
width, width,
flags & LIBC_PRINTF_ARG_FLAG_LEFT_JUSTIFY, flags & LIBC_PRINTF_ARG_FLAG_LEFT_JUSTIFY,
flags & LIBC_PRINTF_ARG_FLAG_ZERO_PADDING); flags & LIBC_PRINTF_ARG_FLAG_ZERO_PADDING);
} /** libc_printf_write_u_o_x_X */ } /* libc_printf_write_u_o_x_X */
/** /**
* vfprintf * vfprintf
+4 -4
View File
@@ -173,7 +173,7 @@ strcmp (const char *str1, const char *str2)
while (s1 == s2); while (s1 == s2);
return (s1 < s2) ? -1 : (s1 > s2 ? 1 : 0); return (s1 < s2) ? -1 : (s1 > s2 ? 1 : 0);
} } /* strcmp */
/** Compare two strings. return an integer less than, equal to, or greater than zero /** Compare two strings. return an integer less than, equal to, or greater than zero
if the first n character of s1 is found, respectively, to be less than, to match, if the first n character of s1 is found, respectively, to be less than, to match,
@@ -217,7 +217,7 @@ strncmp (const char *s1, const char *s2, size_t n)
} }
return 0; return 0;
} } /* strncmp */
/** Copy a string. At most n bytes of src are copied. Warning: If there is no /** Copy a string. At most n bytes of src are copied. Warning: If there is no
null byte among the first n bytes of src, the string placed in dest will not be null-terminated. null byte among the first n bytes of src, the string placed in dest will not be null-terminated.
@@ -237,7 +237,7 @@ strncpy (char *dest, const char *src, size_t n)
} }
return dest; return dest;
} } /* strncpy */
/** Calculate the length of a string. */ /** Calculate the length of a string. */
size_t size_t
@@ -250,7 +250,7 @@ strlen (const char *s)
} }
return i; return i;
} } /* strlen */
/** /**
* Generate pseudo-random integer * Generate pseudo-random integer
+1 -1
View File
@@ -43,4 +43,4 @@ main (void)
{ {
return JERRY_STANDALONE_EXIT_CODE_FAIL; return JERRY_STANDALONE_EXIT_CODE_FAIL;
} }
} } /* main */
+2 -2
View File
@@ -109,7 +109,7 @@ read_sources (const char *script_file_names[],
return (const jerry_api_char_t *) buffer; return (const jerry_api_char_t *) buffer;
} }
} } /* read_sources */
static bool static bool
read_snapshot (const char *snapshot_file_name_p, read_snapshot (const char *snapshot_file_name_p,
@@ -481,4 +481,4 @@ main (int argc,
return JERRY_STANDALONE_EXIT_CODE_FAIL; return JERRY_STANDALONE_EXIT_CODE_FAIL;
} }
} }
} } /* main */
+3 -3
View File
@@ -29,7 +29,7 @@ int jerry_port_logmsg (FILE *stream, /**< stream pointer */
count = vfprintf (stream, format, args); count = vfprintf (stream, format, args);
va_end (args); va_end (args);
return count; return count;
} } /* jerry_port_logmsg */
/** /**
* Provide error message to console implementation for the engine. * Provide error message to console implementation for the engine.
@@ -43,7 +43,7 @@ int jerry_port_errormsg (const char *format, /**< format string */
count = vfprintf (stderr, format, args); count = vfprintf (stderr, format, args);
va_end (args); va_end (args);
return count; return count;
} } /* jerry_port_errormsg */
/** /**
@@ -52,6 +52,6 @@ int jerry_port_errormsg (const char *format, /**< format string */
int jerry_port_putchar (int c) /**< character to put */ int jerry_port_putchar (int c) /**< character to put */
{ {
return putchar (c); return putchar (c);
} } /* jerry_port_putchar */
#endif /* !MAIN_H */ #endif /* !MAIN_H */
+6 -5
View File
@@ -154,7 +154,7 @@ handler_throw_test (const jerry_api_object_t *function_obj_p,
jerry_api_release_object (error_p); jerry_api_release_object (error_p);
return false; return false;
} } /* handler_throw_test */
static void static void
handler_construct_freecb (uintptr_t native_p) handler_construct_freecb (uintptr_t native_p)
@@ -285,7 +285,7 @@ static bool foreach (const jerry_api_string_t *name,
JERRY_ASSERT (!strncmp ((const char*)user_data, "user_data", 9)); JERRY_ASSERT (!strncmp ((const char*)user_data, "user_data", 9));
return true; return true;
} } /* foreach */
static bool foreach_exception (const jerry_api_string_t *name, const jerry_api_value_t *, void *) static bool foreach_exception (const jerry_api_string_t *name, const jerry_api_value_t *, void *)
{ {
@@ -298,7 +298,7 @@ static bool foreach_exception (const jerry_api_string_t *name, const jerry_api_v
JERRY_ASSERT (false); JERRY_ASSERT (false);
} }
return true; return true;
} } /* foreach_exception */
static bool foreach_subset (const jerry_api_string_t *, const jerry_api_value_t *, void *user_data) static bool foreach_subset (const jerry_api_string_t *, const jerry_api_value_t *, void *user_data)
{ {
@@ -309,7 +309,8 @@ static bool foreach_subset (const jerry_api_string_t *, const jerry_api_value_t
} }
(*count_p)++; (*count_p)++;
return true; return true;
} } /* foreach_subset */
int int
main (void) main (void)
{ {
@@ -740,4 +741,4 @@ main (void)
} }
return 0; return 0;
} } /* main */
+3 -3
View File
@@ -75,7 +75,7 @@ int jerry_port_logmsg (FILE *stream, /**< stream pointer */
count = vfprintf (stream, format, args); count = vfprintf (stream, format, args);
va_end (args); va_end (args);
return count; return count;
} } /* jerry_port_logmsg */
/** /**
* Provide error message to console implementation for the engine. * Provide error message to console implementation for the engine.
@@ -89,7 +89,7 @@ int jerry_port_errormsg (const char *format, /**< format string */
count = vfprintf (stderr, format, args); count = vfprintf (stderr, format, args);
va_end (args); va_end (args);
return count; return count;
} } /* jerry_port_errormsg */
/** /**
* Provide output character to console implementation for the engine. * Provide output character to console implementation for the engine.
@@ -97,6 +97,6 @@ int jerry_port_errormsg (const char *format, /**< format string */
int jerry_port_putchar (int c) /**< character to put */ int jerry_port_putchar (int c) /**< character to put */
{ {
return putchar (c); return putchar (c);
} } /* jerry_port_putchar */
#endif /* TEST_COMMON_H */ #endif /* TEST_COMMON_H */
+3 -3
View File
@@ -37,7 +37,7 @@ generate_string (lit_utf8_byte_t *str, lit_utf8_size_t len)
{ {
str[i] = bytes[(unsigned long) rand () % length]; str[i] = bytes[(unsigned long) rand () % length];
} }
} } /* generate_string */
static ecma_number_t static ecma_number_t
generate_number () generate_number ()
@@ -53,7 +53,7 @@ generate_number ()
num *= 10; num *= 10;
} }
return num; return num;
} } /* generate_number */
int int
main (int __attr_unused___ argc, main (int __attr_unused___ argc,
@@ -140,4 +140,4 @@ main (int __attr_unused___ argc,
lit_finalize (); lit_finalize ();
mem_finalize (true); mem_finalize (true);
return 0; return 0;
} } /* main */
+1 -1
View File
@@ -65,7 +65,7 @@ test_setjmp_longjmp (volatile int depth)
longjmp (buffers[t], t + 1); longjmp (buffers[t], t + 1);
} }
} } /* test_setjmp_longjmp */
int int
main (int __attr_unused___ argc, main (int __attr_unused___ argc,
+3 -3
View File
@@ -71,7 +71,7 @@ generate_cesu8_char (utf8_char_size char_size,
} }
return lit_code_unit_to_utf8 ((ecma_char_t) code_point, buf); return lit_code_unit_to_utf8 ((ecma_char_t) code_point, buf);
} } /* generate_cesu8_char */
static ecma_length_t static ecma_length_t
generate_cesu8_string (lit_utf8_byte_t *buf_p, generate_cesu8_string (lit_utf8_byte_t *buf_p,
@@ -98,7 +98,7 @@ generate_cesu8_string (lit_utf8_byte_t *buf_p,
JERRY_ASSERT (size == buf_size); JERRY_ASSERT (size == buf_size);
return length; return length;
} } /* generate_cesu8_string */
int int
main (int __attr_unused___ argc, main (int __attr_unused___ argc,
@@ -232,4 +232,4 @@ main (int __attr_unused___ argc,
mem_finalize (true); mem_finalize (true);
return 0; return 0;
} } /* main */
+1
View File
@@ -3,6 +3,7 @@ set rules {
jerry_braces_on_separate_line jerry_braces_on_separate_line
jerry_braces_same_line_or_column jerry_braces_same_line_or_column
jerry_dereference_operator_always_on_right jerry_dereference_operator_always_on_right
jerry_comment_function_end
jerry_funcname_space_parentheses jerry_funcname_space_parentheses
jerry_identifier_no_space_bracket jerry_identifier_no_space_bracket
jerry_indentation jerry_indentation
@@ -0,0 +1,53 @@
#!/usr/bin/tclsh
# Copyright 2016 Samsung Electronics Co., Ltd.
# Copyright 2016 University of Szeged
#
# 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 fileName [getSourceFileNames] {
set funcStart 0
set funcName {}
set lineNumber 1
foreach line [getAllLines $fileName] {
if {[regexp {^((static |const )*\w+ )*\w+ \(.*[,\)]} $line]} {
set type {}
set modifier {}
if {$funcStart == 0} {
regexp {^((static |const )*\w+ )*(\w+) \(} $line matched type modifier funcName
}
}
if {[regexp {^\{$} $line]} {
set funcStart 1
}
if {$funcStart == 1} {
if {[regexp {^\}$} $line]} {
report $fileName $lineNumber "missing comment at the end of function: /* $funcName */"
set funcStart 0
} elseif {[regexp {^\} /\*\s*\w+\s*\*/$} $line]} {
set comment {}
regexp {^\} /\*\s*(\w+)\s*\*/$} $line -> comment
if {$comment != $funcName} {
report $fileName $lineNumber "comment missmatch. (Current: $comment, Expected: $funcName)"
}
set funcStart 0
} elseif {[regexp {^\}.*;$} $line]} {
set funcStart 0
}
}
incr lineNumber
}
}