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:
bfredl
2024-06-13 12:00:58 +02:00
parent b0f39f3ef5
commit 7dffc36e61
20 changed files with 187 additions and 245 deletions

View File

@@ -5,19 +5,18 @@
#include "nvim/ascii_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/mark_defs.h" // IWYU pragma: keep
#include "nvim/os/time.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "mark.h.generated.h"
# include "mark.h.inline.generated.h"
#endif
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')
@@ -26,10 +25,9 @@ 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')