From 8178400f8dc70aaa5dcbef16f92e50c53d8dc8c1 Mon Sep 17 00:00:00 2001 From: Justin Frank Date: Fri, 8 Feb 2019 20:41:09 -0800 Subject: [PATCH] Fixed all reorder warnings --- src/Makefile | 2 +- src/client.cc | 4 ++-- src/context.cc | 4 ++-- src/display_buffer.hh | 2 +- src/event_manager.cc | 2 +- src/highlighters.cc | 4 ++-- src/input_handler.cc | 16 ++++++++-------- src/ncurses_ui.cc | 8 ++++---- src/regex_impl.cc | 2 +- src/selection.cc | 6 +++--- src/utils.hh | 4 ++-- 11 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/Makefile b/src/Makefile index 1c31dce2..0c4868e3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -85,7 +85,7 @@ else LDFLAGS += -rdynamic endif -CXXFLAGS += -pedantic -std=c++17 -g -Wall -Wextra -Wno-unused-parameter -Wno-reorder -Wno-sign-compare -Wno-address +CXXFLAGS += -pedantic -std=c++17 -g -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-address all : kak diff --git a/src/client.cc b/src/client.cc index f72cbac1..5bed81fe 100644 --- a/src/client.cc +++ b/src/client.cc @@ -32,9 +32,9 @@ Client::Client(std::unique_ptr&& ui, : m_ui{std::move(ui)}, m_window{std::move(window)}, m_pid{pid}, m_on_exit{std::move(on_exit)}, + m_env_vars(std::move(env_vars)), m_input_handler{std::move(selections), Context::Flags::None, - std::move(name)}, - m_env_vars(std::move(env_vars)) + std::move(name)} { m_window->set_client(this); diff --git a/src/context.cc b/src/context.cc index d97073d0..08a0b544 100644 --- a/src/context.cc +++ b/src/context.cc @@ -13,9 +13,9 @@ Context::~Context() = default; Context::Context(InputHandler& input_handler, SelectionList selections, Flags flags, String name) - : m_input_handler{&input_handler}, + : m_flags(flags), + m_input_handler{&input_handler}, m_selections{std::move(selections)}, - m_flags(flags), m_name(std::move(name)) {} diff --git a/src/display_buffer.hh b/src/display_buffer.hh index e86dcdb0..045a1cc8 100644 --- a/src/display_buffer.hh +++ b/src/display_buffer.hh @@ -28,7 +28,7 @@ public: : m_type(Range), m_buffer(&buffer), m_range{begin, end} {} DisplayAtom(String str, Face face) - : m_type(Text), m_text(std::move(str)), face(face) {} + : face(face), m_type(Text), m_text(std::move(str)) {} StringView content() const; ColumnCount length() const; diff --git a/src/event_manager.cc b/src/event_manager.cc index 0767473a..37fac95a 100644 --- a/src/event_manager.cc +++ b/src/event_manager.cc @@ -34,7 +34,7 @@ void FDWatcher::close_fd() } Timer::Timer(TimePoint date, Callback callback, EventMode mode) - : m_date{date}, m_callback{std::move(callback)}, m_mode(mode) + : m_date{date}, m_mode(mode), m_callback{std::move(callback)} { if (m_callback and EventManager::has_instance()) EventManager::instance().m_timers.push_back(this); diff --git a/src/highlighters.cc b/src/highlighters.cc index 05bc10e7..f64303c8 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -633,8 +633,8 @@ std::unique_ptr create_column_highlighter(HighlighterParameters par struct WrapHighlighter : Highlighter { WrapHighlighter(ColumnCount max_width, bool word_wrap, bool preserve_indent, String marker) - : Highlighter{HighlightPass::Wrap}, m_max_width{max_width}, - m_word_wrap{word_wrap}, m_preserve_indent{preserve_indent}, + : Highlighter{HighlightPass::Wrap}, m_word_wrap{word_wrap}, + m_preserve_indent{preserve_indent}, m_max_width{max_width}, m_marker{std::move(marker)} {} static constexpr StringView ms_id = "wrap"; diff --git a/src/input_handler.cc b/src/input_handler.cc index 91acbc3f..78363241 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -752,9 +752,10 @@ public: Prompt(InputHandler& input_handler, StringView prompt, String initstr, String emptystr, Face face, PromptFlags flags, PromptCompleter completer, PromptCallback callback) - : InputMode(input_handler), m_prompt(prompt.str()), m_prompt_face(face), + : InputMode(input_handler), m_callback(std::move(callback)), m_completer(std::move(completer)), + m_prompt(prompt.str()), m_prompt_face(face), m_empty_text{std::move(emptystr)}, - m_flags(flags), m_completer(std::move(completer)), m_callback(std::move(callback)), + m_line_editor{context().faces()}, m_flags(flags), m_auto_complete{context().options()["autocomplete"].get() & AutoComplete::Prompt}, m_idle_timer{TimePoint::max(), context().flags() & Context::Flags::Draft ? Timer::Callback{} : [this](Timer&) { @@ -766,8 +767,7 @@ public: m_line_changed = false; } context().hooks().run_hook(Hook::PromptIdle, "", context()); - }}, - m_line_editor{context().faces()} + }} { m_history_it = ms_history[m_prompt].end(); m_line_editor.reset(std::move(initstr), m_empty_text); @@ -1102,7 +1102,7 @@ class NextKey : public InputMode { public: NextKey(InputHandler& input_handler, KeymapMode keymap_mode, KeyCallback callback) - : InputMode(input_handler), m_keymap_mode(keymap_mode), m_callback(std::move(callback)) {} + : InputMode(input_handler), m_callback(std::move(callback)), m_keymap_mode(keymap_mode) {} void on_key(Key key) override { @@ -1132,16 +1132,16 @@ class Insert : public InputMode public: Insert(InputHandler& input_handler, InsertMode mode, int count) : InputMode(input_handler), - m_restore_cursor(mode == InsertMode::Append), m_edition(context()), m_completer(context()), + m_restore_cursor(mode == InsertMode::Append), m_auto_complete{context().options()["autocomplete"].get() & AutoComplete::Insert}, - m_disable_hooks{context().hooks_disabled(), context().hooks_disabled()}, m_idle_timer{TimePoint::max(), context().flags() & Context::Flags::Draft ? Timer::Callback{} : [this](Timer&) { m_completer.update(m_auto_complete); context().hooks().run_hook(Hook::InsertIdle, "", context()); - }} + }}, + m_disable_hooks{context().hooks_disabled(), context().hooks_disabled()} { context().buffer().throw_if_read_only(); diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index 452c2e8b..ff1fd09c 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -250,7 +250,9 @@ default_colors = { }; NCursesUI::NCursesUI() - : m_stdin_watcher{0, FdEvents::Read, + : m_colors{default_colors}, + m_cursor{CursorMode::Buffer, {}}, + m_stdin_watcher{0, FdEvents::Read, [this](FDWatcher&, FdEvents, EventMode) { if (not m_on_key) return; @@ -258,9 +260,7 @@ NCursesUI::NCursesUI() while (auto key = get_next_key()) m_on_key(*key); }}, - m_assistant(assistant_clippy), - m_colors{default_colors}, - m_cursor{CursorMode::Buffer, {}} + m_assistant(assistant_clippy) { initscr(); raw(); diff --git a/src/regex_impl.cc b/src/regex_impl.cc index 78ddb375..f17e5984 100644 --- a/src/regex_impl.cc +++ b/src/regex_impl.cc @@ -672,7 +672,7 @@ constexpr RegexParser::ControlEscape RegexParser::control_escapes[]; struct RegexCompiler { RegexCompiler(ParsedRegex&& parsed_regex, RegexCompileFlags flags) - : m_parsed_regex{parsed_regex}, m_flags(flags) + : m_flags(flags), m_parsed_regex{parsed_regex} { kak_assert(not (flags & RegexCompileFlags::NoForward) or flags & RegexCompileFlags::Backward); // Approximation of the number of instructions generated diff --git a/src/selection.cc b/src/selection.cc index 00e750a5..3fff6eb8 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -8,7 +8,7 @@ namespace Kakoune { SelectionList::SelectionList(Buffer& buffer, Selection s, size_t timestamp) - : m_buffer(&buffer), m_selections({ std::move(s) }), m_timestamp(timestamp) + : m_selections({ std::move(s) }), m_buffer(&buffer), m_timestamp(timestamp) { check_invariant(); } @@ -17,7 +17,7 @@ SelectionList::SelectionList(Buffer& buffer, Selection s) : SelectionList(buffer, std::move(s), buffer.timestamp()) {} SelectionList::SelectionList(Buffer& buffer, Vector list, size_t timestamp) - : m_buffer(&buffer), m_selections(std::move(list)), m_timestamp(timestamp) + : m_selections(std::move(list)), m_buffer(&buffer), m_timestamp(timestamp) { kak_assert(size() > 0); m_main = size() - 1; @@ -28,7 +28,7 @@ SelectionList::SelectionList(Buffer& buffer, Vector list) : SelectionList(buffer, std::move(list), buffer.timestamp()) {} SelectionList::SelectionList(SelectionList::UnsortedTag, Buffer& buffer, Vector list, size_t timestamp, size_t main) - : m_buffer(&buffer), m_selections(std::move(list)), m_timestamp(timestamp) + : m_selections(std::move(list)), m_buffer(&buffer), m_timestamp(timestamp) { sort_and_merge_overlapping(); check_invariant(); diff --git a/src/utils.hh b/src/utils.hh index ec6965a8..9b6d87bb 100644 --- a/src/utils.hh +++ b/src/utils.hh @@ -65,11 +65,11 @@ class OnScopeEnd { public: [[gnu::always_inline]] - OnScopeEnd(T func) : m_func{std::move(func)}, m_valid{true} {} + OnScopeEnd(T func) : m_valid{true}, m_func{std::move(func)} {} [[gnu::always_inline]] OnScopeEnd(OnScopeEnd&& other) - : m_func{std::move(other.m_func)}, m_valid{other.m_valid} + : m_valid{other.m_valid}, m_func{std::move(other.m_func)} { other.m_valid = false; } [[gnu::always_inline]]