diff options
| author | Pavel Platto <hinidu@gmail.com> | 2014-07-13 10:03:07 +0300 |
|---|---|---|
| committer | Nicolas Hillegeer <nicolas@hillegeer.com> | 2014-07-14 20:28:40 +0200 |
| commit | 47084ea7657121837536d409b9137fd38426aeef (patch) | |
| tree | 1bf014cf8e25a6875bc49328deafbfc9f5e0ef88 /src/nvim/os | |
| parent | 2dc69700ec9a01b3b7cd4823e8cd3ad5431b9410 (diff) | |
| download | rneovim-47084ea7657121837536d409b9137fd38426aeef.tar.gz rneovim-47084ea7657121837536d409b9137fd38426aeef.tar.bz2 rneovim-47084ea7657121837536d409b9137fd38426aeef.zip | |
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.
Diffstat (limited to 'src/nvim/os')
| -rw-r--r-- | src/nvim/os/channel.c | 6 | ||||
| -rw-r--r-- | src/nvim/os/dl.c | 2 | ||||
| -rw-r--r-- | src/nvim/os/env.c | 2 | ||||
| -rw-r--r-- | src/nvim/os/event.c | 6 | ||||
| -rw-r--r-- | src/nvim/os/input.c | 14 | ||||
| -rw-r--r-- | src/nvim/os/job.c | 4 | ||||
| -rw-r--r-- | src/nvim/os/server.c | 4 | ||||
| -rw-r--r-- | src/nvim/os/signal.c | 8 | ||||
| -rw-r--r-- | src/nvim/os/time.c | 2 |
9 files changed, 24 insertions, 24 deletions
diff --git a/src/nvim/os/channel.c b/src/nvim/os/channel.c index 14293d71e5..504c1ca05b 100644 --- a/src/nvim/os/channel.c +++ b/src/nvim/os/channel.c @@ -56,7 +56,7 @@ static msgpack_sbuffer out_buffer; #endif /// Initializes the module -void channel_init() +void channel_init(void) { channels = pmap_new(uint64_t)(); event_strings = pmap_new(cstr_t)(); @@ -64,7 +64,7 @@ void channel_init() } /// Teardown the module -void channel_teardown() +void channel_teardown(void) { if (!channels) { return; @@ -470,7 +470,7 @@ static void close_cb(uv_handle_t *handle) free(handle); } -static Channel *register_channel() +static Channel *register_channel(void) { Channel *rv = xmalloc(sizeof(Channel)); rv->enabled = true; diff --git a/src/nvim/os/dl.c b/src/nvim/os/dl.c index e7a957a3aa..b4a35e203e 100644 --- a/src/nvim/os/dl.c +++ b/src/nvim/os/dl.c @@ -13,7 +13,7 @@ /// int -> string /// string -> string /// string -> int -typedef void (*gen_fn)(); +typedef void (*gen_fn)(void); typedef const char *(*str_str_fn)(const char *str); typedef int64_t (*str_int_fn)(const char *str); typedef const char *(*int_str_fn)(int64_t i); diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index 3e66a019b3..3aefbc39d1 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -55,7 +55,7 @@ char *os_getenvname_at_index(size_t index) /// Get the process ID of the Neovim process. /// /// @return the process ID. -int64_t os_get_pid() +int64_t os_get_pid(void) { #ifdef _WIN32 return (int64_t)GetCurrentProcessId(); diff --git a/src/nvim/os/event.c b/src/nvim/os/event.c index a9e97c9190..4e091716b2 100644 --- a/src/nvim/os/event.c +++ b/src/nvim/os/event.c @@ -33,7 +33,7 @@ typedef struct { #endif static klist_t(Event) *deferred_events, *immediate_events; -void event_init() +void event_init(void) { // Initialize the event queues deferred_events = kl_init(Event); @@ -52,7 +52,7 @@ void event_init() server_init(); } -void event_teardown() +void event_teardown(void) { channel_teardown(); job_teardown(); @@ -122,7 +122,7 @@ bool event_poll(int32_t ms) return !timer_data.timed_out && (events_processed || event_has_deferred()); } -bool event_has_deferred() +bool event_has_deferred(void) { return !kl_empty(get_queue(true)); } diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c index 504aeafbc1..58bdf0cf52 100644 --- a/src/nvim/os/input.c +++ b/src/nvim/os/input.c @@ -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; } diff --git a/src/nvim/os/job.c b/src/nvim/os/job.c index dcf50243a9..d2f9c10981 100644 --- a/src/nvim/os/job.c +++ b/src/nvim/os/job.c @@ -65,14 +65,14 @@ static uv_prepare_t job_prepare; // Callbacks for libuv /// Initializes job control resources -void job_init() +void job_init(void) { uv_disable_stdio_inheritance(); uv_prepare_init(uv_default_loop(), &job_prepare); } /// Releases job control resources and terminates running jobs -void job_teardown() +void job_teardown(void) { // 20 tries will give processes about 1 sec to exit cleanly uint32_t remaining_tries = 20; diff --git a/src/nvim/os/server.c b/src/nvim/os/server.c index 9adc867cd0..23f9393122 100644 --- a/src/nvim/os/server.c +++ b/src/nvim/os/server.c @@ -47,7 +47,7 @@ static PMap(cstr_t) *servers = NULL; #endif /// Initializes the module -void server_init() +void server_init(void) { servers = pmap_new(cstr_t)(); @@ -61,7 +61,7 @@ void server_init() } /// Teardown the server module -void server_teardown() +void server_teardown(void) { if (!servers) { return; diff --git a/src/nvim/os/signal.c b/src/nvim/os/signal.c index c7b4f86d6f..65657fda9c 100644 --- a/src/nvim/os/signal.c +++ b/src/nvim/os/signal.c @@ -26,7 +26,7 @@ static bool rejecting_deadly; #ifdef INCLUDE_GENERATED_DECLARATIONS # include "os/signal.c.generated.h" #endif -void signal_init() +void signal_init(void) { uv_signal_init(uv_default_loop(), &sint); uv_signal_init(uv_default_loop(), &spipe); @@ -46,7 +46,7 @@ void signal_init() #endif } -void signal_stop() +void signal_stop(void) { uv_signal_stop(&sint); uv_signal_stop(&spipe); @@ -59,12 +59,12 @@ void signal_stop() #endif } -void signal_reject_deadly() +void signal_reject_deadly(void) { rejecting_deadly = true; } -void signal_accept_deadly() +void signal_accept_deadly(void) { rejecting_deadly = false; } diff --git a/src/nvim/os/time.c b/src/nvim/os/time.c index 977a4f19c4..90a17aa513 100644 --- a/src/nvim/os/time.c +++ b/src/nvim/os/time.c @@ -16,7 +16,7 @@ static uv_cond_t delay_cond; # include "os/time.c.generated.h" #endif /// Initializes the time module -void time_init() +void time_init(void) { uv_mutex_init(&delay_mutex); uv_cond_init(&delay_cond); |