diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-11-30 15:51:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-30 15:51:05 +0800 |
commit | 543e0256c19f397921a332e06b423215fd9aecb5 (patch) | |
tree | 5517c44128bc3a0763fc9789565b78c56e49d690 | |
parent | 85be914879d49435c3b689efd5f1dae70e81d168 (diff) | |
download | rneovim-543e0256c19f397921a332e06b423215fd9aecb5.tar.gz rneovim-543e0256c19f397921a332e06b423215fd9aecb5.tar.bz2 rneovim-543e0256c19f397921a332e06b423215fd9aecb5.zip |
build: don't define FUNC_ATTR_* as empty in headers (#26317)
FUNC_ATTR_* should only be used in .c files with generated headers.
Defining FUNC_ATTR_* as empty in headers causes misuses of them to be
silently ignored. Instead don't define them by default, and only define
them as empty after a .c file has included its generated header.
136 files changed, 142 insertions, 186 deletions
diff --git a/runtime/doc/dev_style.txt b/runtime/doc/dev_style.txt index cb28f1a845..02fd07ce24 100644 --- a/runtime/doc/dev_style.txt +++ b/runtime/doc/dev_style.txt @@ -190,7 +190,7 @@ Function declarations ~ Every function must not have a separate declaration. -Function declarations are created by the gendeclarations.lua script. >c +Function declarations are created by the gen_declarations.lua script. >c static void f(void); diff --git a/src/klib/kvec.h b/src/klib/kvec.h index 5677a93b1b..f9ecca3d55 100644 --- a/src/klib/kvec.h +++ b/src/klib/kvec.h @@ -160,10 +160,12 @@ (v).size = 0, \ (v).items = (v).init_array) +static inline void *_memcpy_free(void *restrict dest, void *restrict src, size_t size) + REAL_FATTR_NONNULL_ALL REAL_FATTR_NONNULL_RET REAL_FATTR_ALWAYS_INLINE; + /// Move data to a new destination and free source static inline void *_memcpy_free(void *const restrict dest, void *const restrict src, const size_t size) - FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET FUNC_ATTR_ALWAYS_INLINE { memcpy(dest, src, size); XFREE_CLEAR(src); diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 3505f8be4f..a8ce9edff8 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -463,7 +463,7 @@ endif() #------------------------------------------------------------------------------- get_target_property(prop main_lib INTERFACE_COMPILE_DEFINITIONS) -foreach(gen_cdef DO_NOT_DEFINE_EMPTY_ATTRIBUTES ${prop}) +foreach(gen_cdef ${prop}) if(NOT ${gen_cdef} MATCHES "INCLUDE_GENERATED_DECLARATIONS") list(APPEND gen_cflags "-D${gen_cdef}") endif() diff --git a/src/nvim/api/autocmd.c b/src/nvim/api/autocmd.c index 08d9d8e117..2ce08bdf40 100644 --- a/src/nvim/api/autocmd.c +++ b/src/nvim/api/autocmd.c @@ -17,7 +17,6 @@ #include "nvim/buffer.h" #include "nvim/eval/typval.h" #include "nvim/ex_cmds_defs.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/lua/executor.h" #include "nvim/memory.h" diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 0df231868d..9d0ac5d6ef 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -24,7 +24,6 @@ #include "nvim/drawscreen.h" #include "nvim/ex_cmds.h" #include "nvim/extmark.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/lua/executor.h" #include "nvim/mapping.h" diff --git a/src/nvim/api/command.c b/src/nvim/api/command.c index 2a57ce9a19..7116f4bce0 100644 --- a/src/nvim/api/command.c +++ b/src/nvim/api/command.c @@ -18,7 +18,6 @@ #include "nvim/ex_cmds.h" #include "nvim/ex_docmd.h" #include "nvim/ex_eval.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/globals.h" #include "nvim/lua/executor.h" diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 2ec11236d7..11795033cc 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -14,7 +14,6 @@ #include "nvim/buffer_defs.h" #include "nvim/decoration.h" #include "nvim/extmark.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/highlight.h" #include "nvim/highlight_group.h" diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c index d71498d6ed..80b1546329 100644 --- a/src/nvim/api/extmark.c +++ b/src/nvim/api/extmark.c @@ -17,7 +17,6 @@ #include "nvim/decoration_provider.h" #include "nvim/drawscreen.h" #include "nvim/extmark.h" -#include "nvim/func_attr.h" #include "nvim/grid.h" #include "nvim/highlight_group.h" #include "nvim/marktree.h" diff --git a/src/nvim/api/options.c b/src/nvim/api/options.c index c012a69c7b..9cf91bad42 100644 --- a/src/nvim/api/options.c +++ b/src/nvim/api/options.c @@ -11,7 +11,6 @@ #include "nvim/autocmd.h" #include "nvim/buffer.h" #include "nvim/eval/window.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/macros_defs.h" #include "nvim/memory.h" diff --git a/src/nvim/api/private/converter.c b/src/nvim/api/private/converter.c index 90023171e5..ef57bde32d 100644 --- a/src/nvim/api/private/converter.c +++ b/src/nvim/api/private/converter.c @@ -11,7 +11,6 @@ #include "nvim/eval/typval.h" #include "nvim/eval/typval_defs.h" #include "nvim/eval/userfunc.h" -#include "nvim/func_attr.h" #include "nvim/lua/executor.h" #include "nvim/memory.h" #include "nvim/types_defs.h" diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index be39836a5b..b23684aee9 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -20,7 +20,6 @@ #include "nvim/eval/typval_defs.h" #include "nvim/eval/vars.h" #include "nvim/ex_eval.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/globals.h" #include "nvim/highlight_group.h" diff --git a/src/nvim/api/tabpage.c b/src/nvim/api/tabpage.c index c854a22477..303f2ca817 100644 --- a/src/nvim/api/tabpage.c +++ b/src/nvim/api/tabpage.c @@ -6,11 +6,14 @@ #include "nvim/api/tabpage.h" #include "nvim/api/vim.h" #include "nvim/buffer_defs.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/memory.h" #include "nvim/window.h" +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "api/tabpage.c.generated.h" +#endif + /// Gets the windows in a tabpage /// /// @param tabpage Tabpage handle, or 0 for current tabpage diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 836a68546c..7e64ce9cd1 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -17,7 +17,6 @@ #include "nvim/eval.h" #include "nvim/event/loop.h" #include "nvim/event/wstream.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/grid.h" #include "nvim/highlight.h" diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index d631b10af9..270f2e4432 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -31,7 +31,6 @@ #include "nvim/ex_docmd.h" #include "nvim/ex_eval.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/getchar.h" #include "nvim/globals.h" #include "nvim/grid.h" diff --git a/src/nvim/api/vimscript.c b/src/nvim/api/vimscript.c index c75bf21572..25a34f769c 100644 --- a/src/nvim/api/vimscript.c +++ b/src/nvim/api/vimscript.c @@ -15,7 +15,6 @@ #include "nvim/eval/typval.h" #include "nvim/eval/userfunc.h" #include "nvim/ex_docmd.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/globals.h" #include "nvim/memory.h" diff --git a/src/nvim/api/win_config.c b/src/nvim/api/win_config.c index 4e23717dc6..825a0583ef 100644 --- a/src/nvim/api/win_config.c +++ b/src/nvim/api/win_config.c @@ -13,7 +13,6 @@ #include "nvim/buffer_defs.h" #include "nvim/decoration.h" #include "nvim/drawscreen.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/grid.h" #include "nvim/highlight_group.h" diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index de5b40940f..d18971c756 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -15,7 +15,6 @@ #include "nvim/drawscreen.h" #include "nvim/eval/window.h" #include "nvim/ex_docmd.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/lua/executor.h" @@ -27,6 +26,10 @@ #include "nvim/types_defs.h" #include "nvim/window.h" +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "api/window.c.generated.h" +#endif + /// Gets the current buffer in a window /// /// @param window Window handle, or 0 for current window diff --git a/src/nvim/arabic.c b/src/nvim/arabic.c index 84f4297c99..f575bf30b8 100644 --- a/src/nvim/arabic.c +++ b/src/nvim/arabic.c @@ -22,7 +22,6 @@ #include "nvim/arabic.h" #include "nvim/ascii_defs.h" -#include "nvim/func_attr.h" #include "nvim/macros_defs.h" #include "nvim/option_vars.h" diff --git a/src/nvim/arglist.c b/src/nvim/arglist.c index d2734e6c5a..541534abf9 100644 --- a/src/nvim/arglist.c +++ b/src/nvim/arglist.c @@ -20,7 +20,6 @@ #include "nvim/ex_cmds_defs.h" #include "nvim/ex_getln.h" #include "nvim/fileio.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/ascii_defs.h b/src/nvim/ascii_defs.h index 4125336796..3de04cd9fa 100644 --- a/src/nvim/ascii_defs.h +++ b/src/nvim/ascii_defs.h @@ -107,6 +107,10 @@ static inline bool ascii_isbdigit(int c) REAL_FATTR_CONST REAL_FATTR_ALWAYS_INLINE; +static inline bool ascii_isodigit(int c) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; + static inline bool ascii_isspace(int c) REAL_FATTR_CONST REAL_FATTR_ALWAYS_INLINE; diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index 74a1dbdbc3..044746b7be 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -23,7 +23,6 @@ #include "nvim/ex_docmd.h" #include "nvim/ex_eval.h" #include "nvim/fileio.h" -#include "nvim/func_attr.h" #include "nvim/getchar.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/base64.c b/src/nvim/base64.c index 295dedd8d3..7f7d121442 100644 --- a/src/nvim/base64.c +++ b/src/nvim/base64.c @@ -3,7 +3,7 @@ #include <stdint.h> #include <string.h> -#include "auto/config.h" // IWYU pragma: keep +#include "auto/config.h" #include "nvim/base64.h" #include "nvim/memory.h" @@ -12,7 +12,7 @@ #endif #ifdef INCLUDE_GENERATED_DECLARATIONS -# include "base64.c.generated.h" // IWYU pragma: export +# include "base64.c.generated.h" #endif static const char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -65,6 +65,7 @@ static inline uint32_t htobe32(uint32_t host_32bits) /// @param src_len Length of the string /// @return Base64 encoded string char *base64_encode(const char *src, size_t src_len) + FUNC_ATTR_NONNULL_ALL { assert(src != NULL); diff --git a/src/nvim/buffer_updates.c b/src/nvim/buffer_updates.c index 01bcb9d7be..a91a890d0e 100644 --- a/src/nvim/buffer_updates.c +++ b/src/nvim/buffer_updates.c @@ -11,7 +11,6 @@ #include "nvim/buffer.h" #include "nvim/buffer_defs.h" #include "nvim/buffer_updates.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/log.h" #include "nvim/lua/executor.h" @@ -22,7 +21,7 @@ #include "nvim/types_defs.h" #ifdef INCLUDE_GENERATED_DECLARATIONS -# include "buffer_updates.c.generated.h" // IWYU pragma: export +# include "buffer_updates.c.generated.h" #endif // Register a channel. Return True if the channel was added, or already added. diff --git a/src/nvim/bufwrite.c b/src/nvim/bufwrite.c index f774fcb057..06bd05b11d 100644 --- a/src/nvim/bufwrite.c +++ b/src/nvim/bufwrite.c @@ -23,7 +23,6 @@ #include "nvim/ex_cmds_defs.h" #include "nvim/ex_eval.h" #include "nvim/fileio.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/highlight.h" diff --git a/src/nvim/change.c b/src/nvim/change.c index 81a55b92ee..efc2db1413 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -21,7 +21,6 @@ #include "nvim/ex_cmds_defs.h" #include "nvim/extmark.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/highlight.h" diff --git a/src/nvim/channel.h b/src/nvim/channel.h index 5c9d708ac2..6deea08c83 100644 --- a/src/nvim/channel.h +++ b/src/nvim/channel.h @@ -122,7 +122,9 @@ static inline Channel *find_channel(uint64_t id) } static inline Stream *channel_instream(Channel *chan) - FUNC_ATTR_NONNULL_ALL + REAL_FATTR_NONNULL_ALL; + +static inline Stream *channel_instream(Channel *chan) { switch (chan->streamtype) { case kChannelStreamProc: @@ -142,7 +144,9 @@ static inline Stream *channel_instream(Channel *chan) } static inline Stream *channel_outstream(Channel *chan) - FUNC_ATTR_NONNULL_ALL + REAL_FATTR_NONNULL_ALL; + +static inline Stream *channel_outstream(Channel *chan) { switch (chan->streamtype) { case kChannelStreamProc: diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index 367b86ec55..523145af1b 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -26,7 +26,6 @@ #include "nvim/ex_cmds.h" #include "nvim/ex_docmd.h" #include "nvim/ex_getln.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/garray_defs.h" #include "nvim/getchar.h" diff --git a/src/nvim/cmdhist.c b/src/nvim/cmdhist.c index 4556b74396..7ebe3c34a1 100644 --- a/src/nvim/cmdhist.c +++ b/src/nvim/cmdhist.c @@ -15,7 +15,6 @@ #include "nvim/ex_cmds.h" #include "nvim/ex_cmds_defs.h" #include "nvim/ex_getln.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/macros_defs.h" diff --git a/src/nvim/context.c b/src/nvim/context.c index 59309fcf16..5f47cfc225 100644 --- a/src/nvim/context.c +++ b/src/nvim/context.c @@ -16,7 +16,6 @@ #include "nvim/eval/typval.h" #include "nvim/eval/userfunc.h" #include "nvim/ex_docmd.h" -#include "nvim/func_attr.h" #include "nvim/hashtab.h" #include "nvim/keycodes.h" #include "nvim/memory.h" diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c index 5aff3b5598..fe07c33df5 100644 --- a/src/nvim/cursor_shape.c +++ b/src/nvim/cursor_shape.c @@ -8,7 +8,6 @@ #include "nvim/charset.h" #include "nvim/cursor_shape.h" #include "nvim/ex_getln.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/highlight_group.h" diff --git a/src/nvim/debugger.c b/src/nvim/debugger.c index a343c1ad6b..000fe13502 100644 --- a/src/nvim/debugger.c +++ b/src/nvim/debugger.c @@ -18,7 +18,6 @@ #include "nvim/ex_docmd.h" #include "nvim/ex_getln.h" #include "nvim/fileio.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 0b7f6f266b..6578a1121c 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -32,7 +32,6 @@ #include "nvim/extmark.h" #include "nvim/fileio.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c index 99d5cf1035..6b3c4e902b 100644 --- a/src/nvim/digraph.c +++ b/src/nvim/digraph.c @@ -17,7 +17,6 @@ #include "nvim/ex_cmds_defs.h" #include "nvim/ex_docmd.h" #include "nvim/ex_getln.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index 6cc623cb72..1abbc0c102 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -76,7 +76,6 @@ #include "nvim/eval.h" #include "nvim/ex_getln.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/getchar.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 71a12ea1b0..dd7cd9a573 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -24,7 +24,6 @@ #include "nvim/extmark.h" #include "nvim/fileio.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/getchar.h" #include "nvim/gettext.h" #include "nvim/globals.h" @@ -1472,7 +1471,7 @@ void edit_putchar(int c, bool highlight) /// @return the effective prompt for the specified buffer. char *buf_prompt_text(const buf_T *const buf) - FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE { if (buf->b_prompt_text == NULL) { return "% "; diff --git a/src/nvim/eval.c b/src/nvim/eval.c index f4479d06a6..a43ca3d78a 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -36,7 +36,6 @@ #include "nvim/ex_eval.h" #include "nvim/ex_getln.h" #include "nvim/ex_session.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" diff --git a/src/nvim/eval/buffer.c b/src/nvim/eval/buffer.c index c60a104381..1f3b92804d 100644 --- a/src/nvim/eval/buffer.c +++ b/src/nvim/eval/buffer.c @@ -14,7 +14,6 @@ #include "nvim/eval/funcs.h" #include "nvim/eval/typval.h" #include "nvim/eval/typval_defs.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/macros_defs.h" #include "nvim/memline.h" diff --git a/src/nvim/eval/decode.c b/src/nvim/eval/decode.c index 03f79fca84..a6407693d7 100644 --- a/src/nvim/eval/decode.c +++ b/src/nvim/eval/decode.c @@ -14,7 +14,6 @@ #include "nvim/eval/encode.h" #include "nvim/eval/typval.h" #include "nvim/eval/typval_defs.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/macros_defs.h" diff --git a/src/nvim/eval/encode.h b/src/nvim/eval/encode.h index 26a3286f2b..699956d8ac 100644 --- a/src/nvim/eval/encode.h +++ b/src/nvim/eval/encode.h @@ -36,9 +36,11 @@ typedef struct { size_t li_length; ///< Length of the string inside the read item. } ListReaderState; +static inline ListReaderState encode_init_lrstate(const list_T *list) + REAL_FATTR_NONNULL_ALL; + /// Initialize ListReaderState structure static inline ListReaderState encode_init_lrstate(const list_T *const list) - FUNC_ATTR_NONNULL_ALL { return (ListReaderState) { .list = list, diff --git a/src/nvim/eval/executor.c b/src/nvim/eval/executor.c index dc23fcdc72..b483f5fbef 100644 --- a/src/nvim/eval/executor.c +++ b/src/nvim/eval/executor.c @@ -5,7 +5,6 @@ #include "nvim/eval/executor.h" #include "nvim/eval/typval.h" #include "nvim/eval/typval_defs.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" @@ -15,7 +14,7 @@ #include "nvim/vim_defs.h" #ifdef INCLUDE_GENERATED_DECLARATIONS -# include "eval/executor.c.generated.h" // IWYU pragma: export +# include "eval/executor.c.generated.h" #endif char *e_list_index_out_of_range_nr diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 13425b21d1..0054c47678 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -58,7 +58,6 @@ #include "nvim/ex_getln.h" #include "nvim/file_search.h" #include "nvim/fileio.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h index 58f74a9796..efa6017f4b 100644 --- a/src/nvim/eval/typval.h +++ b/src/nvim/eval/typval.h @@ -85,6 +85,9 @@ static inline void tv_list_set_lock(list_T *const l, const VarLockStatus lock) l->lv_lock = lock; } +static inline void tv_list_set_copyid(list_T *l, int copyid) + REAL_FATTR_NONNULL_ALL; + /// Set list copyID /// /// Does not expect NULL list, be careful. @@ -92,7 +95,6 @@ static inline void tv_list_set_lock(list_T *const l, const VarLockStatus lock) /// @param[out] l List to modify. /// @param[in] copyid New copyID. static inline void tv_list_set_copyid(list_T *const l, const int copyid) - FUNC_ATTR_NONNULL_ALL { l->lv_copyID = copyid; } @@ -442,22 +444,20 @@ static inline bool tv_get_float_chk(const typval_T *const tv, float_T *const ret } static inline DictWatcher *tv_dict_watcher_node_data(QUEUE *q) - REAL_FATTR_NONNULL_ALL REAL_FATTR_NONNULL_RET REAL_FATTR_PURE - REAL_FATTR_WARN_UNUSED_RESULT REAL_FATTR_ALWAYS_INLINE - FUNC_ATTR_NO_SANITIZE_ADDRESS; + REAL_FATTR_ALWAYS_INLINE REAL_FATTR_NONNULL_ALL REAL_FATTR_NONNULL_RET + REAL_FATTR_NO_SANITIZE_ADDRESS REAL_FATTR_PURE REAL_FATTR_WARN_UNUSED_RESULT; /// Compute the `DictWatcher` address from a QUEUE node. /// /// This only exists for .asan-blacklist (ASAN doesn't handle QUEUE_DATA pointer /// arithmetic). static inline DictWatcher *tv_dict_watcher_node_data(QUEUE *q) - FUNC_ATTR_NO_SANITIZE_ADDRESS { return QUEUE_DATA(q, DictWatcher, node); } static inline bool tv_is_func(typval_T tv) - FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_CONST; + REAL_FATTR_WARN_UNUSED_RESULT REAL_FATTR_ALWAYS_INLINE REAL_FATTR_CONST; /// Check whether given typval_T contains a function /// diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index 23b3c4e1b2..e0bf30b158 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -23,7 +23,6 @@ #include "nvim/ex_docmd.h" #include "nvim/ex_eval.h" #include "nvim/ex_getln.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c index 2968f75f4d..670ee39f4b 100644 --- a/src/nvim/eval/vars.c +++ b/src/nvim/eval/vars.c @@ -25,7 +25,6 @@ #include "nvim/ex_cmds_defs.h" #include "nvim/ex_docmd.h" #include "nvim/ex_eval.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index be48b39af1..8264adb1fc 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -7,7 +7,6 @@ #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 3ab41bd299..677b7e8e6a 100644 --- a/src/nvim/event/multiqueue.c +++ b/src/nvim/event/multiqueue.c @@ -48,7 +48,6 @@ #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 864fc2c1d8..b69612337c 100644 --- a/src/nvim/event/process.c +++ b/src/nvim/event/process.c @@ -7,7 +7,6 @@ #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 73828a2271..88363e86e9 100644 --- a/src/nvim/event/rstream.c +++ b/src/nvim/event/rstream.c @@ -8,7 +8,6 @@ #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_defs.h" #include "nvim/main.h" diff --git a/src/nvim/event/signal.c b/src/nvim/event/signal.c index e64d526856..07223be987 100644 --- a/src/nvim/event/signal.c +++ b/src/nvim/event/signal.c @@ -3,7 +3,6 @@ #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 e787e023f0..c90b177eb7 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -10,7 +10,6 @@ #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 aff116bad9..17c1b0a072 100644 --- a/src/nvim/event/stream.c +++ b/src/nvim/event/stream.c @@ -6,7 +6,6 @@ #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 f678f25f3f..0b624d9547 100644 --- a/src/nvim/event/time.c +++ b/src/nvim/event/time.c @@ -3,7 +3,6 @@ #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 e8f757874b..239f64c013 100644 --- a/src/nvim/event/wstream.c +++ b/src/nvim/event/wstream.c @@ -5,7 +5,6 @@ #include "nvim/event/loop.h" #include "nvim/event/stream.h" #include "nvim/event/wstream.h" -#include "nvim/func_attr.h" #include "nvim/macros_defs.h" #include "nvim/memory.h" diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index e369397047..c0aca071e2 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -43,7 +43,6 @@ #include "nvim/extmark.h" #include "nvim/fileio.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/getchar.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 245121f4af..bf5a3944e6 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -39,7 +39,6 @@ #include "nvim/file_search.h" #include "nvim/fileio.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c index d2a1d53b78..bc4cb634e8 100644 --- a/src/nvim/ex_eval.c +++ b/src/nvim/ex_eval.c @@ -18,7 +18,6 @@ #include "nvim/ex_docmd.h" #include "nvim/ex_eval.h" #include "nvim/ex_eval_defs.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/memory.h" diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 64ef17b157..f31f8fec55 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -34,7 +34,6 @@ #include "nvim/ex_eval.h" #include "nvim/ex_getln.h" #include "nvim/extmark.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c index 71c01922bc..45f05e10f2 100644 --- a/src/nvim/ex_session.c +++ b/src/nvim/ex_session.c @@ -20,7 +20,6 @@ #include "nvim/file_search.h" #include "nvim/fileio.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 0bb664bcf5..4fe5b1cd44 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -31,7 +31,6 @@ #include "nvim/ex_eval.h" #include "nvim/fileio.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/garray_defs.h" #include "nvim/getchar.h" diff --git a/src/nvim/fold.c b/src/nvim/fold.c index c905b2d3ed..e372b9f461 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -27,7 +27,6 @@ #include "nvim/ex_session.h" #include "nvim/extmark.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/garray_defs.h" #include "nvim/gettext.h" diff --git a/src/nvim/func_attr.h b/src/nvim/func_attr.h index 15370dcb3e..d638fda531 100644 --- a/src/nvim/func_attr.h +++ b/src/nvim/func_attr.h @@ -1,24 +1,16 @@ -// If DEFINE_FUNC_ATTRIBUTES macro is not defined then all function attributes -// are defined as empty values. -// -// If DO_NOT_DEFINE_EMPTY_ATTRIBUTES then empty macros are not defined. Thus -// undefined DEFINE_FUNC_ATTRIBUTES and defined DO_NOT_DEFINE_EMPTY_ATTRIBUTES +// Undefined DEFINE_FUNC_ATTRIBUTES and undefined DEFINE_EMPTY_ATTRIBUTES // leaves file with untouched FUNC_ATTR_* macros. This variant is used for -// scripts/gendeclarations.lua. +// scripts/gen_declarations.lua. // -// Empty macros are used for *.c files. (undefined DEFINE_FUNC_ATTRIBUTES and -// undefined DO_NOT_DEFINE_EMPTY_ATTRIBUTES) +// Empty macros are used for *.c files. +// (undefined DEFINE_FUNC_ATTRIBUTES and defined DEFINE_EMPTY_ATTRIBUTES) // // Macros defined as __attribute__((*)) are used by generated header files. -// (defined DEFINE_FUNC_ATTRIBUTES and undefined -// DO_NOT_DEFINE_EMPTY_ATTRIBUTES) -// -// Defined DEFINE_FUNC_ATTRIBUTES and defined DO_NOT_DEFINE_EMPTY_ATTRIBUTES is -// not used by anything. +// (defined DEFINE_FUNC_ATTRIBUTES and undefined DEFINE_EMPTY_ATTRIBUTES) // FUNC_ATTR_* macros should be in *.c files for declarations generator. If you // define a function for which declaration is not generated by -// gendeclarations.lua (e.g. template hash implementation) then you should use +// gen_declarations.lua (e.g. template hash implementation) then you should use // REAL_FATTR_* macros. // gcc and clang expose their version as follows: @@ -217,7 +209,7 @@ # endif #endif -#ifdef DEFINE_FUNC_ATTRIBUTES +#if defined(DEFINE_FUNC_ATTRIBUTES) || defined(DEFINE_EMPTY_ATTRIBUTES) /// Fast (non-deferred) API function. # define FUNC_API_FAST /// Internal C function not exposed in the RPC API. @@ -234,6 +226,9 @@ # define FUNC_API_SINCE(X) /// API function deprecated since the given API level. # define FUNC_API_DEPRECATED_SINCE(X) +#endif + +#if defined(DEFINE_FUNC_ATTRIBUTES) # define FUNC_ATTR_MALLOC REAL_FATTR_MALLOC # define FUNC_ATTR_ALLOC_SIZE(x) REAL_FATTR_ALLOC_SIZE(x) # define FUNC_ATTR_ALLOC_SIZE_PROD(x, y) REAL_FATTR_ALLOC_SIZE_PROD(x, y) @@ -250,7 +245,7 @@ # define FUNC_ATTR_NO_SANITIZE_UNDEFINED REAL_FATTR_NO_SANITIZE_UNDEFINED # define FUNC_ATTR_NO_SANITIZE_ADDRESS REAL_FATTR_NO_SANITIZE_ADDRESS # define FUNC_ATTR_PRINTF(x, y) REAL_FATTR_PRINTF(x, y) -#elif !defined(DO_NOT_DEFINE_EMPTY_ATTRIBUTES) +#elif defined(DEFINE_EMPTY_ATTRIBUTES) # define FUNC_ATTR_MALLOC # define FUNC_ATTR_ALLOC_SIZE(x) # define FUNC_ATTR_ALLOC_SIZE_PROD(x, y) diff --git a/src/nvim/garray.c b/src/nvim/garray.c index 24b6fb0007..28339c3059 100644 --- a/src/nvim/garray.c +++ b/src/nvim/garray.c @@ -5,7 +5,6 @@ #include <stdint.h> #include <string.h> -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/log.h" #include "nvim/memory.h" @@ -13,7 +12,7 @@ #include "nvim/strings.h" #ifdef INCLUDE_GENERATED_DECLARATIONS -# include "garray.c.generated.h" // IWYU pragma: export +# include "garray.c.generated.h" #endif /// Clear an allocated growing array. diff --git a/src/nvim/generators/gen_api_dispatch.lua b/src/nvim/generators/gen_api_dispatch.lua index 9720cca477..81b5096557 100644 --- a/src/nvim/generators/gen_api_dispatch.lua +++ b/src/nvim/generators/gen_api_dispatch.lua @@ -752,9 +752,9 @@ for _, fn in ipairs(functions) do end output:write(string.format([[ -void nlua_add_api_functions(lua_State *lstate); // silence -Wmissing-prototypes void nlua_add_api_functions(lua_State *lstate) - FUNC_ATTR_NONNULL_ALL + REAL_FATTR_NONNULL_ALL; +void nlua_add_api_functions(lua_State *lstate) { lua_createtable(lstate, 0, %u); ]], #lua_c_functions)) diff --git a/src/nvim/generators/gen_declarations.lua b/src/nvim/generators/gen_declarations.lua index f9e9c6b0a8..fecca5191e 100644 --- a/src/nvim/generators/gen_declarations.lua +++ b/src/nvim/generators/gen_declarations.lua @@ -164,7 +164,7 @@ if fname == '--help' then print([[ Usage: - gendeclarations.lua definitions.c static.h non-static.h definitions.i + gen_declarations.lua definitions.c static.h non-static.h definitions.i Generates declarations for a C file definitions.c, putting declarations for static functions into static.h and declarations for non-static functions into @@ -202,17 +202,10 @@ local text = preproc_f:read("*all") preproc_f:close() -local header = [[ +local non_static = [[ #define DEFINE_FUNC_ATTRIBUTES #include "nvim/func_attr.h" #undef DEFINE_FUNC_ATTRIBUTES -]] - -local footer = [[ -#include "nvim/func_attr.h" -]] - -local non_static = header .. [[ #ifndef DLLEXPORT # ifdef MSWIN # define DLLEXPORT __declspec(dllexport) @@ -222,7 +215,20 @@ local non_static = header .. [[ #endif ]] -local static = header +local static = [[ +#define DEFINE_FUNC_ATTRIBUTES +#include "nvim/func_attr.h" +#undef DEFINE_FUNC_ATTRIBUTES +]] + +local non_static_footer = [[ +#include "nvim/func_attr.h" +]] + +local static_footer = [[ +#define DEFINE_EMPTY_ATTRIBUTES +#include "nvim/func_attr.h" // IWYU pragma: export +]] if fname:find('.*/src/nvim/.*%.c$') then -- Add an IWYU pragma comment if the corresponding .h file exists. @@ -307,8 +313,8 @@ while init ~= nil do end end -non_static = non_static .. footer -static = static .. footer +non_static = non_static .. non_static_footer +static = static .. static_footer local F F = io.open(static_fname, 'w') diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 73af78d3e2..0ccf1823f8 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -26,7 +26,6 @@ #include "nvim/ex_cmds.h" #include "nvim/ex_docmd.h" #include "nvim/ex_getln.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" diff --git a/src/nvim/hashtab.c b/src/nvim/hashtab.c index 475666be5e..e6a0e55ed2 100644 --- a/src/nvim/hashtab.c +++ b/src/nvim/hashtab.c @@ -24,7 +24,6 @@ #include <string.h> #include "nvim/ascii_defs.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/hashtab.h" #include "nvim/memory.h" diff --git a/src/nvim/help.c b/src/nvim/help.c index c23dc7fd9d..dc4f6c44ff 100644 --- a/src/nvim/help.c +++ b/src/nvim/help.c @@ -16,7 +16,6 @@ #include "nvim/ex_docmd.h" #include "nvim/extmark_defs.h" #include "nvim/fileio.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 3f1758894e..3953a459bc 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -24,7 +24,6 @@ #include "nvim/eval/typval_defs.h" #include "nvim/eval/vars.h" #include "nvim/ex_docmd.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/indent.c b/src/nvim/indent.c index 348f3a6528..5dced37b40 100644 --- a/src/nvim/indent.c +++ b/src/nvim/indent.c @@ -17,7 +17,6 @@ #include "nvim/ex_cmds_defs.h" #include "nvim/ex_docmd.h" #include "nvim/extmark.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/indent.h" diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c index c140d468d8..6c133c1e99 100644 --- a/src/nvim/indent_c.c +++ b/src/nvim/indent_c.c @@ -9,7 +9,6 @@ #include "nvim/charset.h" #include "nvim/cursor.h" #include "nvim/edit.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/indent.h" #include "nvim/indent_c.h" diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index 12543a2d42..8bf5e2c113 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -24,7 +24,6 @@ #include "nvim/ex_eval.h" #include "nvim/ex_getln.h" #include "nvim/fileio.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" diff --git a/src/nvim/keycodes.c b/src/nvim/keycodes.c index 745500fe39..49ec245359 100644 --- a/src/nvim/keycodes.c +++ b/src/nvim/keycodes.c @@ -10,7 +10,6 @@ #include "nvim/charset.h" #include "nvim/eval/typval_defs.h" #include "nvim/eval/vars.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/keycodes.h" diff --git a/src/nvim/lib/queue.h b/src/nvim/lib/queue.h index 40769e44b5..0c4ab7e9ed 100644 --- a/src/nvim/lib/queue.h +++ b/src/nvim/lib/queue.h @@ -44,22 +44,29 @@ typedef struct _queue { } // ffi.cdef is unable to swallow `bool` in place of `int` here. +static inline int QUEUE_EMPTY(const QUEUE *q) + REAL_FATTR_ALWAYS_INLINE REAL_FATTR_PURE REAL_FATTR_WARN_UNUSED_RESULT; + static inline int QUEUE_EMPTY(const QUEUE *const q) - FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT { return q == q->next; } #define QUEUE_HEAD(q) (q)->next -static inline void QUEUE_INIT(QUEUE *const q) FUNC_ATTR_ALWAYS_INLINE +static inline void QUEUE_INIT(QUEUE *q) + REAL_FATTR_ALWAYS_INLINE; + +static inline void QUEUE_INIT(QUEUE *const q) { q->next = q; q->prev = q; } +static inline void QUEUE_ADD(QUEUE *h, QUEUE *n) + REAL_FATTR_ALWAYS_INLINE; + static inline void QUEUE_ADD(QUEUE *const h, QUEUE *const n) - FUNC_ATTR_ALWAYS_INLINE { h->prev->next = n->next; n->next->prev = h->prev; @@ -67,8 +74,10 @@ static inline void QUEUE_ADD(QUEUE *const h, QUEUE *const n) h->prev->next = h; } +static inline void QUEUE_INSERT_HEAD(QUEUE *h, QUEUE *q) + REAL_FATTR_ALWAYS_INLINE; + static inline void QUEUE_INSERT_HEAD(QUEUE *const h, QUEUE *const q) - FUNC_ATTR_ALWAYS_INLINE { q->next = h->next; q->prev = h; @@ -76,8 +85,10 @@ static inline void QUEUE_INSERT_HEAD(QUEUE *const h, QUEUE *const q) h->next = q; } +static inline void QUEUE_INSERT_TAIL(QUEUE *h, QUEUE *q) + REAL_FATTR_ALWAYS_INLINE; + static inline void QUEUE_INSERT_TAIL(QUEUE *const h, QUEUE *const q) - FUNC_ATTR_ALWAYS_INLINE { q->next = h; q->prev = h->prev; @@ -85,7 +96,10 @@ static inline void QUEUE_INSERT_TAIL(QUEUE *const h, QUEUE *const q) h->prev = q; } -static inline void QUEUE_REMOVE(QUEUE *const q) FUNC_ATTR_ALWAYS_INLINE +static inline void QUEUE_REMOVE(QUEUE *q) + REAL_FATTR_ALWAYS_INLINE; + +static inline void QUEUE_REMOVE(QUEUE *const q) { q->prev->next = q->next; q->next->prev = q->prev; diff --git a/src/nvim/log.c b/src/nvim/log.c index aeee088cd3..a93dab6238 100644 --- a/src/nvim/log.c +++ b/src/nvim/log.c @@ -19,7 +19,6 @@ #include "auto/config.h" #include "nvim/ascii_defs.h" #include "nvim/eval.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/log.h" #include "nvim/memory.h" diff --git a/src/nvim/lua/converter.c b/src/nvim/lua/converter.c index 4598d48c4a..fd2bdbd677 100644 --- a/src/nvim/lua/converter.c +++ b/src/nvim/lua/converter.c @@ -16,7 +16,6 @@ #include "nvim/eval/typval_defs.h" #include "nvim/eval/typval_encode.h" #include "nvim/eval/userfunc.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/lua/converter.h" #include "nvim/lua/executor.h" diff --git a/src/nvim/lua/stdlib.c b/src/nvim/lua/stdlib.c index 33770b2e62..d7a7abe3c8 100644 --- a/src/nvim/lua/stdlib.c +++ b/src/nvim/lua/stdlib.c @@ -22,7 +22,6 @@ #include "nvim/eval/vars.h" #include "nvim/ex_eval.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/lua/base64.h" #include "nvim/lua/converter.h" diff --git a/src/nvim/main.c b/src/nvim/main.c index 6585bd1df7..544196d78a 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -44,7 +44,6 @@ #include "nvim/ex_getln.h" #include "nvim/fileio.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c index 17593a9121..56544a9956 100644 --- a/src/nvim/mapping.c +++ b/src/nvim/mapping.c @@ -24,7 +24,6 @@ #include "nvim/eval/typval_defs.h" #include "nvim/ex_cmds_defs.h" #include "nvim/ex_session.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" @@ -143,7 +142,7 @@ mapblock_T *get_buf_maphash_list(int state, int c) /// @param index The index in the maphash[] /// @param buf The buffer to get the maphash from. NULL for global mapblock_T *get_maphash(int index, buf_T *buf) - FUNC_ATTR_PURE + FUNC_ATTR_PURE { if (index >= MAX_MAPHASH) { return NULL; diff --git a/src/nvim/mark.h b/src/nvim/mark.h index 3237ae541e..c73c649789 100644 --- a/src/nvim/mark.h +++ b/src/nvim/mark.h @@ -50,9 +50,11 @@ SET_FMARK(&(xfmarkp__->fmark), mark_, fnum_, view_); \ } while (0) +static inline int mark_global_index(char name) + REAL_FATTR_CONST; + /// Convert mark name to the offset static inline int mark_global_index(const char name) - FUNC_ATTR_CONST { return (ASCII_ISUPPER(name) ? (name - 'A') @@ -61,9 +63,11 @@ static inline int mark_global_index(const char name) : -1)); } +static inline int mark_local_index(char name) + REAL_FATTR_CONST; + /// Convert local mark name to the offset static inline int mark_local_index(const char name) - FUNC_ATTR_CONST { return (ASCII_ISLOWER(name) ? (name - 'a') diff --git a/src/nvim/match.c b/src/nvim/match.c index 0a7c264d4f..7543fb2b9d 100644 --- a/src/nvim/match.c +++ b/src/nvim/match.c @@ -16,7 +16,6 @@ #include "nvim/ex_cmds_defs.h" #include "nvim/ex_docmd.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/highlight.h" diff --git a/src/nvim/math.c b/src/nvim/math.c index 96ff1bef10..79e0be691b 100644 --- a/src/nvim/math.c +++ b/src/nvim/math.c @@ -7,10 +7,11 @@ #include "nvim/math.h" #ifdef INCLUDE_GENERATED_DECLARATIONS -# include "math.c.generated.h" // IWYU pragma: export +# include "math.c.generated.h" #endif int xfpclassify(double d) + FUNC_ATTR_CONST { uint64_t m; @@ -29,11 +30,13 @@ int xfpclassify(double d) } int xisinf(double d) + FUNC_ATTR_CONST { return FP_INFINITE == xfpclassify(d); } int xisnan(double d) + FUNC_ATTR_CONST { return FP_NAN == xfpclassify(d); } diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 3c671121b7..5e768839ba 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -56,7 +56,6 @@ #include "nvim/eval/typval.h" #include "nvim/ex_cmds_defs.h" #include "nvim/fileio.h" -#include "nvim/func_attr.h" #include "nvim/getchar.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/memory.c b/src/nvim/memory.c index df6c81fe0d..35ae6afde7 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -16,7 +16,6 @@ #include "nvim/decoration_provider.h" #include "nvim/drawline.h" #include "nvim/eval.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/highlight.h" diff --git a/src/nvim/menu.c b/src/nvim/menu.c index 3252a73970..bc850d8961 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -15,7 +15,6 @@ #include "nvim/eval/typval.h" #include "nvim/ex_cmds_defs.h" #include "nvim/ex_docmd.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" diff --git a/src/nvim/message.c b/src/nvim/message.c index 3268ff389a..8d11b793dc 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -24,7 +24,6 @@ #include "nvim/ex_cmds_defs.h" #include "nvim/ex_eval.h" #include "nvim/fileio.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c index 8fe3864424..7a7b687385 100644 --- a/src/nvim/mouse.c +++ b/src/nvim/mouse.c @@ -15,7 +15,6 @@ #include "nvim/eval/typval.h" #include "nvim/ex_docmd.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/getchar.h" #include "nvim/globals.h" #include "nvim/grid.h" diff --git a/src/nvim/move.c b/src/nvim/move.c index 9ed3978490..227d064a27 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -22,7 +22,6 @@ #include "nvim/eval/typval.h" #include "nvim/eval/window.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/getchar.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index 0fb1ebf931..50210e4936 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -20,7 +20,6 @@ #include "nvim/event/rstream.h" #include "nvim/event/stream.h" #include "nvim/event/wstream.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/log.h" #include "nvim/main.h" diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c index 1fdfc9e536..d2be321e7a 100644 --- a/src/nvim/msgpack_rpc/helpers.c +++ b/src/nvim/msgpack_rpc/helpers.c @@ -10,7 +10,6 @@ #include "msgpack/pack.h" #include "nvim/api/private/helpers.h" #include "nvim/assert_defs.h" -#include "nvim/func_attr.h" #include "nvim/memory.h" #include "nvim/msgpack_rpc/helpers.h" #include "nvim/types_defs.h" diff --git a/src/nvim/msgpack_rpc/server.c b/src/nvim/msgpack_rpc/server.c index f3627eaa61..e60c1b88a5 100644 --- a/src/nvim/msgpack_rpc/server.c +++ b/src/nvim/msgpack_rpc/server.c @@ -7,7 +7,6 @@ #include "nvim/channel.h" #include "nvim/eval.h" #include "nvim/event/socket.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/log.h" #include "nvim/main.h" diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 1f789dc153..8083bb00f5 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -34,7 +34,6 @@ #include "nvim/ex_getln.h" #include "nvim/fileio.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/getchar.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/ops.h b/src/nvim/ops.h index 67a613cbca..4dab51b15d 100644 --- a/src/nvim/ops.h +++ b/src/nvim/ops.h @@ -102,13 +102,15 @@ typedef enum { YREG_PUT, } yreg_mode_t; +static inline int op_reg_index(int regname) + REAL_FATTR_CONST; + /// Convert register name into register index /// /// @param[in] regname Register name. /// /// @return Index in y_regs array or -1 if register name was not recognized. static inline int op_reg_index(const int regname) - FUNC_ATTR_CONST { if (ascii_isdigit(regname)) { return regname - '0'; @@ -127,11 +129,13 @@ static inline int op_reg_index(const int regname) } } +static inline bool is_literal_register(int regname) + REAL_FATTR_CONST; + /// @see get_yank_register /// @return true when register should be inserted literally /// (selection or clipboard) static inline bool is_literal_register(const int regname) - FUNC_ATTR_CONST { return regname == '*' || regname == '+'; } diff --git a/src/nvim/option.c b/src/nvim/option.c index 96d6d8e01e..882722a575 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -49,7 +49,6 @@ #include "nvim/ex_getln.h" #include "nvim/ex_session.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c index 281ec86171..0a7d77e817 100644 --- a/src/nvim/optionstr.c +++ b/src/nvim/optionstr.c @@ -19,7 +19,6 @@ #include "nvim/eval/vars.h" #include "nvim/ex_getln.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/highlight_group.h" diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index 8620c79069..b1e680e469 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -14,7 +14,6 @@ #include "nvim/charset.h" #include "nvim/cmdexpand.h" #include "nvim/eval.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/log.h" @@ -46,6 +45,10 @@ # include <sys/utsname.h> #endif +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "os/env.c.generated.h" +#endif + // Because `uv_os_getenv` requires allocating, we must manage a map to maintain // the behavior of `os_getenv`. static PMap(cstr_t) envmap = MAP_INIT; diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index 8f939c3b40..a8c7fcc38f 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -17,7 +17,6 @@ #endif #include "auto/config.h" -#include "nvim/func_attr.h" #include "nvim/os/fs.h" #if defined(HAVE_ACL) diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c index f3bd1c7ed9..b86c51424c 100644 --- a/src/nvim/os/input.c +++ b/src/nvim/os/input.c @@ -12,7 +12,6 @@ #include "nvim/event/multiqueue.h" #include "nvim/event/rstream.h" #include "nvim/event/stream.h" -#include "nvim/func_attr.h" #include "nvim/getchar.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/os/process.c b/src/nvim/os/process.c index d9ec3a7a8a..5263451488 100644 --- a/src/nvim/os/process.c +++ b/src/nvim/os/process.c @@ -44,7 +44,7 @@ #endif #ifdef INCLUDE_GENERATED_DECLARATIONS -# include "os/process.c.generated.h" // IWYU pragma: export +# include "os/process.c.generated.h" #endif #ifdef MSWIN @@ -114,6 +114,7 @@ bool os_proc_tree_kill(int pid, int sig) /// @param[out] proc_count Number of child processes. /// @return 0 on success, 1 if process not found, 2 on other error. int os_proc_children(int ppid, int **proc_list, size_t *proc_count) + FUNC_ATTR_NONNULL_ALL { if (ppid < 0) { return 2; diff --git a/src/nvim/os/pty_process_unix.c b/src/nvim/os/pty_process_unix.c index f801646967..d4be3086ea 100644 --- a/src/nvim/os/pty_process_unix.c +++ b/src/nvim/os/pty_process_unix.c @@ -35,7 +35,6 @@ #include "nvim/event/loop.h" #include "nvim/event/process.h" #include "nvim/event/stream.h" -#include "nvim/func_attr.h" #include "nvim/log.h" #include "nvim/os/fs.h" #include "nvim/os/os_defs.h" diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index 191be784e8..cb8066a62d 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -20,7 +20,6 @@ #include "nvim/event/wstream.h" #include "nvim/ex_cmds.h" #include "nvim/fileio.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/macros_defs.h" diff --git a/src/nvim/os/signal.c b/src/nvim/os/signal.c index c920cb655e..3a861b87b4 100644 --- a/src/nvim/os/signal.c +++ b/src/nvim/os/signal.c @@ -9,7 +9,6 @@ #include "nvim/autocmd.h" #include "nvim/eval.h" #include "nvim/event/signal.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/log.h" #include "nvim/main.h" diff --git a/src/nvim/os/stdpaths.c b/src/nvim/os/stdpaths.c index 7691aa5122..ede17bc7c8 100644 --- a/src/nvim/os/stdpaths.c +++ b/src/nvim/os/stdpaths.c @@ -4,13 +4,16 @@ #include "nvim/ascii_defs.h" #include "nvim/fileio.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/memory.h" #include "nvim/os/os.h" #include "nvim/os/stdpaths_defs.h" #include "nvim/path.h" +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "os/stdpaths.c.generated.h" +#endif + /// Names of the environment variables, mapped to XDGVarType values static const char *xdg_env_vars[] = { [kXDGConfigHome] = "XDG_CONFIG_HOME", diff --git a/src/nvim/os/time.c b/src/nvim/os/time.c index 49b43af6c0..7f3e44f680 100644 --- a/src/nvim/os/time.c +++ b/src/nvim/os/time.c @@ -8,7 +8,6 @@ #include "auto/config.h" #include "nvim/event/loop.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/log.h" @@ -19,7 +18,7 @@ #include "nvim/os/time.h" #ifdef INCLUDE_GENERATED_DECLARATIONS -# include "os/time.c.generated.h" // IWYU pragma: export +# include "os/time.c.generated.h" #endif /// Gets a high-resolution (nanosecond), monotonically-increasing time relative diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c index ae0994a73f..5db7a19411 100644 --- a/src/nvim/os/users.c +++ b/src/nvim/os/users.c @@ -22,6 +22,10 @@ # include "nvim/message.h" #endif +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "os/users.c.generated.h" +#endif + // All user names (for ~user completion as done by shell). static garray_T ga_users = GA_EMPTY_INIT_VALUE; diff --git a/src/nvim/path.c b/src/nvim/path.c index c7212c7ade..100d66dfff 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -153,7 +153,7 @@ char *path_tail_with_sep(char *fname) /// /// @return The position of the last path separator + 1. const char *invocation_path_tail(const char *invocation, size_t *len) - FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ARG(1) + FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ARG(1) { const char *tail = get_past_head(invocation); const char *p = tail; diff --git a/src/nvim/plines.c b/src/nvim/plines.c index 6e9f92c193..fbddb1ab4a 100644 --- a/src/nvim/plines.c +++ b/src/nvim/plines.c @@ -10,7 +10,6 @@ #include "nvim/decoration.h" #include "nvim/diff.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/indent.h" #include "nvim/macros_defs.h" diff --git a/src/nvim/profile.c b/src/nvim/profile.c index 53ff57dacb..543f91304a 100644 --- a/src/nvim/profile.c +++ b/src/nvim/profile.c @@ -15,7 +15,6 @@ #include "nvim/eval/userfunc.h" #include "nvim/ex_cmds_defs.h" #include "nvim/fileio.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 4e20eb8925..112f9aa35a 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -29,7 +29,6 @@ #include "nvim/ex_getln.h" #include "nvim/fileio.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/rbuffer.c b/src/nvim/rbuffer.c index f74f68adb6..aff06ee31b 100644 --- a/src/nvim/rbuffer.c +++ b/src/nvim/rbuffer.c @@ -3,13 +3,12 @@ #include <stddef.h> #include <string.h> -#include "nvim/func_attr.h" #include "nvim/macros_defs.h" #include "nvim/memory.h" #include "nvim/rbuffer.h" #ifdef INCLUDE_GENERATED_DECLARATIONS -# include "rbuffer.c.generated.h" // IWYU pragma: export +# include "rbuffer.c.generated.h" #endif /// Creates a new `RBuffer` instance. @@ -214,7 +213,7 @@ size_t rbuffer_read(RBuffer *buf, char *dst, size_t dst_size) } char *rbuffer_get(RBuffer *buf, size_t index) - FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET { assert(index < buf->size); char *rptr = buf->read_ptr + index; diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 3536196a3b..20c06340be 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -21,7 +21,6 @@ #include "nvim/eval.h" #include "nvim/eval/typval.h" #include "nvim/eval/userfunc.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index 38d3942126..087c26a46f 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -26,7 +26,6 @@ #include "nvim/ex_cmds_defs.h" #include "nvim/ex_docmd.h" #include "nvim/ex_eval.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" diff --git a/src/nvim/search.c b/src/nvim/search.c index 642219c1e0..a23d27635f 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -24,7 +24,6 @@ #include "nvim/ex_getln.h" #include "nvim/fileio.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/getchar.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/shada.c b/src/nvim/shada.c index be898142f0..d288c36f65 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -25,7 +25,6 @@ #include "nvim/ex_cmds.h" #include "nvim/ex_docmd.h" #include "nvim/fileio.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/sign.c b/src/nvim/sign.c index d05c708d2c..f901f371ce 100644 --- a/src/nvim/sign.c +++ b/src/nvim/sign.c @@ -26,7 +26,6 @@ #include "nvim/ex_docmd.h" #include "nvim/extmark.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/highlight.h" @@ -46,6 +45,10 @@ #include "nvim/vim_defs.h" #include "nvim/window.h" +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "sign.c.generated.h" +#endif + static PMap(cstr_t) sign_map INIT( = MAP_INIT); static kvec_t(Integer) sign_ns INIT( = MAP_INIT); @@ -910,7 +913,7 @@ static dict_T *sign_get_placed_info_dict(MTKey mark) /// Returns information about signs placed in a buffer as list of dicts. list_T *get_buffer_signs(buf_T *buf) - FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT + FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT { list_T *const l = tv_list_alloc(kListLenMayKnow); MarkTreeIter itr[1]; diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 905f5c25b4..5065bee347 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -73,7 +73,6 @@ #include "nvim/ex_cmds.h" #include "nvim/ex_cmds_defs.h" #include "nvim/ex_docmd.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 2607fddc31..4aa0508329 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -241,7 +241,6 @@ #include "nvim/drawscreen.h" #include "nvim/ex_cmds_defs.h" #include "nvim/fileio.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/spellsuggest.c b/src/nvim/spellsuggest.c index d9dd28527e..bdac5aa587 100644 --- a/src/nvim/spellsuggest.c +++ b/src/nvim/spellsuggest.c @@ -17,7 +17,6 @@ #include "nvim/eval.h" #include "nvim/eval/typval.h" #include "nvim/fileio.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/garray_defs.h" #include "nvim/getchar.h" diff --git a/src/nvim/state.c b/src/nvim/state.c index 900eac0826..199003b61c 100644 --- a/src/nvim/state.c +++ b/src/nvim/state.c @@ -26,10 +26,11 @@ #include "nvim/ui.h" #ifdef INCLUDE_GENERATED_DECLARATIONS -# include "state.c.generated.h" // IWYU pragma: export +# include "state.c.generated.h" #endif void state_enter(VimState *s) + FUNC_ATTR_NONNULL_ALL { while (true) { int check_result = s->check ? s->check(s) : 1; @@ -168,6 +169,7 @@ int get_real_state(void) /// The first character represents the major mode, the following ones the minor /// ones. void get_mode(char *buf) + FUNC_ATTR_NONNULL_ALL { int i = 0; diff --git a/src/nvim/strings.c b/src/nvim/strings.c index a439d11818..169909ea56 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -30,6 +30,10 @@ #include "nvim/types_defs.h" #include "nvim/vim_defs.h" +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "strings.c.generated.h" +#endif + static const char e_cannot_mix_positional_and_non_positional_str[] = N_("E1500: Cannot mix positional and non-positional arguments: %s"); static const char e_fmt_arg_nr_unused_str[] @@ -461,9 +465,6 @@ char *vim_strchr(const char *const string, const int c) // Sort an array of strings. -#ifdef INCLUDE_GENERATED_DECLARATIONS -# include "strings.c.generated.h" -#endif static int sort_compare(const void *s1, const void *s2) FUNC_ATTR_NONNULL_ALL { diff --git a/src/nvim/strings.h b/src/nvim/strings.h index d717362f87..8478676f13 100644 --- a/src/nvim/strings.h +++ b/src/nvim/strings.h @@ -10,6 +10,10 @@ #include "nvim/os/os_defs.h" #include "nvim/types_defs.h" // IWYU pragma: keep +static inline char *strappend(char *dst, const char *src) + REAL_FATTR_ALWAYS_INLINE REAL_FATTR_NONNULL_ALL + REAL_FATTR_NONNULL_RET REAL_FATTR_WARN_UNUSED_RESULT; + /// Append string to string and return pointer to the next byte /// /// Unlike strcat, this one does *not* add NUL byte and returns pointer to the @@ -20,8 +24,6 @@ /// /// @return pointer to the byte just past the appended byte. static inline char *strappend(char *const dst, const char *const src) - FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT - FUNC_ATTR_NONNULL_RET { const size_t src_len = strlen(src); return (char *)memmove(dst, src, src_len) + src_len; diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 11282ea170..f6f0fca74a 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -20,7 +20,6 @@ #include "nvim/ex_cmds_defs.h" #include "nvim/ex_docmd.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/tag.c b/src/nvim/tag.c index c6a1a13606..7fa02d2e0a 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -23,7 +23,6 @@ #include "nvim/file_search.h" #include "nvim/fileio.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 1527738165..03a7744b18 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -59,7 +59,6 @@ #include "nvim/event/multiqueue.h" #include "nvim/event/time.h" #include "nvim/ex_docmd.h" -#include "nvim/func_attr.h" #include "nvim/getchar.h" #include "nvim/globals.h" #include "nvim/highlight.h" diff --git a/src/nvim/testing.c b/src/nvim/testing.c index cada04d276..6515da7500 100644 --- a/src/nvim/testing.c +++ b/src/nvim/testing.c @@ -12,7 +12,6 @@ #include "nvim/eval/typval.h" #include "nvim/eval/typval_defs.h" #include "nvim/ex_docmd.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/textformat.c b/src/nvim/textformat.c index b69d438a59..7219e04add 100644 --- a/src/nvim/textformat.c +++ b/src/nvim/textformat.c @@ -14,7 +14,6 @@ #include "nvim/eval.h" #include "nvim/eval/typval_defs.h" #include "nvim/ex_cmds_defs.h" -#include "nvim/func_attr.h" #include "nvim/getchar.h" #include "nvim/globals.h" #include "nvim/indent.h" diff --git a/src/nvim/textobject.c b/src/nvim/textobject.c index d4310d47a4..6e61e9be61 100644 --- a/src/nvim/textobject.c +++ b/src/nvim/textobject.c @@ -11,7 +11,6 @@ #include "nvim/edit.h" #include "nvim/eval/funcs.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/indent.h" #include "nvim/macros_defs.h" diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c index bdbb5e4872..639bfc0f79 100644 --- a/src/nvim/tui/input.c +++ b/src/nvim/tui/input.c @@ -7,7 +7,6 @@ #include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/event/defs.h" -#include "nvim/func_attr.h" #include "nvim/macros_defs.h" #include "nvim/main.h" #include "nvim/map_defs.h" diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 197bbcabb5..78e6cdf32a 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -18,7 +18,6 @@ #include "nvim/event/loop.h" #include "nvim/event/signal.h" #include "nvim/event/stream.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/grid.h" #include "nvim/highlight_defs.h" diff --git a/src/nvim/ui_client.c b/src/nvim/ui_client.c index 30f44d182d..a7a1c5912a 100644 --- a/src/nvim/ui_client.c +++ b/src/nvim/ui_client.c @@ -11,7 +11,6 @@ #include "nvim/eval.h" #include "nvim/eval/typval_defs.h" #include "nvim/event/loop.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/highlight.h" #include "nvim/log.h" diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 93a973c33d..928dd2967c 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -99,7 +99,6 @@ #include "nvim/extmark.h" #include "nvim/fileio.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" diff --git a/src/nvim/usercmd.c b/src/nvim/usercmd.c index 7c65af5138..9872468ba9 100644 --- a/src/nvim/usercmd.c +++ b/src/nvim/usercmd.c @@ -16,7 +16,6 @@ #include "nvim/cmdexpand_defs.h" #include "nvim/eval.h" #include "nvim/ex_docmd.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/gettext.h" #include "nvim/globals.h" diff --git a/src/nvim/version.c b/src/nvim/version.c index cb9088afae..fc93a01b32 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -20,7 +20,6 @@ #include "nvim/charset.h" #include "nvim/drawscreen.h" #include "nvim/ex_cmds_defs.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/globals.h" #include "nvim/grid.h" diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index 8b637fbb9b..11f5276053 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -59,7 +59,6 @@ #include "nvim/assert_defs.h" #include "nvim/charset.h" #include "nvim/eval.h" -#include "nvim/func_attr.h" #include "nvim/gettext.h" #include "nvim/keycodes.h" #include "nvim/macros_defs.h" diff --git a/src/nvim/viml/parser/parser.c b/src/nvim/viml/parser/parser.c index b854aedca6..d8679208c3 100644 --- a/src/nvim/viml/parser/parser.c +++ b/src/nvim/viml/parser/parser.c @@ -5,6 +5,7 @@ #endif void parser_simple_get_line(void *cookie, ParserLine *ret_pline) + FUNC_ATTR_NONNULL_ALL { ParserLine **plines_p = (ParserLine **)cookie; *ret_pline = **plines_p; diff --git a/src/nvim/window.c b/src/nvim/window.c index bcf245ef93..7728efde33 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -33,7 +33,6 @@ #include "nvim/file_search.h" #include "nvim/fileio.h" #include "nvim/fold.h" -#include "nvim/func_attr.h" #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" diff --git a/src/nvim/winfloat.c b/src/nvim/winfloat.c index 44f0e2fc0b..0eea21eb9d 100644 --- a/src/nvim/winfloat.c +++ b/src/nvim/winfloat.c @@ -9,7 +9,6 @@ #include "nvim/ascii_defs.h" #include "nvim/buffer_defs.h" #include "nvim/drawscreen.h" -#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/grid.h" #include "nvim/macros_defs.h" |