aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.h
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2024-06-13 12:00:58 +0200
committerbfredl <bjorn.linse@gmail.com>2024-07-13 12:30:49 +0200
commit7dffc36e61c46e6adc92cff5944e876446f3c40e (patch)
tree99278b5578dbcf5cbe5e53ca158bfc0de5df58d1 /src/nvim/ops.h
parentb0f39f3ef5502c037b5bdb0da3d45d312b7fdc2a (diff)
downloadrneovim-7dffc36e61c46e6adc92cff5944e876446f3c40e.tar.gz
rneovim-7dffc36e61c46e6adc92cff5944e876446f3c40e.tar.bz2
rneovim-7dffc36e61c46e6adc92cff5944e876446f3c40e.zip
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).
Diffstat (limited to 'src/nvim/ops.h')
-rw-r--r--src/nvim/ops.h16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/nvim/ops.h b/src/nvim/ops.h
index 1a708fab03..f2b38e5faf 100644
--- a/src/nvim/ops.h
+++ b/src/nvim/ops.h
@@ -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 "."