Reformat C++ files

This commit is contained in:
ridiculousfish 2020-03-14 15:06:14 -07:00
parent fee08a87e9
commit 87b1c02832
4 changed files with 39 additions and 35 deletions

View file

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

View file

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

View file

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

View file

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