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

@@ -3,7 +3,6 @@
#include <stdbool.h>
#include <stdint.h>
#include "nvim/func_attr.h"
#include "nvim/option_vars.h"
#include "nvim/strings.h" // IWYU pragma: keep
@@ -31,15 +30,13 @@ typedef enum {
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "charset.h.generated.h"
# include "charset.h.inline.generated.h"
#endif
static inline bool vim_isbreak(int c)
REAL_FATTR_CONST
REAL_FATTR_ALWAYS_INLINE;
/// Check if `c` is one of the characters in 'breakat'.
/// Used very often if 'linebreak' is set
static inline bool vim_isbreak(int c)
FUNC_ATTR_CONST FUNC_ATTR_ALWAYS_INLINE
{
return breakat_flags[(uint8_t)c];
}