From 47084ea7657121837536d409b9137fd38426aeef Mon Sep 17 00:00:00 2001 From: Pavel Platto Date: Sun, 13 Jul 2014 10:03:07 +0300 Subject: 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. --- src/nvim/api/private/handle.c | 2 +- src/nvim/api/private/helpers.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/api') diff --git a/src/nvim/api/private/handle.c b/src/nvim/api/private/handle.c index 4c0b01ddd7..abbda95073 100644 --- a/src/nvim/api/private/handle.c +++ b/src/nvim/api/private/handle.c @@ -33,7 +33,7 @@ HANDLE_IMPL(buf_T, buffer) HANDLE_IMPL(win_T, window) HANDLE_IMPL(tabpage_T, tabpage) -void handle_init() +void handle_init(void) { HANDLE_INIT(buffer); HANDLE_INIT(window); diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index 839a06c29f..354a74d19a 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -22,7 +22,7 @@ #endif /// Start block that may cause vimscript exceptions -void try_start() +void try_start(void) { ++trylevel; } -- cgit