From db72a05e891d9ee140e5ec21c1fab29d76846f59 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Tue, 21 Sep 2021 17:57:25 -0700 Subject: [PATCH] Tighten up includes, some typedefs -> using clangd was unable to resolve some symbols --- src/builtin_commandline.h | 3 +++ src/builtin_complete.h | 3 +++ src/builtin_jobs.h | 3 +++ src/builtin_printf.h | 3 +++ src/builtin_set_color.h | 3 +++ src/builtin_string.h | 3 +++ src/builtin_ulimit.h | 2 ++ src/complete.h | 2 +- src/enum_set.h | 2 +- src/fallback.h | 4 ++-- src/fish_version.cpp | 2 +- src/lru.h | 2 +- src/output.h | 2 +- src/postfork.h | 2 +- src/signal.cpp | 3 ++- src/signal.h | 3 ++- src/tokenizer.h | 2 +- 17 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/builtin_commandline.h b/src/builtin_commandline.h index 8b4d3d31d..38e841b82 100644 --- a/src/builtin_commandline.h +++ b/src/builtin_commandline.h @@ -5,6 +5,9 @@ #include #include +#include "io.h" +#include "maybe.h" + class parser_t; maybe_t builtin_commandline(parser_t &parser, io_streams_t &streams, const wchar_t **argv); diff --git a/src/builtin_complete.h b/src/builtin_complete.h index bb7097f49..70cc0a7b4 100644 --- a/src/builtin_complete.h +++ b/src/builtin_complete.h @@ -5,6 +5,9 @@ #include #include +#include "io.h" +#include "maybe.h" + class parser_t; maybe_t builtin_complete(parser_t &parser, io_streams_t &streams, const wchar_t **argv); diff --git a/src/builtin_jobs.h b/src/builtin_jobs.h index 5d4f1e0a8..36aadea89 100644 --- a/src/builtin_jobs.h +++ b/src/builtin_jobs.h @@ -5,6 +5,9 @@ #include #include +#include "io.h" +#include "maybe.h" + class parser_t; maybe_t builtin_jobs(parser_t &parser, io_streams_t &streams, const wchar_t **argv); diff --git a/src/builtin_printf.h b/src/builtin_printf.h index c724fde3d..9303cc2cd 100644 --- a/src/builtin_printf.h +++ b/src/builtin_printf.h @@ -5,6 +5,9 @@ #include #include +#include "io.h" +#include "maybe.h" + class parser_t; maybe_t builtin_printf(parser_t &parser, io_streams_t &streams, const wchar_t **argv); diff --git a/src/builtin_set_color.h b/src/builtin_set_color.h index 1a8dd0cce..e2ebea467 100644 --- a/src/builtin_set_color.h +++ b/src/builtin_set_color.h @@ -5,6 +5,9 @@ #include #include +#include "io.h" +#include "maybe.h" + class parser_t; maybe_t builtin_set_color(parser_t &parser, io_streams_t &streams, const wchar_t **argv); diff --git a/src/builtin_string.h b/src/builtin_string.h index 224873405..2d0b4babc 100644 --- a/src/builtin_string.h +++ b/src/builtin_string.h @@ -5,6 +5,9 @@ #include #include +#include "maybe.h" +#include "io.h" + class parser_t; maybe_t builtin_string(parser_t &parser, io_streams_t &streams, const wchar_t **argv); diff --git a/src/builtin_ulimit.h b/src/builtin_ulimit.h index a9d449d50..9c584f685 100644 --- a/src/builtin_ulimit.h +++ b/src/builtin_ulimit.h @@ -5,6 +5,8 @@ #include #include +#include "io.h" + class parser_t; maybe_t builtin_ulimit(parser_t &parser, io_streams_t &streams, const wchar_t **argv); diff --git a/src/complete.h b/src/complete.h index 04d06a57f..abd27035a 100644 --- a/src/complete.h +++ b/src/complete.h @@ -46,7 +46,7 @@ enum { /// This completion looks to have the same string as an existing argument. COMPLETE_DUPLICATES_ARGUMENT = 1 << 7 }; -typedef int complete_flags_t; +using complete_flags_t = int; /// std::function which accepts a completion string and returns its description. using description_func_t = std::function; diff --git a/src/enum_set.h b/src/enum_set.h index f0d37e146..1c9e67442 100644 --- a/src/enum_set.h +++ b/src/enum_set.h @@ -121,7 +121,7 @@ class enum_iter_t { return *this; } - iterator_t operator++(int) { + const iterator_t operator++(int) { auto res = *this; v_ += 1; return res; diff --git a/src/fallback.h b/src/fallback.h index a3fc8c489..e6f0743c0 100644 --- a/src/fallback.h +++ b/src/fallback.h @@ -54,9 +54,9 @@ int fish_mkstemp_cloexec(char *); /// expects a int (*func)(int) as its last parameter. tputs_arg_t is defined to always be what tputs /// expects. Hopefully. #if defined(NCURSES_VERSION) || defined(__NetBSD__) -typedef int tputs_arg_t; +using tputs_arg_t = int; #else -typedef char tputs_arg_t; +using tputs_arg_t = char; #endif #ifndef HAVE_WINSIZE diff --git a/src/fish_version.cpp b/src/fish_version.cpp index da8bd4ea8..266c114e4 100644 --- a/src/fish_version.cpp +++ b/src/fish_version.cpp @@ -9,7 +9,7 @@ // FISH_BUILD_VERSION="2.7.1-62-gc0480092-dirty" // Arrange for it to become a variable. static const char *const -#include "FISH-BUILD-VERSION-FILE" +#include "../FISH-BUILD-VERSION-FILE" ; #endif diff --git a/src/lru.h b/src/lru.h index c1f01c96b..f6eac3265 100644 --- a/src/lru.h +++ b/src/lru.h @@ -270,7 +270,7 @@ class lru_cache_t { const lru_link_t *node; public: - typedef std::pair value_type; + using value_type = std::pair; explicit iterator(const lru_link_t *val) : node(val) {} void operator++() { node = node->prev; } diff --git a/src/output.h b/src/output.h index 4f25283c5..91e5d9a95 100644 --- a/src/output.h +++ b/src/output.h @@ -123,7 +123,7 @@ rgb_color_t parse_color(const env_var_t &var, bool is_background); /// Sets what colors are supported. enum { color_support_term256 = 1 << 0, color_support_term24bit = 1 << 1 }; -typedef unsigned int color_support_t; +using color_support_t = unsigned int; color_support_t output_get_color_support(); void output_set_color_support(color_support_t val); diff --git a/src/postfork.h b/src/postfork.h index 785cb54ba..372d6b0df 100644 --- a/src/postfork.h +++ b/src/postfork.h @@ -55,7 +55,7 @@ void safe_report_exec_error(int err, const char *actual_cmd, const char *const * #if FISH_USE_POSIX_SPAWN /// A RAII type which wraps up posix_spawn's data structures. -class posix_spawner_t : noncopyable_t, nonmovable_t { +class posix_spawner_t : maybe_detail::noncopyable_t, maybe_detail::noncopyable_t { public: /// Attempt to construct from a job and dup2 list. /// The caller must check the error function, as this may fail. diff --git a/src/signal.cpp b/src/signal.cpp index b5334a382..a5cea961d 100644 --- a/src/signal.cpp +++ b/src/signal.cpp @@ -2,13 +2,14 @@ #include "config.h" // IWYU pragma: keep #include -#include #include #ifdef HAVE_SIGINFO_H #include #endif #include +#include + #include "common.h" #include "event.h" #include "fallback.h" // IWYU pragma: keep diff --git a/src/signal.h b/src/signal.h index 99c318646..7b9d513db 100644 --- a/src/signal.h +++ b/src/signal.h @@ -2,7 +2,8 @@ #ifndef FISH_SIGNALH #define FISH_SIGNALH -#include +#include +#include /// Get the integer signal value representing the specified signal, or -1 of no signal was found. int wcs2sig(const wchar_t *str); diff --git a/src/tokenizer.h b/src/tokenizer.h index efe614eb3..aaa139f3f 100644 --- a/src/tokenizer.h +++ b/src/tokenizer.h @@ -37,7 +37,7 @@ enum class token_type_t { /// Make an effort to continue after an error. #define TOK_CONTINUE_AFTER_ERROR 8 -typedef unsigned int tok_flags_t; +using tok_flags_t = unsigned int; enum class tokenizer_error_t { none,