mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
refactor(declarations): also generate prototypes for functions in headers
Before this change, "static inline" functions in headers needed to have their function attributes specified in a completely different way. The prototype had to be duplicated, and REAL_FATTR_ had to be used instead of the public FUNC_ATTR_ names. TODO: need a check that a "header.h.inline.generated.h" file is not forgotten when the first "static inline" function with attributes is added to a header (they would just be silently missing).
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
#include "nvim/eval/typval_defs.h"
|
||||
#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
|
||||
#include "nvim/extmark_defs.h" // IWYU pragma: keep
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/normal_defs.h"
|
||||
#include "nvim/option_defs.h" // IWYU pragma: keep
|
||||
@@ -121,8 +120,10 @@ typedef enum {
|
||||
YREG_PUT,
|
||||
} yreg_mode_t;
|
||||
|
||||
static inline int op_reg_index(int regname)
|
||||
REAL_FATTR_CONST;
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "ops.h.generated.h"
|
||||
# include "ops.h.inline.generated.h"
|
||||
#endif
|
||||
|
||||
/// Convert register name into register index
|
||||
///
|
||||
@@ -130,6 +131,7 @@ static inline int op_reg_index(int regname)
|
||||
///
|
||||
/// @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';
|
||||
@@ -148,19 +150,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 == '+';
|
||||
}
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "ops.h.generated.h"
|
||||
#endif
|
||||
|
||||
EXTERN LuaRef repeat_luaref INIT( = LUA_NOREF); ///< LuaRef for "."
|
||||
|
Reference in New Issue
Block a user