refactor: iwyu (#26269)

This commit is contained in:
zeertzjq 2023-11-28 19:00:14 +08:00 committed by GitHub
parent ba564442ae
commit c9f53d0e40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 66 additions and 67 deletions

View File

@ -3,9 +3,9 @@
#include <stdint.h> // IWYU pragma: keep
#include "nvim/api/private/defs.h" // IWYU pragma: keep
#include "nvim/grid_defs.h" // IWYU pragma: keep
#include "nvim/highlight_defs.h" // IWYU pragma: keep
#include "nvim/map.h"
#include "nvim/types_defs.h" // IWYU pragma: keep
#include "nvim/ui.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS

View File

@ -9,63 +9,62 @@
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/func_attr.h"
#include "nvim/grid_defs.h"
#include "nvim/macros.h"
#include "nvim/memline.h"
#include "nvim/memline_defs.h"
#include "nvim/pos_defs.h"
// Values for buflist_getfile()
/// Values for buflist_getfile()
enum getf_values {
GETF_SETMARK = 0x01, // set pcmark before jumping
GETF_ALT = 0x02, // jumping to alternate file (not buf num)
GETF_SWITCH = 0x04, // respect 'switchbuf' settings when jumping
GETF_SETMARK = 0x01, ///< set pcmark before jumping
GETF_ALT = 0x02, ///< jumping to alternate file (not buf num)
GETF_SWITCH = 0x04, ///< respect 'switchbuf' settings when jumping
};
// Return values of getfile()
enum getf_retvalues {
GETFILE_ERROR = 1, // normal error
GETFILE_NOT_WRITTEN = 2, // "not written" error
GETFILE_SAME_FILE = 0, // success, same file
GETFILE_OPEN_OTHER = (-1), // success, opened another file
GETFILE_ERROR = 1, ///< normal error
GETFILE_NOT_WRITTEN = 2, ///< "not written" error
GETFILE_SAME_FILE = 0, ///< success, same file
GETFILE_OPEN_OTHER = -1, ///< success, opened another file
GETFILE_UNUSED = 8,
};
// Values for buflist_new() flags
/// Values for buflist_new() flags
enum bln_values {
BLN_CURBUF = 1, // May re-use curbuf for new buffer
BLN_LISTED = 2, // Put new buffer in buffer list
BLN_DUMMY = 4, // Allocating dummy buffer
BLN_NEW = 8, // create a new buffer
BLN_NOOPT = 16, // Don't copy options to existing buffer
BLN_CURBUF = 1, ///< May re-use curbuf for new buffer
BLN_LISTED = 2, ///< Put new buffer in buffer list
BLN_DUMMY = 4, ///< Allocating dummy buffer
BLN_NEW = 8, ///< create a new buffer
BLN_NOOPT = 16, ///< Don't copy options to existing buffer
// BLN_DUMMY_OK = 32, // also find an existing dummy buffer
// BLN_REUSE = 64, // may re-use number from buf_reuse
BLN_NOCURWIN = 128, // buffer is not associated with curwin
BLN_NOCURWIN = 128, ///< buffer is not associated with curwin
};
// Values for action argument for do_buffer()
/// Values for action argument for do_buffer()
enum dobuf_action_values {
DOBUF_GOTO = 0, // go to specified buffer
DOBUF_SPLIT = 1, // split window and go to specified buffer
DOBUF_UNLOAD = 2, // unload specified buffer(s)
DOBUF_DEL = 3, // delete specified buffer(s) from buflist
DOBUF_WIPE = 4, // delete specified buffer(s) really
DOBUF_GOTO = 0, ///< go to specified buffer
DOBUF_SPLIT = 1, ///< split window and go to specified buffer
DOBUF_UNLOAD = 2, ///< unload specified buffer(s)
DOBUF_DEL = 3, ///< delete specified buffer(s) from buflist
DOBUF_WIPE = 4, ///< delete specified buffer(s) really
};
// Values for start argument for do_buffer()
/// Values for start argument for do_buffer()
enum dobuf_start_values {
DOBUF_CURRENT = 0, // "count" buffer from current buffer
DOBUF_FIRST = 1, // "count" buffer from first buffer
DOBUF_LAST = 2, // "count" buffer from last buffer
DOBUF_MOD = 3, // "count" mod. buffer from current buffer
DOBUF_CURRENT = 0, ///< "count" buffer from current buffer
DOBUF_FIRST = 1, ///< "count" buffer from first buffer
DOBUF_LAST = 2, ///< "count" buffer from last buffer
DOBUF_MOD = 3, ///< "count" mod. buffer from current buffer
};
// flags for buf_freeall()
/// flags for buf_freeall()
enum bfa_values {
BFA_DEL = 1, // buffer is going to be deleted
BFA_WIPE = 2, // buffer is going to be wiped out
BFA_KEEP_UNDO = 4, // do not free undo information
BFA_IGNORE_ABORT = 8, // do not abort for aborting()
BFA_DEL = 1, ///< buffer is going to be deleted
BFA_WIPE = 2, ///< buffer is going to be wiped out
BFA_KEEP_UNDO = 4, ///< do not free undo information
BFA_IGNORE_ABORT = 8, ///< do not abort for aborting()
};
EXTERN char *msg_loclist INIT( = N_("[Location List]"));
@ -136,6 +135,5 @@ static inline void buf_inc_changedtick(buf_T *const buf)
static inline bool buf_is_empty(buf_T *buf)
{
return buf->b_ml.ml_line_count == 1
&& *ml_get_buf(buf, 1) == '\0';
return buf->b_ml.ml_line_count == 1 && *ml_get_buf(buf, 1) == '\0';
}

View File

@ -2,12 +2,10 @@
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "nvim/api/extmark.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/ascii.h"
#include "nvim/buffer.h"
#include "nvim/decoration.h"
#include "nvim/drawscreen.h"
@ -16,7 +14,6 @@
#include "nvim/grid.h"
#include "nvim/highlight.h"
#include "nvim/highlight_group.h"
#include "nvim/mbyte.h"
#include "nvim/memory.h"
#include "nvim/move.h"
#include "nvim/option_vars.h"

View File

@ -49,7 +49,6 @@
#include "nvim/gettext.h"
#include "nvim/globals.h"
#include "nvim/grid.h"
#include "nvim/grid_defs.h"
#include "nvim/iconv.h"
#include "nvim/keycodes.h"
#include "nvim/macros.h"

View File

@ -7,7 +7,6 @@
#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep
#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
#include "nvim/func_attr.h"
#include "nvim/grid_defs.h"
#include "nvim/mbyte_defs.h" // IWYU pragma: export
#include "nvim/os/os_defs.h"
#include "nvim/types_defs.h" // IWYU pragma: keep

View File

@ -51,6 +51,7 @@
#include "nvim/regexp.h"
#include "nvim/runtime.h"
#include "nvim/strings.h"
#include "nvim/types_defs.h"
#include "nvim/ui.h"
#include "nvim/ui_compositor.h"
#include "nvim/vim.h"

View File

@ -11,20 +11,24 @@
#include "nvim/macros.h"
#include "nvim/types_defs.h"
// Types of dialogs passed to do_dialog().
#define VIM_GENERIC 0
#define VIM_ERROR 1
#define VIM_WARNING 2
#define VIM_INFO 3
#define VIM_QUESTION 4
#define VIM_LAST_TYPE 4 // sentinel value
/// Types of dialogs passed to do_dialog().
enum {
VIM_GENERIC = 0,
VIM_ERROR = 1,
VIM_WARNING = 2,
VIM_INFO = 3,
VIM_QUESTION = 4,
VIM_LAST_TYPE = 4, ///< sentinel value
};
// Return values for functions like vim_dialogyesno()
#define VIM_YES 2
#define VIM_NO 3
#define VIM_CANCEL 4
#define VIM_ALL 5
#define VIM_DISCARDALL 6
/// Return values for functions like vim_dialogyesno()
enum {
VIM_YES = 2,
VIM_NO = 3,
VIM_CANCEL = 4,
VIM_ALL = 5,
VIM_DISCARDALL = 6,
};
typedef struct {
String text;
@ -36,8 +40,8 @@ typedef kvec_t(HlMessageChunk) HlMessage;
/// Message history for `:messages`
typedef struct msg_hist {
struct msg_hist *next; ///< Next message.
char *msg; ///< Message text.
const char *kind; ///< Message kind (for msg_ext)
char *msg; ///< Message text.
const char *kind; ///< Message kind (for msg_ext)
int attr; ///< Message highlighting.
bool multiline; ///< Multiline message.
HlMessage multiattr; ///< multiattr message.
@ -50,20 +54,20 @@ extern MessageHistoryEntry *last_msg_hist;
EXTERN bool msg_ext_need_clear INIT( = false);
// allocated grid for messages. Used when display+=msgsep is set, or
// ext_multigrid is active. See also the description at msg_scroll_flush()
/// allocated grid for messages. Used when display+=msgsep is set, or
/// ext_multigrid is active. See also the description at msg_scroll_flush()
EXTERN ScreenGrid msg_grid INIT( = SCREEN_GRID_INIT);
EXTERN int msg_grid_pos INIT( = 0);
// "adjusted" message grid. This grid accepts positions relative to
// default_grid. Internally it will be translated to a position on msg_grid
// relative to the start of the message area, or directly mapped to default_grid
// for legacy (display-=msgsep) message scroll behavior.
// // TODO(bfredl): refactor "internal" message logic, msg_row etc
// to use the correct positions already.
/// "adjusted" message grid. This grid accepts positions relative to
/// default_grid. Internally it will be translated to a position on msg_grid
/// relative to the start of the message area, or directly mapped to default_grid
/// for legacy (display-=msgsep) message scroll behavior.
/// TODO(bfredl): refactor "internal" message logic, msg_row etc
/// to use the correct positions already.
EXTERN ScreenGrid msg_grid_adj INIT( = SCREEN_GRID_INIT);
// value of msg_scrolled at latest msg_scroll_flush.
/// value of msg_scrolled at latest msg_scroll_flush.
EXTERN int msg_scrolled_at_flush INIT( = 0);
EXTERN int msg_grid_scroll_discount INIT( = 0);

View File

@ -1,8 +1,8 @@
#pragma once
#include "nvim/api/private/defs.h" // IWYU pragma: keep
#include "nvim/grid_defs.h" // IWYU pragma: keep
#include "nvim/highlight_defs.h" // IWYU pragma: keep
#include "nvim/types_defs.h" // IWYU pragma: keep
#include "nvim/ui.h"
typedef struct TUIData TUIData;

View File

@ -1,6 +1,6 @@
#pragma once
#include "nvim/grid_defs.h"
#include "nvim/types_defs.h"
typedef struct ucell {
schar_T data;

View File

@ -5,7 +5,7 @@
#include <stdint.h>
#include "nvim/api/private/defs.h"
#include "nvim/grid_defs.h"
#include "nvim/grid_defs.h" // IWYU pragma: keep
#include "nvim/macros.h"
#include "nvim/types_defs.h"

View File

@ -3,6 +3,7 @@
#include "nvim/api/private/defs.h" // IWYU pragma: keep
#include "nvim/event/defs.h"
#include "nvim/grid_defs.h" // IWYU pragma: keep
#include "nvim/types_defs.h" // IWYU pragma: keep
#include "nvim/ui.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS