aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
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/os
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/os')
-rw-r--r--src/nvim/os/fileio_defs.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/nvim/os/fileio_defs.h b/src/nvim/os/fileio_defs.h
index 0f76fdb2aa..47f0629ccf 100644
--- a/src/nvim/os/fileio_defs.h
+++ b/src/nvim/os/fileio_defs.h
@@ -3,8 +3,6 @@
#include <stdbool.h>
#include <stdint.h>
-#include "nvim/func_attr.h"
-
/// Structure used to read from/write to file
typedef struct {
int fd; ///< File descriptor. Can be -1 if no backing file (file_open_buffer)
@@ -17,8 +15,9 @@ typedef struct {
uint64_t bytes_read; ///< total bytes read so far
} FileDescriptor;
-static inline bool file_eof(const FileDescriptor *fp)
- REAL_FATTR_ALWAYS_INLINE REAL_FATTR_WARN_UNUSED_RESULT REAL_FATTR_NONNULL_ALL;
+#ifdef INCLUDE_GENERATED_DECLARATIONS
+# include "os/fileio_defs.h.inline.generated.h"
+#endif
/// Check whether end of file was encountered
///
@@ -27,19 +26,18 @@ static inline bool file_eof(const FileDescriptor *fp)
/// @return true if it was, false if it was not or read operation was never
/// performed.
static inline bool file_eof(const FileDescriptor *const fp)
+ FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
return fp->eof && fp->read_pos == fp->write_pos;
}
-static inline int file_fd(const FileDescriptor *fp)
- REAL_FATTR_ALWAYS_INLINE REAL_FATTR_WARN_UNUSED_RESULT REAL_FATTR_NONNULL_ALL;
-
/// Return the file descriptor associated with the FileDescriptor structure
///
/// @param[in] fp File to check.
///
/// @return File descriptor.
static inline int file_fd(const FileDescriptor *const fp)
+ FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
return fp->fd;
}