From 87b1c02832eec9781ca2aa0ff4cd80d7731f5e65 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 14 Mar 2020 15:06:14 -0700 Subject: [PATCH] Reformat C++ files --- src/builtin_argparse.cpp | 3 ++- src/builtin_set.cpp | 12 +++++---- src/builtin_string.cpp | 56 ++++++++++++++++++++-------------------- src/parse_tree.cpp | 3 ++- 4 files changed, 39 insertions(+), 35 deletions(-) diff --git a/src/builtin_argparse.cpp b/src/builtin_argparse.cpp index cf7be380a..ca1ad096f 100644 --- a/src/builtin_argparse.cpp +++ b/src/builtin_argparse.cpp @@ -461,7 +461,8 @@ static int validate_arg(parser_t &parser, const argparse_cmd_opts_t &opts, optio if (is_long_flag) { vars.set_one(var_name_prefix + L"name", ENV_LOCAL | ENV_EXPORT, opt_spec->long_flag); } else { - vars.set_one(var_name_prefix + L"name", ENV_LOCAL | ENV_EXPORT, wcstring(1, opt_spec->short_flag)); + vars.set_one(var_name_prefix + L"name", ENV_LOCAL | ENV_EXPORT, + wcstring(1, opt_spec->short_flag)); } vars.set_one(var_name_prefix + L"value", ENV_LOCAL | ENV_EXPORT, woptarg); diff --git a/src/builtin_set.cpp b/src/builtin_set.cpp index c22685df9..9e20f4a96 100644 --- a/src/builtin_set.cpp +++ b/src/builtin_set.cpp @@ -172,7 +172,8 @@ static int parse_cmd_opts(set_cmd_opts_t &opts, int *optind, //!OCLINT(high ncs return STATUS_CMD_OK; } -static int validate_cmd_opts(const wchar_t *cmd, const set_cmd_opts_t &opts, //!OCLINT(npath complexity) +static int validate_cmd_opts(const wchar_t *cmd, + const set_cmd_opts_t &opts, //!OCLINT(npath complexity) int argc, parser_t &parser, io_streams_t &streams) { // Can't query and erase or list. if (opts.query && (opts.erase || opts.list)) { @@ -235,8 +236,9 @@ static int validate_cmd_opts(const wchar_t *cmd, const set_cmd_opts_t &opts, // // Check if we are setting a uvar and a global of the same name exists. See // https://github.com/fish-shell/fish-shell/issues/806 -static int check_global_scope_exists(const wchar_t *cmd, const set_cmd_opts_t &opts, const wchar_t *dest, - io_streams_t &streams, const parser_t &parser) { +static int check_global_scope_exists(const wchar_t *cmd, const set_cmd_opts_t &opts, + const wchar_t *dest, io_streams_t &streams, + const parser_t &parser) { if (opts.universal) { auto global_dest = parser.vars().get(dest, ENV_GLOBAL); if (global_dest && parser.is_interactive()) { @@ -602,8 +604,8 @@ static void show_scope(const wchar_t *var_name, int scope, io_streams_t &streams } /// Show mode. Show information about the named variable(s). -static int builtin_set_show(const wchar_t *cmd, const set_cmd_opts_t &opts, int argc, wchar_t **argv, - parser_t &parser, io_streams_t &streams) { +static int builtin_set_show(const wchar_t *cmd, const set_cmd_opts_t &opts, int argc, + wchar_t **argv, parser_t &parser, io_streams_t &streams) { UNUSED(opts); const auto &vars = parser.vars(); if (argc == 0) { // show all vars diff --git a/src/builtin_string.cpp b/src/builtin_string.cpp index ce9173be5..bfdbd334b 100644 --- a/src/builtin_string.cpp +++ b/src/builtin_string.cpp @@ -183,8 +183,8 @@ typedef struct { //!OCLINT(too many fields) } options_t; /// This handles the `--style=xxx` flag. -static int handle_flag_1(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w, - options_t *opts) { +static int handle_flag_1(wchar_t **argv, parser_t &parser, io_streams_t &streams, + const wgetopter_t &w, options_t *opts) { const wchar_t *cmd = argv[0]; if (opts->style_valid) { @@ -207,8 +207,8 @@ static int handle_flag_1(wchar_t **argv, parser_t &parser, io_streams_t &streams return STATUS_INVALID_ARGS; } -static int handle_flag_N(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w, - options_t *opts) { +static int handle_flag_N(wchar_t **argv, parser_t &parser, io_streams_t &streams, + const wgetopter_t &w, options_t *opts) { if (opts->no_newline_valid) { opts->no_newline = true; return STATUS_CMD_OK; @@ -220,8 +220,8 @@ static int handle_flag_N(wchar_t **argv, parser_t &parser, io_streams_t &streams return STATUS_INVALID_ARGS; } -static int handle_flag_a(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w, - options_t *opts) { +static int handle_flag_a(wchar_t **argv, parser_t &parser, io_streams_t &streams, + const wgetopter_t &w, options_t *opts) { if (opts->all_valid) { opts->all = true; return STATUS_CMD_OK; @@ -230,8 +230,8 @@ static int handle_flag_a(wchar_t **argv, parser_t &parser, io_streams_t &streams return STATUS_INVALID_ARGS; } -static int handle_flag_c(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w, - options_t *opts) { +static int handle_flag_c(wchar_t **argv, parser_t &parser, io_streams_t &streams, + const wgetopter_t &w, options_t *opts) { if (opts->chars_valid) { opts->chars_to_trim = w.woptarg; return STATUS_CMD_OK; @@ -240,8 +240,8 @@ static int handle_flag_c(wchar_t **argv, parser_t &parser, io_streams_t &streams return STATUS_INVALID_ARGS; } -static int handle_flag_e(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w, - options_t *opts) { +static int handle_flag_e(wchar_t **argv, parser_t &parser, io_streams_t &streams, + const wgetopter_t &w, options_t *opts) { if (opts->entire_valid) { opts->entire = true; return STATUS_CMD_OK; @@ -250,8 +250,8 @@ static int handle_flag_e(wchar_t **argv, parser_t &parser, io_streams_t &streams return STATUS_INVALID_ARGS; } -static int handle_flag_f(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w, - options_t *opts) { +static int handle_flag_f(wchar_t **argv, parser_t &parser, io_streams_t &streams, + const wgetopter_t &w, options_t *opts) { if (opts->filter_valid) { opts->filter = true; return STATUS_CMD_OK; @@ -260,8 +260,8 @@ static int handle_flag_f(wchar_t **argv, parser_t &parser, io_streams_t &streams return STATUS_INVALID_ARGS; } -static int handle_flag_i(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w, - options_t *opts) { +static int handle_flag_i(wchar_t **argv, parser_t &parser, io_streams_t &streams, + const wgetopter_t &w, options_t *opts) { if (opts->ignore_case_valid) { opts->ignore_case = true; return STATUS_CMD_OK; @@ -273,8 +273,8 @@ static int handle_flag_i(wchar_t **argv, parser_t &parser, io_streams_t &streams return STATUS_INVALID_ARGS; } -static int handle_flag_l(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w, - options_t *opts) { +static int handle_flag_l(wchar_t **argv, parser_t &parser, io_streams_t &streams, + const wgetopter_t &w, options_t *opts) { if (opts->length_valid) { opts->length = fish_wcstol(w.woptarg); if (opts->length < 0 || opts->length == LONG_MIN || errno == ERANGE) { @@ -293,8 +293,8 @@ static int handle_flag_l(wchar_t **argv, parser_t &parser, io_streams_t &streams return STATUS_INVALID_ARGS; } -static int handle_flag_m(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w, - options_t *opts) { +static int handle_flag_m(wchar_t **argv, parser_t &parser, io_streams_t &streams, + const wgetopter_t &w, options_t *opts) { if (opts->max_valid) { opts->max = fish_wcstol(w.woptarg); if (opts->max < 0 || errno == ERANGE) { @@ -310,8 +310,8 @@ static int handle_flag_m(wchar_t **argv, parser_t &parser, io_streams_t &streams return STATUS_INVALID_ARGS; } -static int handle_flag_n(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w, - options_t *opts) { +static int handle_flag_n(wchar_t **argv, parser_t &parser, io_streams_t &streams, + const wgetopter_t &w, options_t *opts) { if (opts->count_valid) { opts->count = fish_wcstol(w.woptarg); if (opts->count < 0 || errno == ERANGE) { @@ -336,8 +336,8 @@ static int handle_flag_n(wchar_t **argv, parser_t &parser, io_streams_t &streams return STATUS_INVALID_ARGS; } -static int handle_flag_q(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w, - options_t *opts) { +static int handle_flag_q(wchar_t **argv, parser_t &parser, io_streams_t &streams, + const wgetopter_t &w, options_t *opts) { if (opts->quiet_valid) { opts->quiet = true; return STATUS_CMD_OK; @@ -346,8 +346,8 @@ static int handle_flag_q(wchar_t **argv, parser_t &parser, io_streams_t &streams return STATUS_INVALID_ARGS; } -static int handle_flag_r(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w, - options_t *opts) { +static int handle_flag_r(wchar_t **argv, parser_t &parser, io_streams_t &streams, + const wgetopter_t &w, options_t *opts) { if (opts->regex_valid) { opts->regex = true; return STATUS_CMD_OK; @@ -359,8 +359,8 @@ static int handle_flag_r(wchar_t **argv, parser_t &parser, io_streams_t &streams return STATUS_INVALID_ARGS; } -static int handle_flag_s(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w, - options_t *opts) { +static int handle_flag_s(wchar_t **argv, parser_t &parser, io_streams_t &streams, + const wgetopter_t &w, options_t *opts) { if (opts->start_valid) { opts->start = fish_wcstol(w.woptarg); if (opts->start == 0 || opts->start == LONG_MIN || errno == ERANGE) { @@ -376,8 +376,8 @@ static int handle_flag_s(wchar_t **argv, parser_t &parser, io_streams_t &streams return STATUS_INVALID_ARGS; } -static int handle_flag_v(wchar_t **argv, parser_t &parser, io_streams_t &streams, const wgetopter_t &w, - options_t *opts) { +static int handle_flag_v(wchar_t **argv, parser_t &parser, io_streams_t &streams, + const wgetopter_t &w, options_t *opts) { if (opts->invert_valid) { opts->invert_match = true; return STATUS_CMD_OK; diff --git a/src/parse_tree.cpp b/src/parse_tree.cpp index 27cc963a0..9b9c745b6 100644 --- a/src/parse_tree.cpp +++ b/src/parse_tree.cpp @@ -406,7 +406,8 @@ class parse_ll_t { void parse_error(parse_token_t token, parse_error_code_t code, const wchar_t *fmt, ...); void parse_error_at_location(size_t source_start, size_t source_length, size_t error_location, parse_error_code_t code, const wchar_t *fmt, ...); - void parse_error_failed_production(const struct parse_stack_element_t &elem, parse_token_t token); + void parse_error_failed_production(const struct parse_stack_element_t &elem, + parse_token_t token); void parse_error_unbalancing_token(parse_token_t token); // Reports an error for an unclosed block, e.g. 'begin;'. Returns true on success, false on