clang-format C++ files

This commit is contained in:
Johannes Altmanninger 2023-02-25 00:54:46 +01:00
parent 30d40c1d49
commit b7041ad89b
11 changed files with 27 additions and 22 deletions

View File

@ -87,9 +87,9 @@ struct termsize_t;
// Make sure the ranges defined above don't exceed the range for non-characters.
// This is to make sure we didn't do something stupid in subdividing the
// Unicode range for our needs.
//#if WILDCARD_RESERVED_END > RESERVED_CHAR_END
//#error
//#endif
// #if WILDCARD_RESERVED_END > RESERVED_CHAR_END
// #error
// #endif
// These are in the Unicode private-use range. We really shouldn't use this
// range but have little choice in the matter given how our lexer/parser works.

View File

@ -13,7 +13,7 @@
#include <utility>
#include <vector>
//#include "expand.h"
// #include "expand.h"
#include "common.h"
#include "wcstringutil.h"

View File

@ -952,9 +952,11 @@ expand_result_t expander_t::stage_cmdsubst(wcstring input, completion_receiver_t
}
return expand_result_t::ok;
case 1:
append_cmdsub_error(errors, start, end, L"command substitutions not allowed here");
append_cmdsub_error(errors, start, end,
L"command substitutions not allowed here"); // clang-format off
__fallthrough__
case -1:
// clang-format on
default:
return expand_result_t::make_error(STATUS_EXPAND_ERROR);
}

View File

@ -12,8 +12,8 @@
#include <unistd.h> // IWYU pragma: keep
#include <wctype.h>
#include <cwchar>
#include <cstdlib>
#include <cwchar>
#if HAVE_GETTEXT
#include <libintl.h>
#endif
@ -57,9 +57,9 @@ int fish_mkstemp_cloexec(char *name_template) {
return result_fd;
}
/// Fallback implementations of wcsncasecmp and wcscasecmp. On systems where these are not needed (e.g.
/// building on Linux) these should end up just being stripped, as they are static functions that
/// are not referenced in this file.
/// Fallback implementations of wcsncasecmp and wcscasecmp. On systems where these are not needed
/// (e.g. building on Linux) these should end up just being stripped, as they are static functions
/// that are not referenced in this file.
// cppcheck-suppress unusedFunction
[[gnu::unused]] static int wcscasecmp_fallback(const wchar_t *a, const wchar_t *b) {
if (*a == 0) {

View File

@ -38,9 +38,9 @@
struct config_paths_t determine_config_directory_paths(const char *argv0);
static const wchar_t *ctrl_symbolic_names[] = {
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
L"\\b", L"\\t", L"\\n", nullptr, nullptr, L"\\r", nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
L"\\b", L"\\t", L"\\n", nullptr, nullptr, L"\\r", nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, L"\\e", L"\\x1c", nullptr, nullptr, nullptr};
/// Return true if the recent sequence of characters indicates the user wants to exit the program.

View File

@ -41,6 +41,7 @@
#include <unordered_map>
#include <utility>
#include <vector>
#include "fds.rs.h"
#include "parse_constants.rs.h"
@ -836,14 +837,16 @@ static void test_fd_monitor() {
}
static void trampoline(autoclose_fd_t2 &fd, item_wake_reason_t reason, uint8_t *param) {
auto &instance = *(item_maker_t*)(param);
auto &instance = *(item_maker_t *)(param);
instance.callback(fd, reason);
}
explicit item_maker_t(uint64_t timeout_usec) {
auto pipes = make_autoclose_pipes().acquire();
writer = std::move(pipes.write);
item = std::make_unique<rust::Box<fd_monitor_item_t>>(make_fd_monitor_item_t(pipes.read.acquire(), timeout_usec, (uint8_t *)item_maker_t::trampoline, (uint8_t*)this));
item = std::make_unique<rust::Box<fd_monitor_item_t>>(
make_fd_monitor_item_t(pipes.read.acquire(), timeout_usec,
(uint8_t *)item_maker_t::trampoline, (uint8_t *)this));
}
// Write 42 bytes to our write end.

View File

@ -120,8 +120,8 @@ void io_buffer_t::begin_filling(autoclose_fd_t fd) {
args->instance = this;
args->promise = std::move(promise);
item_id_ =
fd_monitor().add_item(fd.acquire(), kNoTimeout, (uint8_t *)item_callback_trampoline, (uint8_t *)args);
item_id_ = fd_monitor().add_item(fd.acquire(), kNoTimeout, (uint8_t *)item_callback_trampoline,
(uint8_t *)args);
}
/// This is a hack to work around the difficulties in passing a capturing lambda across FFI

View File

@ -135,7 +135,8 @@ class parse_execution_context_t : noncopyable_t {
end_execution_reason_t determine_redirections(const ast::argument_or_redirection_list_t &list,
redirection_spec_list_t *out_redirections);
end_execution_reason_t run_1_job(const ast::job_pipeline_t &job, const block_t *associated_block);
end_execution_reason_t run_1_job(const ast::job_pipeline_t &job,
const block_t *associated_block);
end_execution_reason_t test_and_run_1_job_conjunction(const ast::job_conjunction_t &jc,
const block_t *associated_block);
end_execution_reason_t run_job_conjunction(const ast::job_conjunction_t &job_expr,

View File

@ -674,7 +674,7 @@ RustFFIJobList parser_t::ffi_jobs() const {
bool parser_t::ffi_has_funtion_block() const {
for (const auto &b : blocks()) {
if (b.is_function_call()) {
return true;
return true;
}
}
return false;

View File

@ -77,9 +77,7 @@ static size_t try_sequence(const char *seq, const wchar_t *str) {
static bool midnight_commander_hack = false;
void screen_set_midnight_commander_hack() {
midnight_commander_hack = true;
}
void screen_set_midnight_commander_hack() { midnight_commander_hack = true; }
/// Returns the number of columns left until the next tab stop, given the current cursor position.
static size_t next_tab_stop(size_t current_line_width) {

View File

@ -954,7 +954,8 @@ void wildcard_expander_t::expand(const wcstring &base_dir, const wchar_t *wc,
}
// return "." and ".." entries if we're doing completions
dir_iter_t dir = open_dir(base_dir, /* return . and .. */ flags & expand_flag::for_completions);
dir_iter_t dir =
open_dir(base_dir, /* return . and .. */ flags & expand_flag::for_completions);
if (dir.valid()) {
if (is_last_segment) {
// Last wildcard segment, nonempty wildcard.