Remove some dead code and enable a test

This commit is contained in:
ridiculousfish 2020-08-09 15:03:42 -07:00
parent 563a2d824c
commit c1abb474c2
7 changed files with 5 additions and 65 deletions

View File

@ -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<event_handler_t> eh) {
if (eh->desc.type == event_type_t::signal) {
signal_handle(eh->desc.param1.signal);

View File

@ -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());

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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) {

View File

@ -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);