Fix old-style function definitions and enable warning. (#1651)

Function definitions with no parameters should always use the void keyword to allow the compiler to catch invalid calls of those functions at compile time.

Enable -Wold-style-definition to catch this early in the future.

Fixes #1649.

JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
This commit is contained in:
Tilmann Scheller
2017-03-09 13:41:26 +01:00
committed by GitHub
parent a2a160d6f9
commit f8dd54abb6
13 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -179,7 +179,7 @@ jerry_add_compile_flags(-fno-stack-protector)
endif() endif()
if (USING_GCC OR USING_CLANG) if (USING_GCC OR USING_CLANG)
jerry_add_compile_warnings(all extra format-nonliteral init-self conversion sign-conversion format-security missing-declarations shadow strict-prototypes undef) jerry_add_compile_warnings(all extra format-nonliteral init-self conversion sign-conversion format-security missing-declarations shadow strict-prototypes undef old-style-definition)
jerry_add_compile_flags(-Wno-stack-protector -Wno-attributes) jerry_add_compile_flags(-Wno-stack-protector -Wno-attributes)
endif() endif()
+1 -1
View File
@@ -196,7 +196,7 @@ bool jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
/** /**
* Default implementation of jerry_port_get_current_time. * Default implementation of jerry_port_get_current_time.
*/ */
double jerry_port_get_current_time () double jerry_port_get_current_time (void)
{ {
struct timeval tv; struct timeval tv;
+1 -1
View File
@@ -311,7 +311,7 @@ jerry_process_handshake (int client_socket, /**< client socket */
* false - otherwise * false - otherwise
*/ */
bool bool
jerry_debugger_accept_connection () jerry_debugger_accept_connection (void)
{ {
int server_socket; int server_socket;
struct sockaddr_in addr; struct sockaddr_in addr;
+1 -1
View File
@@ -37,7 +37,7 @@ jmem_init (void)
* Finalize memory allocators. * Finalize memory allocators.
*/ */
void void
jmem_finalize () jmem_finalize (void)
{ {
jmem_pools_finalize (); jmem_pools_finalize ();
+1 -1
View File
@@ -191,7 +191,7 @@ jmem_pools_free (void *chunk_p, /**< pointer to the chunk */
* Collect empty pool chunks * Collect empty pool chunks
*/ */
void void
jmem_pools_collect_empty () jmem_pools_collect_empty (void)
{ {
jmem_pools_chunk_t *chunk_p = JERRY_CONTEXT (jmem_free_8_byte_chunk_p); jmem_pools_chunk_t *chunk_p = JERRY_CONTEXT (jmem_free_8_byte_chunk_p);
JERRY_CONTEXT (jmem_free_8_byte_chunk_p) = NULL; JERRY_CONTEXT (jmem_free_8_byte_chunk_p) = NULL;
+1 -1
View File
@@ -488,7 +488,7 @@ re_find_bytecode_in_cache (ecma_string_t *pattern_str_p, /**< pattern string */
* Run gerbage collection in RegExp cache * Run gerbage collection in RegExp cache
*/ */
void void
re_cache_gc_run () re_cache_gc_run (void)
{ {
for (uint32_t i = 0u; i < RE_CACHE_SIZE; i++) for (uint32_t i = 0u; i < RE_CACHE_SIZE; i++)
{ {
+1 -1
View File
@@ -84,7 +84,7 @@ bool jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
/** /**
* Curie BSP implementation of jerry_port_get_current_time. * Curie BSP implementation of jerry_port_get_current_time.
*/ */
double jerry_port_get_current_time () double jerry_port_get_current_time (void)
{ {
uint32_t uptime_ms = get_uptime_ms (); uint32_t uptime_ms = get_uptime_ms ();
uint32_t epoch_time = uptime_to_epoch (uptime_ms); uint32_t epoch_time = uptime_to_epoch (uptime_ms);
+1 -1
View File
@@ -50,7 +50,7 @@ bool jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
/** /**
* Default implementation of jerry_port_get_current_time. * Default implementation of jerry_port_get_current_time.
*/ */
double jerry_port_get_current_time () double jerry_port_get_current_time (void)
{ {
#ifdef __GNUC__ #ifdef __GNUC__
struct timeval tv; struct timeval tv;
+1 -1
View File
@@ -36,7 +36,7 @@ void jerry_port_default_set_abort_on_fail (bool flag) /**< new value of 'abort o
* @return true - if 'abort on fail' flag is set, * @return true - if 'abort on fail' flag is set,
* false - otherwise. * false - otherwise.
*/ */
bool jerry_port_default_is_abort_on_fail () bool jerry_port_default_is_abort_on_fail (void)
{ {
return abort_on_fail; return abort_on_fail;
} /* jerry_port_default_is_abort_on_fail */ } /* jerry_port_default_is_abort_on_fail */
+1 -1
View File
@@ -79,7 +79,7 @@ jerry_port_get_time_zone (jerry_time_zone_t *tz_p) /**< timezone pointer */
* @return current timer's counter value in microseconds * @return current timer's counter value in microseconds
*/ */
double double
jerry_port_get_current_time () jerry_port_get_current_time (void)
{ {
return (double) us_ticker_read (); return (double) us_ticker_read ();
} /* jerry_port_get_current_time */ } /* jerry_port_get_current_time */
+1 -1
View File
@@ -93,7 +93,7 @@ jerry_port_get_time_zone (jerry_time_zone_t *tz_p) /**< timezone pointer */
* @return current timer's counter value in microseconds * @return current timer's counter value in microseconds
*/ */
double double
jerry_port_get_current_time () jerry_port_get_current_time (void)
{ {
return (double) us_ticker_read (); return (double) us_ticker_read ();
} /* jerry_port_get_current_time */ } /* jerry_port_get_current_time */
+1 -1
View File
@@ -304,7 +304,7 @@ jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
* @return 0 * @return 0
*/ */
double double
jerry_port_get_current_time () jerry_port_get_current_time (void)
{ {
return 0; return 0;
} /* jerry_port_get_current_time */ } /* jerry_port_get_current_time */
+1 -1
View File
@@ -65,7 +65,7 @@ void jerry_port_fatal (jerry_fatal_code_t code)
* @return current timer's counter value in milliseconds * @return current timer's counter value in milliseconds
*/ */
double double
jerry_port_get_current_time () jerry_port_get_current_time (void)
{ {
int64_t ms = k_uptime_get(); int64_t ms = k_uptime_get();
return (double) ms; return (double) ms;