mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 16:58:17 +00:00
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:

committed by
Nicolas Hillegeer

parent
2dc69700ec
commit
47084ea765
@@ -104,7 +104,7 @@ void mch_write(char_u *s, int len)
|
||||
* If the machine has job control, use it to suspend the program,
|
||||
* otherwise fake it by starting a new shell.
|
||||
*/
|
||||
void mch_suspend()
|
||||
void mch_suspend(void)
|
||||
{
|
||||
/* BeOS does have SIGTSTP, but it doesn't work. */
|
||||
#if defined(SIGTSTP) && !defined(__BEOS__)
|
||||
@@ -148,7 +148,7 @@ void mch_suspend()
|
||||
#endif
|
||||
}
|
||||
|
||||
void mch_init()
|
||||
void mch_init(void)
|
||||
{
|
||||
Columns = 80;
|
||||
Rows = 24;
|
||||
@@ -179,12 +179,12 @@ static int get_x11_icon(int test_only)
|
||||
}
|
||||
|
||||
|
||||
int mch_can_restore_title()
|
||||
int mch_can_restore_title(void)
|
||||
{
|
||||
return get_x11_title(TRUE);
|
||||
}
|
||||
|
||||
int mch_can_restore_icon()
|
||||
int mch_can_restore_icon(void)
|
||||
{
|
||||
return get_x11_icon(TRUE);
|
||||
}
|
||||
@@ -292,7 +292,7 @@ int use_xterm_like_mouse(char_u *name)
|
||||
* Return 3 for "urxvt".
|
||||
* Return 4 for "sgr".
|
||||
*/
|
||||
int use_xterm_mouse()
|
||||
int use_xterm_mouse(void)
|
||||
{
|
||||
if (ttym_flags == TTYM_SGR)
|
||||
return 4;
|
||||
@@ -506,14 +506,15 @@ int mch_nodetype(char_u *name)
|
||||
return NODE_WRITABLE;
|
||||
}
|
||||
|
||||
void mch_early_init()
|
||||
void mch_early_init(void)
|
||||
{
|
||||
handle_init();
|
||||
time_init();
|
||||
}
|
||||
|
||||
#if defined(EXITFREE) || defined(PROTO)
|
||||
void mch_free_mem() {
|
||||
void mch_free_mem(void)
|
||||
{
|
||||
free(oldtitle);
|
||||
free(oldicon);
|
||||
}
|
||||
@@ -525,7 +526,7 @@ void mch_free_mem() {
|
||||
* Output a newline when exiting.
|
||||
* Make sure the newline goes to the same stream as the text.
|
||||
*/
|
||||
static void exit_scroll()
|
||||
static void exit_scroll(void)
|
||||
{
|
||||
if (silent_mode)
|
||||
return;
|
||||
@@ -691,7 +692,7 @@ void mch_settmode(int tmode)
|
||||
* be), they're going to get really annoyed if their erase key starts
|
||||
* doing forward deletes for no reason. (Eric Fischer)
|
||||
*/
|
||||
void get_stty()
|
||||
void get_stty(void)
|
||||
{
|
||||
char_u buf[2];
|
||||
char_u *p;
|
||||
@@ -788,7 +789,7 @@ void mch_setmouse(int on)
|
||||
/*
|
||||
* Set the mouse termcode, depending on the 'term' and 'ttymouse' options.
|
||||
*/
|
||||
void check_mouse_termcode()
|
||||
void check_mouse_termcode(void)
|
||||
{
|
||||
if (use_xterm_mouse()
|
||||
&& use_xterm_mouse() != 3
|
||||
@@ -860,7 +861,7 @@ void check_mouse_termcode()
|
||||
* 4. keep using the old values
|
||||
* Return OK when size could be determined, FAIL otherwise.
|
||||
*/
|
||||
int mch_get_shellsize()
|
||||
int mch_get_shellsize(void)
|
||||
{
|
||||
long rows = 0;
|
||||
long columns = 0;
|
||||
@@ -937,7 +938,7 @@ int mch_get_shellsize()
|
||||
/*
|
||||
* Try to set the window size to Rows and Columns.
|
||||
*/
|
||||
void mch_set_shellsize()
|
||||
void mch_set_shellsize(void)
|
||||
{
|
||||
if (*T_CWS) {
|
||||
/*
|
||||
|
Reference in New Issue
Block a user