From 6e1a664286c2d84c8fec097c486f3593641b3f54 Mon Sep 17 00:00:00 2001 From: Tim Stack Date: Sat, 5 Aug 2023 22:26:00 -0700 Subject: [PATCH] [iwyu] more include cleanup --- src/all_logs_vtab.cc | 1 + src/all_logs_vtab.hh | 1 - src/field_overlay_source.cc | 2 -- src/highlighter.cc | 2 ++ src/highlighter.hh | 6 ++-- src/hotkeys.cc | 7 ----- src/log_data_table.cc | 1 + src/log_data_table.hh | 1 - src/log_format_loader.cc | 2 -- src/pcrepp/CMakeLists.txt | 1 + src/pcrepp/Makefile.am | 3 +- src/pcrepp/pcre2pp_fwd.hh | 41 ++++++++++++++++++++++++++ src/piper.looper.cc | 2 -- src/readline_callbacks.cc | 1 - src/readline_curses.cc | 1 - src/spectro_source.cc | 1 - src/static_file_vtab.cc | 2 -- src/textview_curses.cc | 52 --------------------------------- src/time-extension-functions.cc | 1 - src/view_helpers.cc | 1 - src/views_vtab.cc | 3 -- src/yajlpp/yajlpp.cc | 2 -- src/yaml-extension-functions.cc | 1 - 23 files changed, 51 insertions(+), 84 deletions(-) create mode 100644 src/pcrepp/pcre2pp_fwd.hh diff --git a/src/all_logs_vtab.cc b/src/all_logs_vtab.cc index f4468a6f..857b9f4c 100644 --- a/src/all_logs_vtab.cc +++ b/src/all_logs_vtab.cc @@ -31,6 +31,7 @@ #include "base/attr_line.hh" #include "config.h" +#include "data_parser.hh" static auto intern_lifetime = intern_string::get_table_lifetime(); diff --git a/src/all_logs_vtab.hh b/src/all_logs_vtab.hh index cab0a4d3..54b27d6e 100644 --- a/src/all_logs_vtab.hh +++ b/src/all_logs_vtab.hh @@ -32,7 +32,6 @@ #include -#include "data_parser.hh" #include "log_vtab_impl.hh" /** diff --git a/src/field_overlay_source.cc b/src/field_overlay_source.cc index 1ae5e036..3b8c45af 100644 --- a/src/field_overlay_source.cc +++ b/src/field_overlay_source.cc @@ -29,7 +29,6 @@ #include "field_overlay_source.hh" -#include "base/ansi_scrubber.hh" #include "base/humanize.time.hh" #include "base/snippet_highlighters.hh" #include "config.h" @@ -38,7 +37,6 @@ #include "log_vtab_impl.hh" #include "md2attr_line.hh" #include "readline_highlighters.hh" -#include "relative_time.hh" #include "vtab_module.hh" #include "vtab_module_json.hh" diff --git a/src/highlighter.cc b/src/highlighter.cc index fc7b4559..a8291cd1 100644 --- a/src/highlighter.cc +++ b/src/highlighter.cc @@ -30,6 +30,8 @@ #include "highlighter.hh" #include "config.h" +#include "pcrepp/pcre2pp.hh" +#include "view_curses.hh" highlighter& highlighter::operator=(const highlighter& other) diff --git a/src/highlighter.hh b/src/highlighter.hh index 25e8087e..2b8c72c7 100644 --- a/src/highlighter.hh +++ b/src/highlighter.hh @@ -35,10 +35,10 @@ #include #include -#include "optional.hpp" -#include "pcrepp/pcre2pp.hh" +#include "base/attr_line.hh" +#include "pcrepp/pcre2pp_fwd.hh" +#include "styling.hh" #include "text_format.hh" -#include "view_curses.hh" struct highlighter { highlighter() = default; diff --git a/src/hotkeys.cc b/src/hotkeys.cc index d1fdc559..b106487d 100644 --- a/src/hotkeys.cc +++ b/src/hotkeys.cc @@ -38,18 +38,11 @@ #include "bound_tags.hh" #include "command_executor.hh" #include "config.h" -#include "environ_vtab.hh" #include "field_overlay_source.hh" #include "lnav.hh" #include "lnav_config.hh" -#include "lnav_util.hh" -#include "log_data_helper.hh" -#include "plain_text_source.hh" -#include "readline_highlighters.hh" #include "shlex.hh" #include "sql_util.hh" -#include "sysclip.hh" -#include "termios_guard.hh" #include "xterm_mouse.hh" using namespace lnav::roles::literals; diff --git a/src/log_data_table.cc b/src/log_data_table.cc index 384d7ce0..a959b794 100644 --- a/src/log_data_table.cc +++ b/src/log_data_table.cc @@ -29,6 +29,7 @@ #include "log_data_table.hh" +#include "column_namer.hh" #include "config.h" #include "scn/scn.h" diff --git a/src/log_data_table.hh b/src/log_data_table.hh index 1ca39427..259b739b 100644 --- a/src/log_data_table.hh +++ b/src/log_data_table.hh @@ -35,7 +35,6 @@ #include #include -#include "column_namer.hh" #include "data_parser.hh" #include "log_vtab_impl.hh" #include "logfile.hh" diff --git a/src/log_format_loader.cc b/src/log_format_loader.cc index afa3acc9..523c87d8 100644 --- a/src/log_format_loader.cc +++ b/src/log_format_loader.cc @@ -34,8 +34,6 @@ #include "log_format_loader.hh" -#include -#include #include #include #include diff --git a/src/pcrepp/CMakeLists.txt b/src/pcrepp/CMakeLists.txt index 1af88453..b85ca4c7 100644 --- a/src/pcrepp/CMakeLists.txt +++ b/src/pcrepp/CMakeLists.txt @@ -1,6 +1,7 @@ add_library(pcrepp STATIC ../config.h.in pcre2pp.hh + pcre2pp_fwd.hh pcre2pp.cc) target_include_directories(pcrepp PUBLIC . .. ../third-party/scnlib/include diff --git a/src/pcrepp/Makefile.am b/src/pcrepp/Makefile.am index 72e83198..d3f3feb7 100644 --- a/src/pcrepp/Makefile.am +++ b/src/pcrepp/Makefile.am @@ -16,7 +16,8 @@ AM_CXXFLAGS = $(CODE_COVERAGE_CXXFLAGS) noinst_LIBRARIES = libpcrepp.a noinst_HEADERS = \ - pcre2pp.hh + pcre2pp.hh \ + pcre2pp_fwd.hh libpcrepp_a_SOURCES = \ pcre2pp.cc diff --git a/src/pcrepp/pcre2pp_fwd.hh b/src/pcrepp/pcre2pp_fwd.hh new file mode 100644 index 00000000..91a6122f --- /dev/null +++ b/src/pcrepp/pcre2pp_fwd.hh @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2023, Timothy Stack + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Timothy Stack nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ''AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef lnav_pcre2pp_fwd_hh +#define lnav_pcre2pp_fwd_hh + +namespace lnav { +namespace pcre2pp { + +class code; + +} +} // namespace lnav + +#endif diff --git a/src/piper.looper.cc b/src/piper.looper.cc index f8634382..5522f4b8 100644 --- a/src/piper.looper.cc +++ b/src/piper.looper.cc @@ -28,7 +28,6 @@ */ #include -#include #include "piper.looper.hh" @@ -37,7 +36,6 @@ #include "base/fs_util.hh" #include "base/injector.hh" -#include "base/paths.hh" #include "base/time_util.hh" #include "config.h" #include "hasher.hh" diff --git a/src/readline_callbacks.cc b/src/readline_callbacks.cc index 4cb2a371..2068fc95 100644 --- a/src/readline_callbacks.cc +++ b/src/readline_callbacks.cc @@ -44,7 +44,6 @@ #include "readline_highlighters.hh" #include "service_tags.hh" #include "sql_help.hh" -#include "sqlite-extension-func.hh" #include "tailer/tailer.looper.hh" #include "view_helpers.examples.hh" #include "vtab_module.hh" diff --git a/src/readline_curses.cc b/src/readline_curses.cc index e6e328a8..7fc47bf9 100644 --- a/src/readline_curses.cc +++ b/src/readline_curses.cc @@ -61,7 +61,6 @@ #include "base/string_util.hh" #include "fmt/format.h" #include "fts_fuzzy_match.hh" -#include "lnav_util.hh" #include "readline_curses.hh" #include "shlex.hh" #include "spookyhash/SpookyV2.h" diff --git a/src/spectro_source.cc b/src/spectro_source.cc index 7c3127aa..8c18b016 100644 --- a/src/spectro_source.cc +++ b/src/spectro_source.cc @@ -33,7 +33,6 @@ #include "base/ansi_scrubber.hh" #include "base/math_util.hh" -#include "command_executor.hh" #include "config.h" nonstd::optional diff --git a/src/static_file_vtab.cc b/src/static_file_vtab.cc index 70816cae..51b28ffc 100644 --- a/src/static_file_vtab.cc +++ b/src/static_file_vtab.cc @@ -31,13 +31,11 @@ #include "static_file_vtab.hh" -#include #include #include "base/auto_mem.hh" #include "base/fs_util.hh" #include "base/lnav_log.hh" -#include "base/paths.hh" #include "config.h" #include "ghc/filesystem.hpp" #include "lnav.hh" diff --git a/src/textview_curses.cc b/src/textview_curses.cc index 5253ab45..f7f690b5 100644 --- a/src/textview_curses.cc +++ b/src/textview_curses.cc @@ -37,7 +37,6 @@ #include "base/injector.hh" #include "base/time_util.hh" #include "config.h" -#include "data_parser.hh" #include "fmt/format.h" #include "lnav_config.hh" #include "log_format.hh" @@ -546,57 +545,6 @@ textview_curses::textview_value_for_row(vis_line_t row, attr_line_t& value_out) value_out.apply_hide(); } -#if 0 - typedef std::map key_map_t; - static key_map_t key_roles; - - data_scanner ds(str); - data_parser dp(&ds); - - dp.parse(); - - for (list::iterator iter = dp.dp_stack.begin(); - iter != dp.dp_stack.end(); - ++iter) { - view_colors &vc = view_colors::singleton(); - - if (iter->e_token == DNT_PAIR) { - list::iterator pair_iter; - key_map_t::iterator km_iter; - data_token_t value_token; - struct line_range lr; - string key; - - value_token = - iter->e_sub_elements->back().e_sub_elements->front().e_token; - if (value_token == DT_STRING) { - continue; - } - - lr.lr_start = iter->e_capture.c_begin; - lr.lr_end = iter->e_capture.c_end; - - key = ds.get_input().get_substr( - &iter->e_sub_elements->front().e_capture); - if ((km_iter = key_roles.find(key)) == key_roles.end()) { - key_roles[key] = vc.next_highlight(); - } - /* fprintf(stderr, "key = %s\n", key.c_str()); */ - sa[lr].insert(make_string_attr("style", - vc.attrs_for_role(key_roles[key]))); - - pair_iter = iter->e_sub_elements->begin(); - ++pair_iter; - - lr.lr_start = pair_iter->e_capture.c_begin; - lr.lr_end = pair_iter->e_capture.c_end; - sa[lr].insert(make_string_attr("style", - COLOR_PAIR(view_colors::VC_WHITE) | - A_BOLD)); - } - } -#endif - const auto& user_marks = this->tc_bookmarks[&BM_USER]; const auto& user_expr_marks = this->tc_bookmarks[&BM_USER_EXPR]; if (binary_search(user_marks.begin(), user_marks.end(), row) diff --git a/src/time-extension-functions.cc b/src/time-extension-functions.cc index b92ec2a2..fd849971 100644 --- a/src/time-extension-functions.cc +++ b/src/time-extension-functions.cc @@ -36,7 +36,6 @@ #include "base/date_time_scanner.hh" #include "base/humanize.time.hh" -#include "base/lrucache.hpp" #include "config.h" #include "relative_time.hh" #include "sql_util.hh" diff --git a/src/view_helpers.cc b/src/view_helpers.cc index c9c8e825..3a279f2e 100644 --- a/src/view_helpers.cc +++ b/src/view_helpers.cc @@ -29,7 +29,6 @@ #include "view_helpers.hh" -#include "base/humanize.hh" #include "base/itertools.hh" #include "config.h" #include "document.sections.hh" diff --git a/src/views_vtab.cc b/src/views_vtab.cc index 97172ebb..73e5eb50 100644 --- a/src/views_vtab.cc +++ b/src/views_vtab.cc @@ -34,14 +34,11 @@ #include #include "base/injector.bind.hh" -#include "base/itertools.hh" #include "base/lnav_log.hh" #include "base/opt_util.hh" #include "config.h" #include "lnav.hh" -#include "lnav_util.hh" #include "sql_util.hh" -#include "view_curses.hh" #include "vtab_module_json.hh" #include "yajlpp/yajlpp_def.hh" diff --git a/src/yajlpp/yajlpp.cc b/src/yajlpp/yajlpp.cc index 2d5bdf0a..63b11945 100644 --- a/src/yajlpp/yajlpp.cc +++ b/src/yajlpp/yajlpp.cc @@ -34,8 +34,6 @@ #include "yajlpp.hh" -#include "base/fs_util.hh" -#include "base/snippet_highlighters.hh" #include "config.h" #include "fmt/format.h" #include "ghc/filesystem.hpp" diff --git a/src/yaml-extension-functions.cc b/src/yaml-extension-functions.cc index 0a586527..bed64961 100644 --- a/src/yaml-extension-functions.cc +++ b/src/yaml-extension-functions.cc @@ -36,7 +36,6 @@ #include "ryml_all.hpp" #include "sqlite-extension-func.hh" #include "vtab_module.hh" -#include "yajlpp/yajlpp.hh" using namespace lnav::roles::literals;