Skip to content

Commit e99e41c

Browse files
author
Tilmann Scheller
committed
Fix old-style function definitions and enable warning.
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
1 parent a2a160d commit e99e41c

File tree

13 files changed

+13
-13
lines changed

13 files changed

+13
-13
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ jerry_add_compile_flags(-fno-stack-protector)
179179
endif()
180180

181181
if (USING_GCC OR USING_CLANG)
182-
jerry_add_compile_warnings(all extra format-nonliteral init-self conversion sign-conversion format-security missing-declarations shadow strict-prototypes undef)
182+
jerry_add_compile_warnings(all extra format-nonliteral init-self conversion sign-conversion format-security missing-declarations shadow strict-prototypes undef old-style-definition)
183183
jerry_add_compile_flags(-Wno-stack-protector -Wno-attributes)
184184
endif()
185185

docs/05.PORT-API.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ bool jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
196196
/**
197197
* Default implementation of jerry_port_get_current_time.
198198
*/
199-
double jerry_port_get_current_time ()
199+
double jerry_port_get_current_time (void)
200200
{
201201
struct timeval tv;
202202

jerry-core/debugger/jerry-debugger-ws.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ jerry_process_handshake (int client_socket, /**< client socket */
311311
* false - otherwise
312312
*/
313313
bool
314-
jerry_debugger_accept_connection ()
314+
jerry_debugger_accept_connection (void)
315315
{
316316
int server_socket;
317317
struct sockaddr_in addr;

jerry-core/jmem/jmem-allocator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jmem_init (void)
3737
* Finalize memory allocators.
3838
*/
3939
void
40-
jmem_finalize ()
40+
jmem_finalize (void)
4141
{
4242
jmem_pools_finalize ();
4343

jerry-core/jmem/jmem-poolman.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ jmem_pools_free (void *chunk_p, /**< pointer to the chunk */
191191
* Collect empty pool chunks
192192
*/
193193
void
194-
jmem_pools_collect_empty ()
194+
jmem_pools_collect_empty (void)
195195
{
196196
jmem_pools_chunk_t *chunk_p = JERRY_CONTEXT (jmem_free_8_byte_chunk_p);
197197
JERRY_CONTEXT (jmem_free_8_byte_chunk_p) = NULL;

jerry-core/parser/regexp/re-compiler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ re_find_bytecode_in_cache (ecma_string_t *pattern_str_p, /**< pattern string */
488488
* Run gerbage collection in RegExp cache
489489
*/
490490
void
491-
re_cache_gc_run ()
491+
re_cache_gc_run (void)
492492
{
493493
for (uint32_t i = 0u; i < RE_CACHE_SIZE; i++)
494494
{

targets/curie_bsp/source/curie-bsp-port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ bool jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
8484
/**
8585
* Curie BSP implementation of jerry_port_get_current_time.
8686
*/
87-
double jerry_port_get_current_time ()
87+
double jerry_port_get_current_time (void)
8888
{
8989
uint32_t uptime_ms = get_uptime_ms ();
9090
uint32_t epoch_time = uptime_to_epoch (uptime_ms);

targets/default/jerry-port-default-date.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ bool jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
5050
/**
5151
* Default implementation of jerry_port_get_current_time.
5252
*/
53-
double jerry_port_get_current_time ()
53+
double jerry_port_get_current_time (void)
5454
{
5555
#ifdef __GNUC__
5656
struct timeval tv;

targets/default/jerry-port-default-fatal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void jerry_port_default_set_abort_on_fail (bool flag) /**< new value of 'abort o
3636
* @return true - if 'abort on fail' flag is set,
3737
* false - otherwise.
3838
*/
39-
bool jerry_port_default_is_abort_on_fail ()
39+
bool jerry_port_default_is_abort_on_fail (void)
4040
{
4141
return abort_on_fail;
4242
} /* jerry_port_default_is_abort_on_fail */

targets/mbed/source/port/jerry_port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jerry_port_get_time_zone (jerry_time_zone_t *tz_p) /**< timezone pointer */
7979
* @return current timer's counter value in microseconds
8080
*/
8181
double
82-
jerry_port_get_current_time ()
82+
jerry_port_get_current_time (void)
8383
{
8484
return (double) us_ticker_read ();
8585
} /* jerry_port_get_current_time */

0 commit comments

Comments
 (0)