Use strict function prototypes #945

`-Wstrict-prototypes` warn if a function is declared or defined without
specifying the argument types.

This warning disallow function prototypes with empty parameter list.
In C, a function declared with an empty parameter list accepts an
arbitrary number of arguments when being called. This is for historic
reasons; originally, C functions didn't have prototypes, as C evolved
from B, a typeless language. When prototypes were added, the original
typeless declarations were left in the language for backwards
compatibility.
Instead we should provide `void` in argument list to state
that function doesn't have arguments.

Also this warning disallow declaring type of the parameters after the
parentheses because Neovim header generator produce no declarations for
old-stlyle prototypes: it expects to find `{` after prototype.
This commit is contained in:
Pavel Platto
2014-07-13 10:03:07 +03:00
committed by Nicolas Hillegeer
parent 2dc69700ec
commit 47084ea765
24 changed files with 115 additions and 126 deletions

View File

@@ -32,20 +32,20 @@ static bool eof = false, started_reading = false;
// Helper function used to push bytes from the 'event' key sequence partially
// between calls to os_inchar when maxlen < 3
void input_init()
void input_init(void)
{
read_stream = rstream_new(read_cb, READ_BUFFER_SIZE, NULL, false);
rstream_set_file(read_stream, read_cmd_fd);
}
// Listen for input
void input_start()
void input_start(void)
{
rstream_start(read_stream);
}
// Stop listening for input
void input_stop()
void input_stop(void)
{
rstream_stop(read_stream);
}
@@ -105,14 +105,14 @@ int os_inchar(uint8_t *buf, int maxlen, int32_t ms, int tb_change_cnt)
}
// Check if a character is available for reading
bool os_char_avail()
bool os_char_avail(void)
{
return inbuf_poll(0) == kInputAvail;
}
// Check for CTRL-C typed by reading all available characters.
// In cooked mode we should get SIGINT, no need to check.
void os_breakcheck()
void os_breakcheck(void)
{
if (curr_tmode == TMODE_RAW && input_poll(0))
fill_input_buf(false);
@@ -148,7 +148,7 @@ static InbufPollResult inbuf_poll(int32_t ms)
return kInputNone;
}
static void stderr_switch()
static void stderr_switch(void)
{
int mode = cur_tmode;
// We probably set the wrong file descriptor to raw mode. Switch back to
@@ -198,7 +198,7 @@ static int push_event_key(uint8_t *buf, int maxlen)
}
// Check if there's pending input
bool input_ready()
bool input_ready(void)
{
return rstream_available(read_stream) > 0 || eof;
}