From c1abb474c24b2621cd03dabb4c2abcf2f9cac139 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 9 Aug 2020 15:03:42 -0700 Subject: [PATCH] Remove some dead code and enable a test --- src/event.cpp | 11 ----------- src/fish_tests.cpp | 11 +++++------ src/output.cpp | 7 ------- src/parser.cpp | 20 -------------------- src/wgetopt.cpp | 9 --------- src/wutil.cpp | 10 ---------- src/wutil.h | 2 -- 7 files changed, 5 insertions(+), 65 deletions(-) diff --git a/src/event.cpp b/src/event.cpp index 05dc99492..0b11cfcbd 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -182,17 +182,6 @@ wcstring event_get_desc(const parser_t &parser, const event_t &evt) { } } -#if 0 -static void show_all_handlers(void) { - std::fwprintf(stdout, L"event handlers:\n"); - for (const auto& event : events) { - auto foo = event; - wcstring tmp = event_get_desc(foo); - std::fwprintf(stdout, L" handler now %ls\n", tmp.c_str()); - } -} -#endif - void event_add_handler(std::shared_ptr eh) { if (eh->desc.type == event_type_t::signal) { signal_handle(eh->desc.param1.signal); diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp index f02b0b92f..c832697aa 100644 --- a/src/fish_tests.cpp +++ b/src/fish_tests.cpp @@ -1209,12 +1209,11 @@ static void test_parser() { auto parser = parser_t::principal_parser().shared(); say(L"Testing recursion detection"); parser->eval(L"function recursive ; recursive ; end ; recursive; ", io_chain_t()); -#if 0 - // This is disabled since it produces a long backtrace. We should find a way to either visually - // compress the backtrace, or disable error spewing. - parser->.eval(L"function recursive1 ; recursive2 ; end ; " - L"function recursive2 ; recursive1 ; end ; recursive1; ", io_chain_t()); -#endif + + parser->eval( + L"function recursive1 ; recursive2 ; end ; " + L"function recursive2 ; recursive1 ; end ; recursive1; ", + io_chain_t()); say(L"Testing empty function name"); parser->eval(L"function '' ; echo fail; exit 42 ; end ; ''", io_chain_t()); diff --git a/src/output.cpp b/src/output.cpp index ba90b5e3e..42ecbeb0b 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -521,13 +521,6 @@ rgb_color_t parse_color(const env_var_t &var, bool is_background) { result.set_italics(is_italics); result.set_dim(is_dim); result.set_reverse(is_reverse); - -#if 0 - wcstring desc = result.description(); - std::fwprintf(stdout, L"Parsed %ls from %ls (%s)\n", desc.c_str(), val.c_str(), - is_background ? "background" : "foreground"); -#endif - return result; } diff --git a/src/parser.cpp b/src/parser.cpp index 183f0e353..8150b81ca 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -221,26 +221,6 @@ const wchar_t *parser_t::get_block_desc(block_type_t block) { return _(UNKNOWN_BLOCK); } -#if 0 -// TODO: Lint says this isn't used (which is true). Should this be removed? -wcstring parser_t::block_stack_description() const { - wcstring result; - size_t idx = this->block_count(); - size_t spaces = 0; - while (idx--) { - if (spaces > 0) { - result.push_back(L'\n'); - } - for (size_t j = 0; j < spaces; j++) { - result.push_back(L' '); - } - result.append(this->block_at_index(idx)->description()); - spaces++; - } - return result; -} -#endif - const block_t *parser_t::block_at_index(size_t idx) const { return idx < block_list.size() ? &block_list[idx] : nullptr; } diff --git a/src/wgetopt.cpp b/src/wgetopt.cpp index 07beae1ab..a73b85a08 100644 --- a/src/wgetopt.cpp +++ b/src/wgetopt.cpp @@ -456,12 +456,3 @@ int wgetopter_t::wgetopt_long(int argc, wchar_t **argv, const wchar_t *options, const struct woption *long_options, int *opt_index) { return _wgetopt_internal(argc, argv, options, long_options, opt_index, 0); } - -#if 0 -// This function should never be used by fish. We keep the signature just in case we find a -// need to use it in the future. -int wgetopter_t::wgetopt_long_only(int argc, wchar_t **argv, const wchar_t *options, - const struct woption *long_options, int *opt_index) { - return _wgetopt_internal(argc, argv, options, long_options, opt_index, 1); -} -#endif diff --git a/src/wutil.cpp b/src/wutil.cpp index ffb212871..6e3d9bf84 100644 --- a/src/wutil.cpp +++ b/src/wutil.cpp @@ -602,16 +602,6 @@ int fish_iswalnum(wint_t wc) { return iswalnum(wc); } -#if 0 -/// We need this because there are too many implementations that don't return the proper answer for -/// some code points. See issue #3050. -int fish_iswalpha(wint_t wc) { - if (fish_reserved_codepoint(wc)) return 0; - if (fish_is_pua(wc)) return 0; - return iswalpha(wc); -} -#endif - /// We need this because there are too many implementations that don't return the proper answer for /// some code points. See issue #3050. int fish_iswgraph(wint_t wc) { diff --git a/src/wutil.h b/src/wutil.h index 75a0db690..5fbf5bfcd 100644 --- a/src/wutil.h +++ b/src/wutil.h @@ -134,11 +134,9 @@ inline ssize_t wwrite_to_fd(const wcstring &s, int fd) { // We need this because there are too many implementations that don't return the proper answer for // some code points. See issue #3050. #ifndef FISH_NO_ISW_WRAPPERS -#define iswalpha fish_iswalpha #define iswalnum fish_iswalnum #define iswgraph fish_iswgraph #endif -int fish_iswalpha(wint_t wc); int fish_iswalnum(wint_t wc); int fish_iswgraph(wint_t wc);