From 69bb145cea56067e6e82ed0a130a51c0d611e540 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 4 Feb 2023 20:14:31 +0800 Subject: refactor(exit): pass error message to preserve_exit() (#22097) Problem: 1. Some calls to preserve_exit() don't put a message in IObuff, so the IObuff printed by preserve_exit() contains unrelated information. 2. If a TUI client runs out of memory or receives a deadly signal, the error message is shown on alternate screen and cannot be easily seen because the TUI exits alternate screen soon afterwards. Solution: Pass error message to preserve_exit() and exit alternate screen before printing it. Note that this doesn't fix the problem that server error messages cannot be easily seen on exit. This is tracked in #21608 and #21843. --- src/nvim/event/rstream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/rstream.c b/src/nvim/event/rstream.c index a88d62fd6b..a145452afd 100644 --- a/src/nvim/event/rstream.c +++ b/src/nvim/event/rstream.c @@ -155,7 +155,7 @@ static void fread_idle_cb(uv_idle_t *handle) uintmax_t fpos_intmax = stream->fpos; if (fpos_intmax > INT64_MAX) { ELOG("stream offset overflow"); - preserve_exit(); + preserve_exit("stream offset overflow"); } // Synchronous read -- cgit From 7d58de11f49c574a8a305e28e96b9ff810493012 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 11 Feb 2023 18:25:01 +0800 Subject: fix(rpc)!: preseve files when stdio channel is closed (#22137) BREAKING CHANGE: Unsaved changes are now preserved rather than discarded when stdio channel is closed. --- src/nvim/event/process.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c index 1a524a56ca..1219566e9b 100644 --- a/src/nvim/event/process.c +++ b/src/nvim/event/process.c @@ -422,7 +422,12 @@ static void exit_event(void **argv) } if (!exiting) { - os_exit(status); + if (ui_client_channel_id) { + os_exit(status); + } else { + assert(status == 0); // Called from rpc_close(), which passes 0 as status. + preserve_exit(NULL); + } } } -- cgit From 5bad9afed2189f3716865da42c66133d1f6da218 Mon Sep 17 00:00:00 2001 From: ii14 Date: Thu, 16 Mar 2023 18:13:58 +0100 Subject: build: sanitizers for gcc GCC also supports sanitizers. GCC doesn't support -fsanitize-blacklist option though, so replace .asan-blacklist file with no_sanitize_address function attributes instead. --- src/nvim/event/multiqueue.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/event') diff --git a/src/nvim/event/multiqueue.c b/src/nvim/event/multiqueue.c index e05084b656..8f8a36eff9 100644 --- a/src/nvim/event/multiqueue.c +++ b/src/nvim/event/multiqueue.c @@ -245,6 +245,7 @@ static void multiqueue_push(MultiQueue *this, Event event) } static MultiQueueItem *multiqueue_node_data(QUEUE *q) + FUNC_ATTR_NO_SANITIZE_ADDRESS { return QUEUE_DATA(q, MultiQueueItem, node); } -- cgit From 7190dba017e3aac0409c73ff1c954d18858cb3c9 Mon Sep 17 00:00:00 2001 From: ii14 <59243201+ii14@users.noreply.github.com> Date: Thu, 6 Apr 2023 22:39:50 +0200 Subject: refactor: remove use of reserved c++ keywords libnvim couldn't be easily used in C++ due to the use of reserved keywords. Additionally, add explicit casts to *alloc function calls used in inline functions, as C++ doesn't allow implicit casts from void pointers. --- src/nvim/event/multiqueue.c | 78 ++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/multiqueue.c b/src/nvim/event/multiqueue.c index 8f8a36eff9..0096d0e11e 100644 --- a/src/nvim/event/multiqueue.c +++ b/src/nvim/event/multiqueue.c @@ -112,13 +112,13 @@ static MultiQueue *multiqueue_new(MultiQueue *parent, PutCallback put_cb, void * return rv; } -void multiqueue_free(MultiQueue *this) +void multiqueue_free(MultiQueue *self) { - assert(this); + assert(self); QUEUE *q; - QUEUE_FOREACH(q, &this->headtail, { + QUEUE_FOREACH(q, &self->headtail, { MultiQueueItem *item = multiqueue_node_data(q); - if (this->parent) { + if (self->parent) { QUEUE_REMOVE(&item->data.item.parent_item->node); xfree(item->data.item.parent_item); } @@ -126,29 +126,29 @@ void multiqueue_free(MultiQueue *this) xfree(item); }) - xfree(this); + xfree(self); } /// Removes the next item and returns its Event. -Event multiqueue_get(MultiQueue *this) +Event multiqueue_get(MultiQueue *self) { - return multiqueue_empty(this) ? NILEVENT : multiqueue_remove(this); + return multiqueue_empty(self) ? NILEVENT : multiqueue_remove(self); } -void multiqueue_put_event(MultiQueue *this, Event event) +void multiqueue_put_event(MultiQueue *self, Event event) { - assert(this); - multiqueue_push(this, event); - if (this->parent && this->parent->put_cb) { - this->parent->put_cb(this->parent, this->parent->data); + assert(self); + multiqueue_push(self, event); + if (self->parent && self->parent->put_cb) { + self->parent->put_cb(self->parent, self->parent->data); } } -void multiqueue_process_events(MultiQueue *this) +void multiqueue_process_events(MultiQueue *self) { - assert(this); - while (!multiqueue_empty(this)) { - Event event = multiqueue_remove(this); + assert(self); + while (!multiqueue_empty(self)) { + Event event = multiqueue_remove(self); if (event.handler) { event.handler(event.argv); } @@ -156,30 +156,30 @@ void multiqueue_process_events(MultiQueue *this) } /// Removes all events without processing them. -void multiqueue_purge_events(MultiQueue *this) +void multiqueue_purge_events(MultiQueue *self) { - assert(this); - while (!multiqueue_empty(this)) { - (void)multiqueue_remove(this); + assert(self); + while (!multiqueue_empty(self)) { + (void)multiqueue_remove(self); } } -bool multiqueue_empty(MultiQueue *this) +bool multiqueue_empty(MultiQueue *self) { - assert(this); - return QUEUE_EMPTY(&this->headtail); + assert(self); + return QUEUE_EMPTY(&self->headtail); } -void multiqueue_replace_parent(MultiQueue *this, MultiQueue *new_parent) +void multiqueue_replace_parent(MultiQueue *self, MultiQueue *new_parent) { - assert(multiqueue_empty(this)); - this->parent = new_parent; + assert(multiqueue_empty(self)); + self->parent = new_parent; } /// Gets the count of all events currently in the queue. -size_t multiqueue_size(MultiQueue *this) +size_t multiqueue_size(MultiQueue *self) { - return this->size; + return self->size; } /// Gets an Event from an item. @@ -213,35 +213,35 @@ static Event multiqueueitem_get_event(MultiQueueItem *item, bool remove) return ev; } -static Event multiqueue_remove(MultiQueue *this) +static Event multiqueue_remove(MultiQueue *self) { - assert(!multiqueue_empty(this)); - QUEUE *h = QUEUE_HEAD(&this->headtail); + assert(!multiqueue_empty(self)); + QUEUE *h = QUEUE_HEAD(&self->headtail); QUEUE_REMOVE(h); MultiQueueItem *item = multiqueue_node_data(h); - assert(!item->link || !this->parent); // Only a parent queue has link-nodes + assert(!item->link || !self->parent); // Only a parent queue has link-nodes Event ev = multiqueueitem_get_event(item, true); - this->size--; + self->size--; xfree(item); return ev; } -static void multiqueue_push(MultiQueue *this, Event event) +static void multiqueue_push(MultiQueue *self, Event event) { MultiQueueItem *item = xmalloc(sizeof(MultiQueueItem)); item->link = false; item->data.item.event = event; item->data.item.parent_item = NULL; - QUEUE_INSERT_TAIL(&this->headtail, &item->node); - if (this->parent) { + QUEUE_INSERT_TAIL(&self->headtail, &item->node); + if (self->parent) { // push link node to the parent queue item->data.item.parent_item = xmalloc(sizeof(MultiQueueItem)); item->data.item.parent_item->link = true; - item->data.item.parent_item->data.queue = this; - QUEUE_INSERT_TAIL(&this->parent->headtail, + item->data.item.parent_item->data.queue = self; + QUEUE_INSERT_TAIL(&self->parent->headtail, &item->data.item.parent_item->node); } - this->size++; + self->size++; } static MultiQueueItem *multiqueue_node_data(QUEUE *q) -- cgit From 6a273af10517d1f7e4ea85635f1d25a9158adeb5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 13 May 2023 10:40:53 +0800 Subject: refactor: remove typval.h from most header files (#23601) Because typval_defs.h is enough for most of them. --- src/nvim/event/process.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/process.h b/src/nvim/event/process.h index e0057faffb..39fed08c77 100644 --- a/src/nvim/event/process.h +++ b/src/nvim/event/process.h @@ -5,7 +5,6 @@ #include #include -#include "nvim/eval/typval.h" #include "nvim/eval/typval_defs.h" #include "nvim/event/loop.h" #include "nvim/event/multiqueue.h" -- cgit From 2f17ef1fc4b96cf1106fd95ba090d34a2e4b977b Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 22 Jun 2023 04:09:14 -0700 Subject: fix(messages): use "Vimscript" instead of "VimL" #24111 followup to #24109 fix #16150 --- src/nvim/event/multiqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/multiqueue.c b/src/nvim/event/multiqueue.c index 0096d0e11e..262d141b26 100644 --- a/src/nvim/event/multiqueue.c +++ b/src/nvim/event/multiqueue.c @@ -40,7 +40,7 @@ // // The main reason for this queue hierarchy is to allow focusing on a single // event emitter while blocking the main loop. For example, if the `jobwait` -// VimL function is called on job1, the main loop will temporarily stop polling +// Vimscript function is called on job1, the main loop will temporarily stop polling // the event loop queue and poll job1 queue instead. Same with channels, when // calling `rpcrequest` we want to temporarily stop processing events from // other sources and focus on a specific channel. -- cgit From 559c4cfd52e385c1b9bd5fa66a0eeb7e8d9e018a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 8 Jul 2023 08:27:39 +0800 Subject: fix(startup): run embedded Nvim with real path (#24282) fix(startup): run embedded process with real path --- src/nvim/event/libuv_process.c | 2 +- src/nvim/event/process.c | 2 +- src/nvim/event/process.h | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index e528d21a71..1bb0511f12 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -24,7 +24,7 @@ int libuv_process_spawn(LibuvProcess *uvproc) FUNC_ATTR_NONNULL_ALL { Process *proc = (Process *)uvproc; - uvproc->uvopts.file = proc->argv[0]; + uvproc->uvopts.file = process_get_exepath(proc); uvproc->uvopts.args = proc->argv; uvproc->uvopts.flags = UV_PROCESS_WINDOWS_HIDE; #ifdef MSWIN diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c index 1219566e9b..95bf4d1c3b 100644 --- a/src/nvim/event/process.c +++ b/src/nvim/event/process.c @@ -131,7 +131,7 @@ int process_spawn(Process *proc, bool in, bool out, bool err) proc->internal_close_cb = decref; proc->refcount++; kl_push(WatcherPtr, proc->loop->children, proc); - DLOG("new: pid=%d argv=[%s]", proc->pid, proc->argv[0]); + DLOG("new: pid=%d exepath=[%s]", proc->pid, process_get_exepath(proc)); return 0; } diff --git a/src/nvim/event/process.h b/src/nvim/event/process.h index 39fed08c77..69fe229b0e 100644 --- a/src/nvim/event/process.h +++ b/src/nvim/event/process.h @@ -32,6 +32,7 @@ struct process { uint64_t stopped_time; // process_stop() timestamp const char *cwd; char **argv; + const char *exepath; dict_T *env; Stream in, out, err; /// Exit handler. If set, user must call process_free(). @@ -54,6 +55,7 @@ static inline Process process_init(Loop *loop, ProcessType type, void *data) .stopped_time = 0, .cwd = NULL, .argv = NULL, + .exepath = NULL, .in = { .closed = false }, .out = { .closed = false }, .err = { .closed = false }, @@ -66,6 +68,12 @@ static inline Process process_init(Loop *loop, ProcessType type, void *data) }; } +/// Get the path to the executable of the process. +static inline const char *process_get_exepath(Process *proc) +{ + return proc->exepath != NULL ? proc->exepath : proc->argv[0]; +} + static inline bool process_is_stopped(Process *proc) { bool exited = (proc->status >= 0); -- cgit From 911f3d962358bb032b55e9984d0b25ffc522ff49 Mon Sep 17 00:00:00 2001 From: bfredl Date: Thu, 21 Sep 2023 10:18:37 +0200 Subject: fix(tui): don't overwrite an assertion faliure message on exit If nvim exited with nonzero status this is for one of the two reasons - `:cquit` was invoked. This is used by users and plugins to communicate a result, like a nonzero status will fail a `git commit` operation - There was an internal error or deadly signal. in this case an error message was likely written to stderr or to the screen. In the latter case, the error message was often hidden by the TUI exiting altscreen mode, which erases all visible terminal text. This change prevents this in the latter case, while still cleaning up the terminal properly when `:cquit` was deliberatily invoked. Other cleanup like exiting mouse mode and raw mode is still done. --- src/nvim/event/process.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/event') diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c index 95bf4d1c3b..00ba1334b0 100644 --- a/src/nvim/event/process.c +++ b/src/nvim/event/process.c @@ -423,6 +423,7 @@ static void exit_event(void **argv) if (!exiting) { if (ui_client_channel_id) { + ui_client_exit_status = status; os_exit(status); } else { assert(status == 0); // Called from rpc_close(), which passes 0 as status. -- cgit From 9ff6f73f838a1f90d09922448c434033ba5e094e Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Mon, 9 Oct 2023 00:36:48 +0600 Subject: refactor: allow not having a `default` case for enum Problem: The style guide states that all switch statements that are not conditional on an enum must have a `default` case, but does not give any explicit guideline for switch statements that are conditional on enums. As a result, a `default` case is added in many enum switch statements, even when the switch statement is exhaustive. This is not ideal because it removes the ability to have compiler errors to easily detect unchanged switch statements when a new possible value for an enum is added. Solution: Add explicit guidelines for switch statements that are conditional on an enum, clarifying that a `default` case is not necessary if the switch statement is exhaustive. Also refactor pre-existing code with unnecessary `default` cases. --- src/nvim/event/process.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c index 00ba1334b0..d612b503a7 100644 --- a/src/nvim/event/process.c +++ b/src/nvim/event/process.c @@ -78,8 +78,6 @@ int process_spawn(Process *proc, bool in, bool out, bool err) case kProcessTypePty: status = pty_process_spawn((PtyProcess *)proc); break; - default: - abort(); } if (status) { @@ -239,8 +237,6 @@ void process_stop(Process *proc) FUNC_ATTR_NONNULL_ALL process_close_streams(proc); pty_process_close_master((PtyProcess *)proc); break; - default: - abort(); } // (Re)start timer to verify that stopped process(es) died. @@ -340,8 +336,6 @@ static void process_close(Process *proc) case kProcessTypePty: pty_process_close((PtyProcess *)proc); break; - default: - abort(); } } -- cgit From 5f03a1eaabfc8de2b3a9c666fcd604763f41e152 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 20 Oct 2023 15:10:33 +0200 Subject: build(lint): remove unnecessary clint.py rules Uncrustify is the source of truth where possible. Remove any redundant checks from clint.py. --- src/nvim/event/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c index 10756015ad..52a3c81449 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -224,7 +224,7 @@ bool socket_connect(Loop *loop, Stream *stream, bool is_tcp, const char *address const struct addrinfo hints = { .ai_family = AF_UNSPEC, .ai_socktype = SOCK_STREAM, - .ai_flags = AI_NUMERICSERV }; + .ai_flags = AI_NUMERICSERV }; int retval = uv_getaddrinfo(&loop->uv, &addr_req, NULL, addr, host_end + 1, &hints); if (retval != 0) { -- cgit From 353a4be7e84fdc101318215bdcc8a7e780d737fe Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 12 Nov 2023 13:13:58 +0100 Subject: build: remove PVS We already have an extensive suite of static analysis tools we use, which causes a fair bit of redundancy as we get duplicate warnings. PVS is also prone to give false warnings which creates a lot of work to identify and disable. --- src/nvim/event/libuv_process.c | 12 +++--------- src/nvim/event/loop.c | 9 +++------ src/nvim/event/loop.h | 2 -- src/nvim/event/multiqueue.c | 3 --- src/nvim/event/process.c | 14 ++++---------- src/nvim/event/rstream.c | 3 --- src/nvim/event/signal.c | 3 --- src/nvim/event/socket.c | 22 +++++++++------------- src/nvim/event/stream.c | 12 ++++-------- src/nvim/event/time.c | 3 --- src/nvim/event/wstream.c | 3 --- 11 files changed, 23 insertions(+), 63 deletions(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index 1bb0511f12..73dec2bcab 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - #include #include #include @@ -68,8 +65,7 @@ int libuv_process_spawn(LibuvProcess *uvproc) #ifdef MSWIN uvproc->uvstdio[0].flags |= proc->overlapped ? UV_OVERLAPPED_PIPE : 0; #endif - uvproc->uvstdio[0].data.stream = STRUCT_CAST(uv_stream_t, - &proc->in.uv.pipe); + uvproc->uvstdio[0].data.stream = (uv_stream_t *)(&proc->in.uv.pipe); } if (!proc->out.closed) { @@ -79,14 +75,12 @@ int libuv_process_spawn(LibuvProcess *uvproc) uvproc->uvstdio[1].flags |= proc->overlapped ? (UV_READABLE_PIPE | UV_OVERLAPPED_PIPE) : 0; #endif - uvproc->uvstdio[1].data.stream = STRUCT_CAST(uv_stream_t, - &proc->out.uv.pipe); + uvproc->uvstdio[1].data.stream = (uv_stream_t *)(&proc->out.uv.pipe); } if (!proc->err.closed) { uvproc->uvstdio[2].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; - uvproc->uvstdio[2].data.stream = STRUCT_CAST(uv_stream_t, - &proc->err.uv.pipe); + uvproc->uvstdio[2].data.stream = (uv_stream_t *)(&proc->err.uv.pipe); } else if (proc->fwd_err) { uvproc->uvstdio[2].flags = UV_INHERIT_FD; uvproc->uvstdio[2].data.fd = STDERR_FILENO; diff --git a/src/nvim/event/loop.c b/src/nvim/event/loop.c index ab2524c1a9..3d74fe7d6d 100644 --- a/src/nvim/event/loop.c +++ b/src/nvim/event/loop.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - #include #include #include @@ -61,9 +58,9 @@ bool loop_uv_run(Loop *loop, int64_t ms, bool once) mode = UV_RUN_NOWAIT; } - do { // -V1044 + do { uv_run(&loop->uv, mode); - } while (ms > 0 && !once && !*timeout_expired); // -V560 + } while (ms > 0 && !once && !*timeout_expired); if (ms > 0) { uv_timer_stop(&loop->poll_timer); @@ -163,7 +160,7 @@ bool loop_close(Loop *loop, bool wait) while (true) { // Run the loop to tickle close-callbacks (which should then free memory). // Use UV_RUN_NOWAIT to avoid a hang. #11820 - uv_run(&loop->uv, didstop ? UV_RUN_DEFAULT : UV_RUN_NOWAIT); // -V547 + uv_run(&loop->uv, didstop ? UV_RUN_DEFAULT : UV_RUN_NOWAIT); if ((uv_loop_close(&loop->uv) != UV_EBUSY) || !wait) { break; } diff --git a/src/nvim/event/loop.h b/src/nvim/event/loop.h index b2265a726d..7b4b724359 100644 --- a/src/nvim/event/loop.h +++ b/src/nvim/event/loop.h @@ -53,8 +53,6 @@ typedef struct loop { } \ } while (0) -// -V:LOOP_PROCESS_EVENTS_UNTIL:547 - // Poll for events until a condition or timeout #define LOOP_PROCESS_EVENTS_UNTIL(loop, multiqueue, timeout, condition) \ do { \ diff --git a/src/nvim/event/multiqueue.c b/src/nvim/event/multiqueue.c index 262d141b26..328fa68806 100644 --- a/src/nvim/event/multiqueue.c +++ b/src/nvim/event/multiqueue.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - // Multi-level queue for selective async event processing. // Not threadsafe; access must be synchronized externally. // diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c index d612b503a7..a6646c3a7f 100644 --- a/src/nvim/event/process.c +++ b/src/nvim/event/process.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - #include #include #include @@ -102,24 +99,21 @@ int process_spawn(Process *proc, bool in, bool out, bool err) } if (in) { - stream_init(NULL, &proc->in, -1, - STRUCT_CAST(uv_stream_t, &proc->in.uv.pipe)); + stream_init(NULL, &proc->in, -1, (uv_stream_t *)&proc->in.uv.pipe); proc->in.internal_data = proc; proc->in.internal_close_cb = on_process_stream_close; proc->refcount++; } if (out) { - stream_init(NULL, &proc->out, -1, - STRUCT_CAST(uv_stream_t, &proc->out.uv.pipe)); + stream_init(NULL, &proc->out, -1, (uv_stream_t *)&proc->out.uv.pipe); proc->out.internal_data = proc; proc->out.internal_close_cb = on_process_stream_close; proc->refcount++; } if (err) { - stream_init(NULL, &proc->err, -1, - STRUCT_CAST(uv_stream_t, &proc->err.uv.pipe)); + stream_init(NULL, &proc->err, -1, (uv_stream_t *)&proc->err.uv.pipe); proc->err.internal_data = proc; proc->err.internal_close_cb = on_process_stream_close; proc->refcount++; @@ -376,7 +370,7 @@ static void flush_stream(Process *proc, Stream *stream) } // Stream can be closed if it is empty. - if (num_bytes == stream->num_bytes) { // -V547 + if (num_bytes == stream->num_bytes) { if (stream->read_cb && !stream->did_eof) { // Stream callback could miss EOF handling if a child keeps the stream // open. But only send EOF if we haven't already. diff --git a/src/nvim/event/rstream.c b/src/nvim/event/rstream.c index a145452afd..4721bbdcb7 100644 --- a/src/nvim/event/rstream.c +++ b/src/nvim/event/rstream.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - #include #include #include diff --git a/src/nvim/event/signal.c b/src/nvim/event/signal.c index 8256ca2091..07223be987 100644 --- a/src/nvim/event/signal.c +++ b/src/nvim/event/signal.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - #include #include diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c index 52a3c81449..62326de075 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - #include #include #include @@ -64,10 +61,10 @@ int socket_watcher_init(Loop *loop, SocketWatcher *watcher, const char *endpoint uv_tcp_init(&loop->uv, &watcher->uv.tcp.handle); uv_tcp_nodelay(&watcher->uv.tcp.handle, true); - watcher->stream = STRUCT_CAST(uv_stream_t, &watcher->uv.tcp.handle); + watcher->stream = (uv_stream_t *)(&watcher->uv.tcp.handle); } else { uv_pipe_init(&loop->uv, &watcher->uv.pipe.handle, 0); - watcher->stream = STRUCT_CAST(uv_stream_t, &watcher->uv.pipe.handle); + watcher->stream = (uv_stream_t *)(&watcher->uv.pipe.handle); } watcher->stream->data = watcher; @@ -102,9 +99,8 @@ int socket_watcher_start(SocketWatcher *watcher, int backlog, socket_cb cb) // contain 0 in this case, unless uv_tcp_getsockname() is used first. uv_tcp_getsockname(&watcher->uv.tcp.handle, (struct sockaddr *)&sas, &(int){ sizeof(sas) }); - uint16_t port = (uint16_t)((sas.ss_family == AF_INET) - ? (STRUCT_CAST(struct sockaddr_in, &sas))->sin_port - : (STRUCT_CAST(struct sockaddr_in6, &sas))->sin6_port); + uint16_t port = (sas.ss_family == AF_INET) ? ((struct sockaddr_in *)(&sas))->sin_port + : ((struct sockaddr_in6 *)(&sas))->sin6_port; // v:servername uses the string from watcher->addr size_t len = strlen(watcher->addr); snprintf(watcher->addr + len, sizeof(watcher->addr) - len, ":%" PRIu16, @@ -142,11 +138,11 @@ int socket_watcher_accept(SocketWatcher *watcher, Stream *stream) uv_stream_t *client; if (watcher->stream->type == UV_TCP) { - client = STRUCT_CAST(uv_stream_t, &stream->uv.tcp); + client = (uv_stream_t *)(&stream->uv.tcp); uv_tcp_init(watcher->uv.tcp.handle.loop, (uv_tcp_t *)client); uv_tcp_nodelay((uv_tcp_t *)client, true); } else { - client = STRUCT_CAST(uv_stream_t, &stream->uv.pipe); + client = (uv_stream_t *)&stream->uv.pipe; uv_pipe_init(watcher->uv.pipe.handle.loop, (uv_pipe_t *)client, 0); } @@ -165,7 +161,7 @@ void socket_watcher_close(SocketWatcher *watcher, socket_close_cb cb) FUNC_ATTR_NONNULL_ARG(1) { watcher->close_cb = cb; - uv_close(STRUCT_CAST(uv_handle_t, watcher->stream), close_cb); + uv_close((uv_handle_t *)watcher->stream, close_cb); } static void connection_event(void **argv) @@ -242,11 +238,11 @@ tcp_retry: uv_pipe_t *pipe = &stream->uv.pipe; uv_pipe_init(&loop->uv, pipe, 0); uv_pipe_connect(&req, pipe, address, connect_cb); - uv_stream = STRUCT_CAST(uv_stream_t, pipe); + uv_stream = (uv_stream_t *)pipe; } status = 1; LOOP_PROCESS_EVENTS_UNTIL(&main_loop, NULL, timeout, status != 1); - if (status == 0) { // -V547 + if (status == 0) { stream_init(NULL, stream, -1, uv_stream); success = true; } else if (is_tcp && addrinfo->ai_next) { diff --git a/src/nvim/event/stream.c b/src/nvim/event/stream.c index 0a4918636a..49b5be23c8 100644 --- a/src/nvim/event/stream.c +++ b/src/nvim/event/stream.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - #include #include #include @@ -37,9 +34,8 @@ int stream_set_blocking(int fd, bool blocking) uv_loop_init(&loop); uv_pipe_init(&loop, &stream, 0); uv_pipe_open(&stream, fd); - int retval = uv_stream_set_blocking(STRUCT_CAST(uv_stream_t, &stream), - blocking); - uv_close(STRUCT_CAST(uv_handle_t, &stream), NULL); + int retval = uv_stream_set_blocking((uv_stream_t *)&stream, blocking); + uv_close((uv_handle_t *)&stream, NULL); uv_run(&loop, UV_RUN_NOWAIT); // not necessary, but couldn't hurt. uv_loop_close(&loop); return retval; @@ -71,12 +67,12 @@ void stream_init(Loop *loop, Stream *stream, int fd, uv_stream_t *uvstream) dwMode |= ENABLE_VIRTUAL_TERMINAL_INPUT; SetConsoleMode(stream->uv.tty.handle, dwMode); } - stream->uvstream = STRUCT_CAST(uv_stream_t, &stream->uv.tty); + stream->uvstream = (uv_stream_t *)&stream->uv.tty; } else { #endif uv_pipe_init(&loop->uv, &stream->uv.pipe, 0); uv_pipe_open(&stream->uv.pipe, fd); - stream->uvstream = STRUCT_CAST(uv_stream_t, &stream->uv.pipe); + stream->uvstream = (uv_stream_t *)&stream->uv.pipe; #ifdef MSWIN } #endif diff --git a/src/nvim/event/time.c b/src/nvim/event/time.c index c997e3c558..0b624d9547 100644 --- a/src/nvim/event/time.c +++ b/src/nvim/event/time.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - #include #include diff --git a/src/nvim/event/wstream.c b/src/nvim/event/wstream.c index 65391ba5cf..b19ff0c7d3 100644 --- a/src/nvim/event/wstream.c +++ b/src/nvim/event/wstream.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - #include #include #include -- cgit From 4f8941c1a5f1ef6caa410feeb52e343db22763ce Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 10 Nov 2023 12:23:42 +0100 Subject: refactor: replace manual header guards with #pragma once It is less error-prone than manually defining header guards. Pretty much all compilers support it even if it's not part of the C standard. --- src/nvim/event/defs.h | 5 +---- src/nvim/event/libuv_process.h | 4 +--- src/nvim/event/loop.h | 5 +---- src/nvim/event/multiqueue.h | 4 +--- src/nvim/event/process.h | 4 +--- src/nvim/event/rstream.h | 4 +--- src/nvim/event/signal.h | 4 +--- src/nvim/event/socket.h | 4 +--- src/nvim/event/stream.h | 4 +--- src/nvim/event/time.h | 4 +--- src/nvim/event/wstream.h | 4 +--- 11 files changed, 11 insertions(+), 35 deletions(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/defs.h b/src/nvim/event/defs.h index cf079681d0..571f61dfdb 100644 --- a/src/nvim/event/defs.h +++ b/src/nvim/event/defs.h @@ -1,5 +1,4 @@ -#ifndef NVIM_EVENT_DEFS_H -#define NVIM_EVENT_DEFS_H +#pragma once #include #include @@ -34,5 +33,3 @@ static inline Event event_create(argv_callback cb, int argc, ...) VA_EVENT_INIT(&event, cb, argc); return event; } - -#endif // NVIM_EVENT_DEFS_H diff --git a/src/nvim/event/libuv_process.h b/src/nvim/event/libuv_process.h index 4472839944..e3e2bfeb76 100644 --- a/src/nvim/event/libuv_process.h +++ b/src/nvim/event/libuv_process.h @@ -1,5 +1,4 @@ -#ifndef NVIM_EVENT_LIBUV_PROCESS_H -#define NVIM_EVENT_LIBUV_PROCESS_H +#pragma once #include @@ -24,4 +23,3 @@ static inline LibuvProcess libuv_process_init(Loop *loop, void *data) #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/libuv_process.h.generated.h" #endif -#endif // NVIM_EVENT_LIBUV_PROCESS_H diff --git a/src/nvim/event/loop.h b/src/nvim/event/loop.h index 7b4b724359..58216f7ec3 100644 --- a/src/nvim/event/loop.h +++ b/src/nvim/event/loop.h @@ -1,5 +1,4 @@ -#ifndef NVIM_EVENT_LOOP_H -#define NVIM_EVENT_LOOP_H +#pragma once #include #include @@ -85,5 +84,3 @@ typedef struct loop { #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/loop.h.generated.h" #endif - -#endif // NVIM_EVENT_LOOP_H diff --git a/src/nvim/event/multiqueue.h b/src/nvim/event/multiqueue.h index 2c5ba9d436..e01ee1e710 100644 --- a/src/nvim/event/multiqueue.h +++ b/src/nvim/event/multiqueue.h @@ -1,5 +1,4 @@ -#ifndef NVIM_EVENT_MULTIQUEUE_H -#define NVIM_EVENT_MULTIQUEUE_H +#pragma once #include @@ -15,4 +14,3 @@ typedef void (*PutCallback)(MultiQueue *multiq, void *data); #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/multiqueue.h.generated.h" #endif -#endif // NVIM_EVENT_MULTIQUEUE_H diff --git a/src/nvim/event/process.h b/src/nvim/event/process.h index 69fe229b0e..234fc815af 100644 --- a/src/nvim/event/process.h +++ b/src/nvim/event/process.h @@ -1,5 +1,4 @@ -#ifndef NVIM_EVENT_PROCESS_H -#define NVIM_EVENT_PROCESS_H +#pragma once #include #include @@ -83,4 +82,3 @@ static inline bool process_is_stopped(Process *proc) #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/process.h.generated.h" #endif -#endif // NVIM_EVENT_PROCESS_H diff --git a/src/nvim/event/rstream.h b/src/nvim/event/rstream.h index 23ed00bfea..b2a62acf83 100644 --- a/src/nvim/event/rstream.h +++ b/src/nvim/event/rstream.h @@ -1,5 +1,4 @@ -#ifndef NVIM_EVENT_RSTREAM_H -#define NVIM_EVENT_RSTREAM_H +#pragma once #include #include @@ -11,4 +10,3 @@ #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/rstream.h.generated.h" #endif -#endif // NVIM_EVENT_RSTREAM_H diff --git a/src/nvim/event/signal.h b/src/nvim/event/signal.h index f9adf62c20..946de1b4f0 100644 --- a/src/nvim/event/signal.h +++ b/src/nvim/event/signal.h @@ -1,5 +1,4 @@ -#ifndef NVIM_EVENT_SIGNAL_H -#define NVIM_EVENT_SIGNAL_H +#pragma once #include @@ -23,4 +22,3 @@ struct signal_watcher { #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/signal.h.generated.h" #endif -#endif // NVIM_EVENT_SIGNAL_H diff --git a/src/nvim/event/socket.h b/src/nvim/event/socket.h index c6fcdec4bb..504af3c7a8 100644 --- a/src/nvim/event/socket.h +++ b/src/nvim/event/socket.h @@ -1,5 +1,4 @@ -#ifndef NVIM_EVENT_SOCKET_H -#define NVIM_EVENT_SOCKET_H +#pragma once #include @@ -39,4 +38,3 @@ struct socket_watcher { #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/socket.h.generated.h" #endif -#endif // NVIM_EVENT_SOCKET_H diff --git a/src/nvim/event/stream.h b/src/nvim/event/stream.h index 33d2d6e775..d02707dc45 100644 --- a/src/nvim/event/stream.h +++ b/src/nvim/event/stream.h @@ -1,5 +1,4 @@ -#ifndef NVIM_EVENT_STREAM_H -#define NVIM_EVENT_STREAM_H +#pragma once #include #include @@ -61,4 +60,3 @@ struct stream { #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/stream.h.generated.h" #endif -#endif // NVIM_EVENT_STREAM_H diff --git a/src/nvim/event/time.h b/src/nvim/event/time.h index e84488fdd6..3514566901 100644 --- a/src/nvim/event/time.h +++ b/src/nvim/event/time.h @@ -1,5 +1,4 @@ -#ifndef NVIM_EVENT_TIME_H -#define NVIM_EVENT_TIME_H +#pragma once #include #include @@ -23,4 +22,3 @@ struct time_watcher { #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/time.h.generated.h" #endif -#endif // NVIM_EVENT_TIME_H diff --git a/src/nvim/event/wstream.h b/src/nvim/event/wstream.h index ef1311c619..4cba7bde8f 100644 --- a/src/nvim/event/wstream.h +++ b/src/nvim/event/wstream.h @@ -1,5 +1,4 @@ -#ifndef NVIM_EVENT_WSTREAM_H -#define NVIM_EVENT_WSTREAM_H +#pragma once #include #include @@ -23,4 +22,3 @@ struct wbuffer { #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/wstream.h.generated.h" #endif -#endif // NVIM_EVENT_WSTREAM_H -- cgit From bb4b4576e384c71890b4df4fa4f1ae76fad3a59d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 16 Nov 2023 10:55:54 +0800 Subject: refactor: iwyu (#26062) --- src/nvim/event/libuv_process.c | 1 - src/nvim/event/process.c | 2 -- src/nvim/event/socket.c | 1 - src/nvim/event/stream.c | 1 - 4 files changed, 5 deletions(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index 73dec2bcab..85fec65177 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -8,7 +8,6 @@ #include "nvim/event/process.h" #include "nvim/event/stream.h" #include "nvim/log.h" -#include "nvim/macros.h" #include "nvim/os/os.h" #include "nvim/ui_client.h" diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c index a6646c3a7f..b69612337c 100644 --- a/src/nvim/event/process.c +++ b/src/nvim/event/process.c @@ -1,7 +1,6 @@ #include #include #include -#include #include #include "klib/klist.h" @@ -10,7 +9,6 @@ #include "nvim/event/process.h" #include "nvim/globals.h" #include "nvim/log.h" -#include "nvim/macros.h" #include "nvim/main.h" #include "nvim/os/process.h" #include "nvim/os/pty_process.h" diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c index 62326de075..542fb707fd 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -12,7 +12,6 @@ #include "nvim/event/stream.h" #include "nvim/gettext.h" #include "nvim/log.h" -#include "nvim/macros.h" #include "nvim/main.h" #include "nvim/memory.h" #include "nvim/os/os.h" diff --git a/src/nvim/event/stream.c b/src/nvim/event/stream.c index 49b5be23c8..17c1b0a072 100644 --- a/src/nvim/event/stream.c +++ b/src/nvim/event/stream.c @@ -7,7 +7,6 @@ #include "nvim/event/loop.h" #include "nvim/event/stream.h" #include "nvim/log.h" -#include "nvim/macros.h" #include "nvim/rbuffer.h" #ifdef MSWIN # include "nvim/os/os_win_console.h" -- cgit From 20ec4c776a07492c2e3b995e10b40b1cdb52bc7a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 17 Nov 2023 18:34:48 +0800 Subject: fix(lua): only disable vim.schedule() when closing main loop (#26090) --- src/nvim/event/loop.c | 2 ++ src/nvim/event/loop.h | 1 + 2 files changed, 3 insertions(+) (limited to 'src/nvim/event') diff --git a/src/nvim/event/loop.c b/src/nvim/event/loop.c index 3d74fe7d6d..d61666e6d4 100644 --- a/src/nvim/event/loop.c +++ b/src/nvim/event/loop.c @@ -17,6 +17,7 @@ void loop_init(Loop *loop, void *data) { uv_loop_init(&loop->uv); loop->recursive = 0; + loop->closing = false; loop->uv.data = loop; loop->children = kl_init(WatcherPtr); loop->events = multiqueue_new_parent(loop_on_put, loop); @@ -149,6 +150,7 @@ static void loop_walk_cb(uv_handle_t *handle, void *arg) bool loop_close(Loop *loop, bool wait) { bool rv = true; + loop->closing = true; uv_mutex_destroy(&loop->mutex); uv_close((uv_handle_t *)&loop->children_watcher, NULL); uv_close((uv_handle_t *)&loop->children_kill_timer, NULL); diff --git a/src/nvim/event/loop.h b/src/nvim/event/loop.h index 58216f7ec3..977ed8a1ee 100644 --- a/src/nvim/event/loop.h +++ b/src/nvim/event/loop.h @@ -40,6 +40,7 @@ typedef struct loop { uv_async_t async; uv_mutex_t mutex; int recursive; + bool closing; ///< Set to true if loop_close() has been called } Loop; #define CREATE_EVENT(multiqueue, handler, argc, ...) \ -- cgit From a6e3d93421ba13c407a96fac9cc01fa41ec7ad98 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Thu, 16 Nov 2023 10:59:11 +0100 Subject: refactor: enable formatting for ternaries This requires removing the "Inner expression should be aligned" rule from clint as it prevents essentially any formatting regarding ternary operators. --- src/nvim/event/libuv_process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index 85fec65177..13d954b92d 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -71,8 +71,8 @@ int libuv_process_spawn(LibuvProcess *uvproc) uvproc->uvstdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; #ifdef MSWIN // pipe must be readable for IOCP to work on Windows. - uvproc->uvstdio[1].flags |= proc->overlapped ? - (UV_READABLE_PIPE | UV_OVERLAPPED_PIPE) : 0; + uvproc->uvstdio[1].flags |= proc->overlapped + ? (UV_READABLE_PIPE | UV_OVERLAPPED_PIPE) : 0; #endif uvproc->uvstdio[1].data.stream = (uv_stream_t *)(&proc->out.uv.pipe); } -- cgit From a827003e3052c6d9ee7bdb71518182e9bd76317d Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sat, 25 Nov 2023 11:32:32 +0100 Subject: build: rework IWYU mapping files Create mapping to most of the C spec and some POSIX specific functions. This is more robust than relying files shipped with IWYU. --- src/nvim/event/libuv_process.c | 1 + src/nvim/event/loop.h | 1 + src/nvim/event/multiqueue.c | 1 - src/nvim/event/rstream.c | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index 13d954b92d..2f21fcf2ac 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -1,4 +1,5 @@ #include +#include #include #include diff --git a/src/nvim/event/loop.h b/src/nvim/event/loop.h index 977ed8a1ee..5665332e95 100644 --- a/src/nvim/event/loop.h +++ b/src/nvim/event/loop.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include diff --git a/src/nvim/event/multiqueue.c b/src/nvim/event/multiqueue.c index 328fa68806..677b7e8e6a 100644 --- a/src/nvim/event/multiqueue.c +++ b/src/nvim/event/multiqueue.c @@ -45,7 +45,6 @@ #include #include #include -#include #include "nvim/event/defs.h" #include "nvim/event/multiqueue.h" diff --git a/src/nvim/event/rstream.c b/src/nvim/event/rstream.c index 4721bbdcb7..218293e44a 100644 --- a/src/nvim/event/rstream.c +++ b/src/nvim/event/rstream.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include "nvim/event/loop.h" -- cgit From 71141e8cf5dfaf5d17610dba57f0e0f319a4850e Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 26 Nov 2023 17:25:35 +0100 Subject: build(IWYU): fix headers for arabic.h --- src/nvim/event/libuv_process.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index 2f21fcf2ac..8264adb1fc 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -5,7 +5,6 @@ #include "nvim/eval/typval.h" #include "nvim/event/libuv_process.h" -#include "nvim/event/loop.h" #include "nvim/event/process.h" #include "nvim/event/stream.h" #include "nvim/log.h" -- cgit From 38a20dd89f91c45ec8589bf1c50d50732882d38a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 27 Nov 2023 20:58:37 +0800 Subject: build(IWYU): replace most private mappings with pragmas (#26247) --- src/nvim/event/socket.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/event') diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c index 542fb707fd..6fe6548f99 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -14,6 +14,7 @@ #include "nvim/log.h" #include "nvim/main.h" #include "nvim/memory.h" +#include "nvim/os/fs.h" #include "nvim/os/os.h" #include "nvim/path.h" -- cgit From 40139738eb479d0913ec6ce751ca5adfa50ad8c3 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 26 Nov 2023 21:36:02 +0100 Subject: build: enable IWYU on mac --- src/nvim/event/rstream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/rstream.c b/src/nvim/event/rstream.c index 218293e44a..7745cd8fcc 100644 --- a/src/nvim/event/rstream.c +++ b/src/nvim/event/rstream.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include "nvim/event/loop.h" -- cgit From 8b428ca8b79ebb7b36c3e403ff3bcb6924a635a6 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 16:00:21 +0100 Subject: build(IWYU): fix includes for func_attr.h --- src/nvim/event/libuv_process.c | 1 + src/nvim/event/multiqueue.c | 1 + src/nvim/event/process.c | 1 + src/nvim/event/rstream.c | 1 + src/nvim/event/signal.c | 1 + src/nvim/event/socket.c | 1 + src/nvim/event/stream.c | 1 + src/nvim/event/time.c | 1 + src/nvim/event/wstream.c | 1 + 9 files changed, 9 insertions(+) (limited to 'src/nvim/event') diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index 8264adb1fc..be48b39af1 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -7,6 +7,7 @@ #include "nvim/event/libuv_process.h" #include "nvim/event/process.h" #include "nvim/event/stream.h" +#include "nvim/func_attr.h" #include "nvim/log.h" #include "nvim/os/os.h" #include "nvim/ui_client.h" diff --git a/src/nvim/event/multiqueue.c b/src/nvim/event/multiqueue.c index 677b7e8e6a..3ab41bd299 100644 --- a/src/nvim/event/multiqueue.c +++ b/src/nvim/event/multiqueue.c @@ -48,6 +48,7 @@ #include "nvim/event/defs.h" #include "nvim/event/multiqueue.h" +#include "nvim/func_attr.h" #include "nvim/lib/queue.h" #include "nvim/memory.h" diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c index b69612337c..864fc2c1d8 100644 --- a/src/nvim/event/process.c +++ b/src/nvim/event/process.c @@ -7,6 +7,7 @@ #include "nvim/event/libuv_process.h" #include "nvim/event/loop.h" #include "nvim/event/process.h" +#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/log.h" #include "nvim/main.h" diff --git a/src/nvim/event/rstream.c b/src/nvim/event/rstream.c index 7745cd8fcc..da6d595741 100644 --- a/src/nvim/event/rstream.c +++ b/src/nvim/event/rstream.c @@ -8,6 +8,7 @@ #include "nvim/event/loop.h" #include "nvim/event/rstream.h" #include "nvim/event/stream.h" +#include "nvim/func_attr.h" #include "nvim/log.h" #include "nvim/macros.h" #include "nvim/main.h" diff --git a/src/nvim/event/signal.c b/src/nvim/event/signal.c index 07223be987..e64d526856 100644 --- a/src/nvim/event/signal.c +++ b/src/nvim/event/signal.c @@ -3,6 +3,7 @@ #include "nvim/event/loop.h" #include "nvim/event/signal.h" +#include "nvim/func_attr.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/signal.c.generated.h" diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c index 6fe6548f99..f6a950d4ef 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -10,6 +10,7 @@ #include "nvim/event/loop.h" #include "nvim/event/socket.h" #include "nvim/event/stream.h" +#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/log.h" #include "nvim/main.h" diff --git a/src/nvim/event/stream.c b/src/nvim/event/stream.c index 17c1b0a072..aff116bad9 100644 --- a/src/nvim/event/stream.c +++ b/src/nvim/event/stream.c @@ -6,6 +6,7 @@ #include "nvim/event/loop.h" #include "nvim/event/stream.h" +#include "nvim/func_attr.h" #include "nvim/log.h" #include "nvim/rbuffer.h" #ifdef MSWIN diff --git a/src/nvim/event/time.c b/src/nvim/event/time.c index 0b624d9547..f678f25f3f 100644 --- a/src/nvim/event/time.c +++ b/src/nvim/event/time.c @@ -3,6 +3,7 @@ #include "nvim/event/loop.h" #include "nvim/event/time.h" +#include "nvim/func_attr.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/time.c.generated.h" diff --git a/src/nvim/event/wstream.c b/src/nvim/event/wstream.c index b19ff0c7d3..d7e5d7a9f3 100644 --- a/src/nvim/event/wstream.c +++ b/src/nvim/event/wstream.c @@ -5,6 +5,7 @@ #include "nvim/event/loop.h" #include "nvim/event/stream.h" #include "nvim/event/wstream.h" +#include "nvim/func_attr.h" #include "nvim/macros.h" #include "nvim/memory.h" -- cgit From 79b6ff28ad1204fbb4199b9092f5c578d88cb28e Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 28 Nov 2023 20:31:00 +0100 Subject: refactor: fix headers with IWYU --- src/nvim/event/rstream.c | 2 +- src/nvim/event/socket.c | 2 +- src/nvim/event/wstream.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/event') diff --git a/src/nvim/event/rstream.c b/src/nvim/event/rstream.c index da6d595741..73828a2271 100644 --- a/src/nvim/event/rstream.c +++ b/src/nvim/event/rstream.c @@ -10,7 +10,7 @@ #include "nvim/event/stream.h" #include "nvim/func_attr.h" #include "nvim/log.h" -#include "nvim/macros.h" +#include "nvim/macros_defs.h" #include "nvim/main.h" #include "nvim/os/os_defs.h" #include "nvim/rbuffer.h" diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c index f6a950d4ef..e787e023f0 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -5,7 +5,7 @@ #include #include -#include "nvim/ascii.h" +#include "nvim/ascii_defs.h" #include "nvim/charset.h" #include "nvim/event/loop.h" #include "nvim/event/socket.h" diff --git a/src/nvim/event/wstream.c b/src/nvim/event/wstream.c index d7e5d7a9f3..e8f757874b 100644 --- a/src/nvim/event/wstream.c +++ b/src/nvim/event/wstream.c @@ -6,7 +6,7 @@ #include "nvim/event/stream.h" #include "nvim/event/wstream.h" #include "nvim/func_attr.h" -#include "nvim/macros.h" +#include "nvim/macros_defs.h" #include "nvim/memory.h" #define DEFAULT_MAXMEM 1024 * 1024 * 2000 -- cgit