From 59934e59d2edf8179b4cd36c6a964cee9fb62184 Mon Sep 17 00:00:00 2001 From: kcgen <1557255+kcgen@users.noreply.github.com> Date: Sat, 21 Aug 2021 15:12:52 -0700 Subject: [PATCH] Initialize member variable with default values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the following GCC warnings: nk(FILE*, spdlog::color_mode) [with ConsoleMutex = spdlog::details::console_mutex; FILE = FILE]’: ../../submodules/spdlog/include/spdlog/sinks/ansicolor_sink-inl.h:135:48: required from ‘spdlog::sinks::ansicolor_stdout_sink::ansicolor_stdout_sink(spdlog::color_mode) [with ConsoleMutex = spdlog::details::console_mutex]’ /usr/include/c++/11/ext/new_allocator.h:156:4: required from ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = spdlog::sinks::ansicolor_stdout_sink; _Args = {}; _Tp = spdlog::sinks::ansicolor_stdout_sink]’ /usr/include/c++/11/bits/alloc_traits.h:512:17: required from ‘static void std::allocator_traits >::construct(std::allocator_traits >::allocator_type&, _Up*, _Args&& ...) [with _Up = spdlog::sinks::ansicolor_stdout_sink; _Args = {}; _Tp = spdlog::sinks::ansicolor_stdout_sink; std::allocator_traits >::allocator_type = std::allocator >]’ /usr/include/c++/11/bits/shared_ptr_base.h:519:39: required from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {}; _Tp = spdlog::sinks::ansicolor_stdout_sink; _Alloc = std::allocator >; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ /usr/include/c++/11/bits/shared_ptr_base.h:650:16: required from ‘std::__shared_count<_Lp>::__shared_count(_Tp*&, std::_Sp_alloc_shared_tag<_Alloc>, _Args&& ...) [with _Tp = spdlog::sinks::ansicolor_stdout_sink; _Alloc = std::allocator >; _Args = {}; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ /usr/include/c++/11/bits/shared_ptr_base.h:1337:14: required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator >; _Args = {}; _Tp = spdlog::sinks::ansicolor_stdout_sink; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ /usr/include/c++/11/bits/shared_ptr.h:409:59: required from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator >; _Args = {}; _Tp = spdlog::sinks::ansicolor_stdout_sink]’ /usr/include/c++/11/bits/shared_ptr.h:860:14: required from ‘std::shared_ptr<_Tp> std::allocate_shared(const _Alloc&, _Args&& ...) [with _Tp = spdlog::sinks::ansicolor_stdout_sink; _Alloc = std::allocator >; _Args = {}]’ /usr/include/c++/11/bits/shared_ptr.h:876:39: required from ‘std::shared_ptr<_Tp> std::make_shared(_Args&& ...) [with _Tp = spdlog::sinks::ansicolor_stdout_sink; _Args = {}]’ ../../submodules/spdlog/include/spdlog/details/registry-inl.h:42:72: required from here ../../submodules/spdlog/include/spdlog/sinks/ansicolor_sink-inl.h:17:15: warning: ‘spdlog::sinks::ansicolor_sink::should_do_colors_’ should be initialized in the member initialization list [-Weffc++] 17 | SPDLOG_INLINE ansicolor_sink::ansicolor_sink(FILE *target_file, color_mode mode) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/sinks/ansicolor_sink-inl.h:17:15: warning: ‘spdlog::sinks::ansicolor_sink::colors_’ should be initialized in the member initialization list ../../submodules/spdlog/include/spdlog/details/log_msg.h: In instantiation of ‘void std::_Construct(_Tp*, _Args&& ...) [with _Tp = spdlog::details::log_msg_buffer; _Args = {}]’: /usr/include/c++/11/bits/stl_uninitialized.h:579:18: required from ‘static _ForwardIterator std::__uninitialized_default_n_1<_TrivialValueType>::__uninit_default_n(_ForwardIterator, _Size) [with _ForwardIterator = spdlog::details::log_msg_buffer*; _Size = long unsigned int; bool _TrivialValueType = false]’ /usr/include/c++/11/bits/stl_uninitialized.h:640:20: required from ‘_ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = spdlog::details::log_msg_buffer*; _Size = long unsigned int]’ /usr/include/c++/11/bits/stl_uninitialized.h:704:44: required from ‘_ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, std::allocator<_Tp>&) [with _ForwardIterator = spdlog::details::log_msg_buffer*; _Size = long unsigned int; _Tp = spdlog::details::log_msg_buffer]’ /usr/include/c++/11/bits/stl_vector.h:1606:36: required from ‘void std::vector<_Tp, _Alloc>::_M_default_initialize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = spdlog::details::log_msg_buffer; _Alloc = std::allocator; std::vector<_Tp, _Alloc>::size_type = long unsigned int]’ /usr/include/c++/11/bits/stl_vector.h:512:9: required from ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = spdlog::details::log_msg_buffer; _Alloc = std::allocator; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator]’ ../../submodules/spdlog/include/spdlog/details/circular_q.h:29:11: required from ‘spdlog::details::circular_q::circular_q(size_t) [with T = spdlog::details::log_msg_buffer; size_t = long unsigned int]’ ../../submodules/spdlog/include/spdlog/details/backtracer-inl.h:37:48: required from here ../../submodules/spdlog/include/spdlog/details/log_msg.h:13:5: warning: ‘spdlog::details::log_msg::logger_name’ should be initialized in the member initialization list [-Weffc++] 13 | log_msg() = default; | ^~~~~~~ ../../submodules/spdlog/include/spdlog/details/log_msg.h:13:5: warning: ‘spdlog::details::log_msg::time’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/details/log_msg.h:13:5: warning: ‘spdlog::details::log_msg::source’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/details/log_msg.h:13:5: warning: ‘spdlog::details::log_msg::payload’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h: In instantiation of ‘fmt::v8::detail::buffer::buffer(size_t) [with T = char; size_t = long unsigned int]’: ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:915:71: required from ‘fmt::v8::detail::iterator_buffer, typename std::enable_if::value, typename Container::value_type>::type>::iterator_buffer(Container&) [with Container = fmt::v8::basic_memory_buffer; typename std::enable_if::value, typename Container::value_type>::type = char; typename Container::value_type = char]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:917:43: required from ‘fmt::v8::detail::iterator_buffer, typename std::enable_if::value, typename Container::value_type>::type>::iterator_buffer(std::back_insert_iterator<_Container>, size_t) [with Container = fmt::v8::basic_memory_buffer; typename std::enable_if::value, typename Container::value_type>::type = char; typename Container::value_type = char; size_t = long unsigned int]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:950:10: required from ‘fmt::v8::detail::iterator_buffer fmt::v8::detail::get_buffer(OutputIt) [with T = char; OutputIt = std::back_insert_iterator >]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2902:32: required from ‘OutputIt fmt::v8::vformat_to(OutputIt, fmt::v8::string_view, fmt::v8::format_args) [with OutputIt = std::back_insert_iterator >; typename std::enable_if::value, int>::type = 0; fmt::v8::string_view = fmt::v8::basic_string_view; fmt::v8::format_args = fmt::v8::basic_format_args >]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2923:20: required from ‘OutputIt fmt::v8::format_to(OutputIt, fmt::v8::format_string, T&& ...) [with OutputIt = std::back_insert_iterator >; T = {int&}; typename std::enable_if::value, int>::type = 0; fmt::v8::format_string = fmt::v8::basic_format_string]’ ../../submodules/spdlog/include/spdlog/details/fmt_helper.h:58:23: required from here ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:758:3: warning: ‘fmt::v8::detail::buffer::ptr_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:2368:29: required from ‘int fmt::v8::detail::format_float(T, int, fmt::v8::detail::float_specs, fmt::v8::detail::buffer&) [with T = long double]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h:1809:25: required from ‘OutputIt fmt::v8::detail::write(OutputIt, T, fmt::v8::basic_format_specs, fmt::v8::detail::locale_ref) [with Char = char; OutputIt = fmt::v8::appender; T = long double; typename std::enable_if::value, int>::type = 0]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h:1846:15: required from ‘OutputIt fmt::v8::detail::write(OutputIt, T) [with Char = char; OutputIt = fmt::v8::appender; T = long double; typename std::enable_if<(std::is_floating_point::value && (! std::integral_constant::is_iec559 && (sizeof (T) <= sizeof (double)))>::value)), int>::type = 0]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h:1969:23: required from ‘fmt::v8::detail::default_arg_formatter::iterator fmt::v8::detail::default_arg_formatter::operator()(T) [with T = long double; Char = char; fmt::v8::detail::default_arg_formatter::iterator = fmt::v8::appender]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:1473:15: required from ‘constexpr decltype (vis(0)) fmt::v8::visit_format_arg(Visitor&&, const fmt::v8::basic_format_arg&) [with Visitor = fmt::v8::detail::default_arg_formatter; Context = fmt::v8::basic_format_context; decltype (vis(0)) = fmt::v8::appender]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h:2649:5: required from ‘void fmt::v8::detail::vformat_to(fmt::v8::detail::buffer&, fmt::v8::basic_string_view, fmt::v8::basic_format_args::type, char>::value, fmt::v8::appender, std::back_insert_iterator::type> > >::type, typename fmt::v8::type_identity::type> >, fmt::v8::detail::locale_ref) [with Char = char; typename fmt::v8::type_identity::type = char; typename std::conditional::type, char>::value, fmt::v8::appender, std::back_insert_iterator::type> > >::type = fmt::v8::appender]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:2565:21: required from here ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:202:39: warning: ‘fmt::v8::detail::fp::f’ should be initialized in the member initialization list [-Weffc++] 202 | template explicit fp(Double d) { assign(d); } | ^~ ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:202:39: warning: ‘fmt::v8::detail::fp::e’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h: In instantiation of ‘fmt::v8::detail::fp::fp(Double) [with Double = double]’: ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:2368:29: required from ‘int fmt::v8::detail::format_float(T, int, fmt::v8::detail::float_specs, fmt::v8::detail::buffer&) [with T = double]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h:1809:25: required from ‘OutputIt fmt::v8::detail::write(OutputIt, T, fmt::v8::basic_format_specs, fmt::v8::detail::locale_ref) [with Char = char; OutputIt = fmt::v8::appender; T = float; typename std::enable_if::value, int>::type = 0]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h:1989:25: required from ‘constexpr fmt::v8::detail::arg_formatter::iterator fmt::v8::detail::arg_formatter::operator()(T) [with T = float; Char = char; fmt::v8::detail::arg_formatter::iterator = fmt::v8::appender]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:1469:15: required from ‘constexpr decltype (vis(0)) fmt::v8::visit_format_arg(Visitor&&, const fmt::v8::basic_format_arg&) [with Visitor = fmt::v8::detail::arg_formatter&; Context = fmt::v8::basic_format_context; decltype (vis(0)) = fmt::v8::appender]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h:2702:42: required from ‘const Char* fmt::v8::detail::vformat_to(fmt::v8::detail::buffer&, fmt::v8::basic_string_view, fmt::v8::basic_format_args::type, char>::value, fmt::v8::appender, std::back_insert_iterator::type> > >::type, typename fmt::v8::type_identity::type> >, fmt::v8::detail::locale_ref)::format_handler::on_format_specs(int, const Char*, const Char*) [with Char = char]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h:2705:3: required from ‘void fmt::v8::detail::vformat_to(fmt::v8::detail::buffer&, fmt::v8::basic_string_view, fmt::v8::basic_format_args::type, char>::value, fmt::v8::appender, std::back_insert_iterator::type> > >::type, typename fmt::v8::type_identity::type> >, fmt::v8::detail::locale_ref) [with Char = char; typename fmt::v8::type_identity::type = char; typename std::conditional::type, char>::value, fmt::v8::appender, std::back_insert_iterator::type> > >::type = fmt::v8::appender]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:2565:21: required from here ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:202:39: warning: ‘fmt::v8::detail::fp::f’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:202:39: warning: ‘fmt::v8::detail::fp::e’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2450:12: note: synthesized method ‘constexpr fmt::v8::formatter::formatter()’ first required here 2450 | auto f = conditional_t::value, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2451 | formatter, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2452 | fallback_formatter>(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h: In instantiation of ‘constexpr decltype (ctx.begin()) fmt::v8::detail::parse_format_specs(ParseContext&) [with T = int; ParseContext = fmt::v8::detail::compile_parse_context; decltype (ctx.begin()) = const char*]’: ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2696:9: required from ‘constexpr fmt::v8::detail::format_string_checker::format_string_checker(fmt::v8::basic_string_view, ErrorHandler) [with Char = char; ErrorHandler = fmt::v8::detail::error_handler; Args = {char [7], int}]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2737:33: required from ‘void fmt::v8::detail::check_format_string(S) [with = {const char (&)[7], int&}; S = fmt::v8::detail::format_error_code(fmt::v8::detail::buffer&, int, fmt::v8::string_view)::::FMT_COMPILE_STRING; typename std::enable_if::value, int>::type = 0]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2856:41: required from ‘fmt::v8::basic_format_string::basic_format_string(const S&) [with S = fmt::v8::detail::format_error_code(fmt::v8::detail::buffer&, int, fmt::v8::string_view)::::FMT_COMPILE_STRING; typename std::enable_if >::value, int>::type = 0; Char = char; Args = {const char (&)[7], int&}]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:75:12: required from here ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2756:8: warning: ‘fmt::v8::formatter::specs_’ should be initialized in the member initialization list [-Weffc++] 2756 | struct formatter::value != | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2758 | detail::type::custom_type>> { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2450:12: note: synthesized method ‘constexpr fmt::v8::formatter::formatter()’ first required here 2450 | auto f = conditional_t::value, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2451 | formatter, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2452 | fallback_formatter>(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h: In instantiation of ‘constexpr decltype (ctx.begin()) fmt::v8::detail::parse_format_specs(ParseContext&) [with T = unsigned int; ParseContext = fmt::v8::detail::compile_parse_context; decltype (ctx.begin()) = const char*]’: ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2696:9: required from ‘constexpr fmt::v8::detail::format_string_checker::format_string_checker(fmt::v8::basic_string_view, ErrorHandler) [with Char = char; ErrorHandler = fmt::v8::detail::error_handler; Args = {unsigned int}]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2737:33: required from ‘void fmt::v8::detail::check_format_string(S) [with = {unsigned int&}; S = fmt::v8::formatter::format(const fmt::v8::detail::bigint&, fmt::v8::format_context&)::::FMT_COMPILE_STRING; typename std::enable_if::value, int>::type = 0]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2856:41: required from ‘fmt::v8::basic_format_string::basic_format_string(const S&) [with S = fmt::v8::formatter::format(const fmt::v8::detail::bigint&, fmt::v8::format_context&)::::FMT_COMPILE_STRING; typename std::enable_if >::value, int>::type = 0; Char = char; Args = {unsigned int&}]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:2514:24: required from here ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2756:8: warning: ‘fmt::v8::formatter::specs_’ should be initialized in the member initialization list [-Weffc++] 2756 | struct formatter::value != | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2758 | detail::type::custom_type>> { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2450:12: note: synthesized method ‘constexpr fmt::v8::formatter::formatter()’ first required here ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h: In instantiation of ‘constexpr decltype (ctx.begin()) fmt::v8::detail::parse_format_specs(ParseContext&) [with T = fmt::v8::basic_string_view; ParseContext = fmt::v8::detail::compile_parse_context; decltype (ctx.begin()) = const char*]’: ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2696:9: required from ‘constexpr fmt::v8::detail::format_string_checker::format_string_checker(fmt::v8::basic_string_view, ErrorHandler) [with Char = char; ErrorHandler = fmt::v8::detail::error_handler; Args = {fmt::v8::basic_string_view, char [3]}]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2737:33: required from ‘void fmt::v8::detail::check_format_string(S) [with = {fmt::v8::basic_string_view&, const char (&)[3]}; S = fmt::v8::detail::format_error_code(fmt::v8::detail::buffer&, int, fmt::v8::string_view)::::FMT_COMPILE_STRING; typename std::enable_if::value, int>::type = 0]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2856:41: required from ‘fmt::v8::basic_format_string::basic_format_string(const S&) [with S = fmt::v8::detail::format_error_code(fmt::v8::detail::buffer&, int, fmt::v8::string_view)::::FMT_COMPILE_STRING; typename std::enable_if >::value, int>::type = 0; Char = char; Args = {fmt::v8::basic_string_view&, const char (&)[3]}]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:74:14: required from here ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2756:8: warning: ‘fmt::v8::formatter, char, void>::specs_’ should be initialized in the member initialization list [-Weffc++] 2756 | struct formatter::value != | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2758 | detail::type::custom_type>> { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:1960:8: warning: ‘fmt::v8::detail::dynamic_format_specs::width_ref’ should be initialized in the member initialization list [-Weffc++] 1960 | struct dynamic_format_specs : basic_format_specs { | ^~~~~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:1960:8: warning: ‘fmt::v8::detail::dynamic_format_specs::precision_ref’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2756:8: note: synthesized method ‘constexpr fmt::v8::detail::dynamic_format_specs::dynamic_format_specs()’ first required here 2756 | struct formatter::value != | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2758 | detail::type::custom_type>> { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2450:12: note: synthesized method ‘constexpr fmt::v8::formatter, char, void>::formatter()’ first required here 2450 | auto f = conditional_t::value, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2451 | formatter, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2452 | fallback_formatter>(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h: In instantiation of ‘constexpr decltype (ctx.begin()) fmt::v8::detail::parse_format_specs(ParseContext&) [with T = char [3]; ParseContext = fmt::v8::detail::compile_parse_context; decltype (ctx.begin()) = const char*]’: ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2696:9: required from ‘constexpr fmt::v8::detail::format_string_checker::format_string_checker(fmt::v8::basic_string_view, ErrorHandler) [with Char = char; ErrorHandler = fmt::v8::detail::error_handler; Args = {fmt::v8::basic_string_view, char [3]}]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2737:33: required from ‘void fmt::v8::detail::check_format_string(S) [with = {fmt::v8::basic_string_view&, const char (&)[3]}; S = fmt::v8::detail::format_error_code(fmt::v8::detail::buffer&, int, fmt::v8::string_view)::::FMT_COMPILE_STRING; typename std::enable_if::value, int>::type = 0]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2856:41: required from ‘fmt::v8::basic_format_string::basic_format_string(const S&) [with S = fmt::v8::detail::format_error_code(fmt::v8::detail::buffer&, int, fmt::v8::string_view)::::FMT_COMPILE_STRING; typename std::enable_if >::value, int>::type = 0; Char = char; Args = {fmt::v8::basic_string_view&, const char (&)[3]}]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:74:14: required from here ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:2756:8: warning: ‘fmt::v8::formatter::specs_’ should be initialized in the member initialization list [-Weffc++] 2756 | struct formatter::value != | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2758 | detail::type::custom_type>> { ../../submodules/spdlog/include/spdlog/pattern_formatter-inl.h: In instantiation of ‘typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...) [with _Tp = spdlog::details::aggregate_formatter; _Args = {}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr >]’: ../../submodules/spdlog/include/spdlog/pattern_formatter-inl.h:1385:80: required from here ../../submodules/spdlog/include/spdlog/pattern_formatter-inl.h:714:5: warning: ‘spdlog::details::aggregate_formatter::str_’ should be initialized in the member initialization list [-Weffc++] 714 | aggregate_formatter() = default; ../../submodules/spdlog/include/spdlog/logger.h: In instantiation of ‘spdlog::logger::logger(std::string, It, It) [with It = const std::shared_ptr*; std::string = std::__cxx11::basic_string]’: ../../submodules/spdlog/include/spdlog/logger.h:77:61: required from here ../../submodules/spdlog/include/spdlog/logger.h:65:5: warning: ‘spdlog::logger::tracer_’ should be initialized in the member initialization list [-Weffc++] 65 | logger(std::string name, It begin, It end) | ^~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h: In instantiation of ‘fmt::v8::basic_memory_buffer::basic_memory_buffer(fmt::v8::basic_memory_buffer&&) [with T = char; long unsigned int SIZE = 250; Allocator = std::allocator]’: ../../submodules/spdlog/include/spdlog/details/log_msg_buffer-inl.h:29:104: required from here ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h:676:3: warning: ‘fmt::v8::basic_memory_buffer::alloc_’ should be initialized in the member initialization list [-Weffc++] 676 | basic_memory_buffer(basic_memory_buffer&& other) FMT_NOEXCEPT { move(other); } | ^~~~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h: In instantiation of ‘constexpr fmt::v8::basic_format_arg::basic_format_arg() [with Context = fmt::v8::basic_format_context]’: ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:1815:16: required from ‘constexpr fmt::v8::basic_format_args::format_arg fmt::v8::basic_format_args::get(int) const [with Context = fmt::v8::basic_format_context; fmt::v8::basic_format_args::format_arg = fmt::v8::basic_format_arg >]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h:2647:24: required from ‘void fmt::v8::detail::vformat_to(fmt::v8::detail::buffer&, fmt::v8::basic_string_view, fmt::v8::basic_format_args::type, char>::value, fmt::v8::appender, std::back_insert_iterator::type> > >::type, typename fmt::v8::type_identity::type> >, fmt::v8::detail::locale_ref) [with Char = char; typename fmt::v8::type_identity::type = char; typename std::conditional::type, char>::value, fmt::v8::appender, std::back_insert_iterator::type> > >::type = fmt::v8::appender]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:2565:21: required from here ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:1425:13: warning: ‘fmt::v8::basic_format_arg >::value_’ should be initialized in the member initialization list [-Weffc++] 1425 | constexpr basic_format_arg() : type_(detail::type::none_type) {} | ^~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h: In instantiation of ‘constexpr fmt::v8::basic_format_specs::basic_format_specs() [with Char = char]’: ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h:2695:12: required from ‘const Char* fmt::v8::detail::vformat_to(fmt::v8::detail::buffer&, fmt::v8::basic_string_view, fmt::v8::basic_format_args::type, char>::value, fmt::v8::appender, std::back_insert_iterator::type> > >::type, typename fmt::v8::type_identity::type> >, fmt::v8::detail::locale_ref)::format_handler::on_format_specs(int, const Char*, const Char*) [with Char = char]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h:2705:3: required from ‘void fmt::v8::detail::vformat_to(fmt::v8::detail::buffer&, fmt::v8::basic_string_view, fmt::v8::basic_format_args::type, char>::value, fmt::v8::appender, std::back_insert_iterator::type> > >::type, typename fmt::v8::type_identity::type> >, fmt::v8::detail::locale_ref) [with Char = char; typename fmt::v8::type_identity::type = char; typename std::conditional::type, char>::value, fmt::v8::appender, std::back_insert_iterator::type> > >::type = fmt::v8::appender]’ ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:2565:21: required from here ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:1915:13: warning: ‘fmt::v8::basic_format_specs::fill’ should be initialized in the member initialization list [-Weffc++] 1915 | constexpr basic_format_specs() | ^~~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h: In instantiation of ‘fmt::v8::basic_memory_buffer::basic_memory_buffer(fmt::v8::basic_memory_buffer&&) [with T = char; long unsigned int SIZE = 500; Allocator = std::allocator]’: ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:2564:31: required from here ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h:676:3: warning: ‘fmt::v8::basic_memory_buffer::alloc_’ should be initialized in the member initialization list [-Weffc++] 676 | basic_memory_buffer(basic_memory_buffer&& other) FMT_NOEXCEPT { move(other); } | ^~~~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h: In instantiation of ‘fmt::v8::basic_string_view::basic_string_view(const Char*) [with Char = char]’: ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:2549:20: required from here ../../submodules/spdlog/include/spdlog/fmt/bundled/core.h:460:3: warning: ‘fmt::v8::basic_string_view::size_’ should be initialized in the member initialization list [-Weffc++] 460 | basic_string_view(const Char* s) : data_(s) { | ^~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h: In instantiation of ‘fmt::v8::basic_memory_buffer::basic_memory_buffer(fmt::v8::basic_memory_buffer&&) [with T = unsigned int; long unsigned int SIZE = 32; Allocator = std::allocator]’: ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:544:69: required from here ../../submodules/spdlog/include/spdlog/fmt/bundled/format.h:676:3: warning: ‘fmt::v8::basic_memory_buffer::alloc_’ should be initialized in the member initialization list [-Weffc++] 676 | basic_memory_buffer(basic_memory_buffer&& other) FMT_NOEXCEPT { move(other); } | ^~~~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/details/registry-inl.h: In constructor ‘spdlog::details::registry::registry()’: ../../submodules/spdlog/include/spdlog/details/registry-inl.h:33:15: warning: ‘spdlog::details::registry::logger_map_mutex_’ should be initialized in the member initialization list [-Weffc++] 33 | SPDLOG_INLINE registry::registry() | ^~~~~~~~ ../../submodules/spdlog/include/spdlog/details/registry-inl.h:33:15: warning: ‘spdlog::details::registry::flusher_mutex_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/details/registry-inl.h:33:15: warning: ‘spdlog::details::registry::tp_mutex_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/details/registry-inl.h:33:15: warning: ‘spdlog::details::registry::loggers_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/details/registry-inl.h:33:15: warning: ‘spdlog::details::registry::log_levels_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/details/registry-inl.h:33:15: warning: ‘spdlog::details::registry::err_handler_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/details/registry-inl.h:33:15: warning: ‘spdlog::details::registry::tp_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/details/registry-inl.h:33:15: warning: ‘spdlog::details::registry::periodic_flusher_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/details/registry-inl.h:33:15: warning: ‘spdlog::details::registry::default_logger_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/pattern_formatter-inl.h: In constructor ‘spdlog::details::full_formatter::full_formatter(spdlog::details::padding_info)’: ../../submodules/spdlog/include/spdlog/pattern_formatter-inl.h:932:14: warning: ‘spdlog::details::full_formatter::cached_datetime_’ should be initialized in the member initialization list [-Weffc++] 932 | explicit full_formatter(padding_info padinfo) | ^~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/pattern_formatter-inl.h: In constructor ‘spdlog::pattern_formatter::pattern_formatter(std::string, spdlog::pattern_time_type, std::string, spdlog::pattern_formatter::custom_flags)’: ../../submodules/spdlog/include/spdlog/pattern_formatter-inl.h:1017:15: warning: ‘spdlog::pattern_formatter::cached_tm_’ should be initialized in the member initialization list [-Weffc++] 1017 | SPDLOG_INLINE pattern_formatter::pattern_formatter( | ^~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/pattern_formatter-inl.h:1017:15: warning: ‘spdlog::pattern_formatter::formatters_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/pattern_formatter-inl.h: In constructor ‘spdlog::pattern_formatter::pattern_formatter(spdlog::pattern_time_type, std::string)’: ../../submodules/spdlog/include/spdlog/pattern_formatter-inl.h:1030:15: warning: ‘spdlog::pattern_formatter::cached_tm_’ should be initialized in the member initialization list [-Weffc++] 1030 | SPDLOG_INLINE pattern_formatter::pattern_formatter(pattern_time_type time_type, std::string eol) | ^~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/pattern_formatter-inl.h:1030:15: warning: ‘spdlog::pattern_formatter::formatters_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/pattern_formatter-inl.h:1030:15: warning: ‘spdlog::pattern_formatter::custom_handlers_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/pattern_formatter.h: In constructor ‘constexpr spdlog::details::flag_formatter::flag_formatter()’: ../../submodules/spdlog/include/spdlog/pattern_formatter.h:56:5: warning: ‘spdlog::details::flag_formatter::padinfo_’ should be initialized in the member initialization list [-Weffc++] 56 | flag_formatter() = default; | ^~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/pattern_formatter-inl.h: In constructor ‘spdlog::details::scoped_padder::scoped_padder(size_t, const spdlog::details::padding_info&, spdlog::memory_buf_t&)’: ../../submodules/spdlog/include/spdlog/pattern_formatter-inl.h:40:5: warning: ‘spdlog::details::scoped_padder::remaining_pad_’ should be initialized in the member initialization list [-Weffc++] 40 | scoped_padder(size_t wrapped_size, const padding_info &padinfo, memory_buf_t &dest) | ^~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/details/backtracer.h: In constructor ‘spdlog::details::backtracer::backtracer()’: ../../submodules/spdlog/include/spdlog/details/backtracer.h:25:5: warning: ‘spdlog::details::backtracer::mutex_’ should be initialized in the member initialization list [-Weffc++] 25 | backtracer() = default; | ^~~~~~~~~~ ../../submodules/spdlog/include/spdlog/details/backtracer.h:25:5: warning: ‘spdlog::details::backtracer::messages_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/logger.h: In constructor ‘spdlog::logger::logger(std::string)’: ../../submodules/spdlog/include/spdlog/logger.h:58:14: warning: ‘spdlog::logger::tracer_’ should be initialized in the member initialization list [-Weffc++] 58 | explicit logger(std::string name) ../../submodules/spdlog/include/spdlog/details/backtracer-inl.h: In constructor ‘spdlog::details::backtracer::backtracer(spdlog::details::backtracer&&)’: ../../submodules/spdlog/include/spdlog/details/backtracer-inl.h:18:15: warning: ‘spdlog::details::backtracer::mutex_’ should be initialized in the member initialization list [-Weffc++] 18 | SPDLOG_INLINE backtracer::backtracer(backtracer &&other) SPDLOG_NOEXCEPT | ^~~~~~~~~~ ../../submodules/spdlog/include/spdlog/details/backtracer-inl.h:18:15: warning: ‘spdlog::details::backtracer::messages_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/details/circular_q.h: In constructor ‘spdlog::details::circular_q::circular_q() [with T = spdlog::details::log_msg_buffer]’: ../../submodules/spdlog/include/spdlog/details/circular_q.h:25:5: warning: ‘spdlog::details::circular_q::v_’ should be initialized in the member initialization list [-Weffc++] 25 | circular_q() = default; | ^~~~~~~~~~ ../../submodules/spdlog/include/spdlog/details/backtracer-inl.h: In copy constructor ‘spdlog::details::backtracer::backtracer(const spdlog::details::backtracer&)’: ../../submodules/spdlog/include/spdlog/details/backtracer-inl.h:11:15: warning: ‘spdlog::details::backtracer::mutex_’ should be initialized in the member initialization list [-Weffc++] 11 | SPDLOG_INLINE backtracer::backtracer(const backtracer &other) | ^~~~~~~~~~ ../../submodules/spdlog/include/spdlog/details/backtracer-inl.h:11:15: warning: ‘spdlog::details::backtracer::messages_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/details/log_msg_buffer-inl.h: In constructor ‘spdlog::details::log_msg_buffer::log_msg_buffer(const spdlog::details::log_msg&)’: ../../submodules/spdlog/include/spdlog/details/log_msg_buffer-inl.h:13:15: warning: ‘spdlog::details::log_msg_buffer::buffer’ should be initialized in the member initialization list [-Weffc++] 13 | SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg &orig_msg) | ^~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/details/log_msg_buffer-inl.h: In copy constructor ‘spdlog::details::log_msg_buffer::log_msg_buffer(const spdlog::details::log_msg_buffer&)’: ../../submodules/spdlog/include/spdlog/details/log_msg_buffer-inl.h:21:15: warning: ‘spdlog::details::log_msg_buffer::buffer’ should be initialized in the member initialization list [-Weffc++] 21 | SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg_buffer &other) | ^~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/details/os-inl.h: In function ‘int spdlog::details::os::pid()’: ../../submodules/spdlog/include/spdlog/details/os-inl.h:399:12: warning: useless cast to type ‘int’ [-Wuseless-cast] 399 | return static_cast(::getpid()); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/details/periodic_worker-inl.h: In constructor ‘spdlog::details::periodic_worker::periodic_worker(const std::function&, std::chrono::seconds)’: ../../submodules/spdlog/include/spdlog/details/periodic_worker-inl.h:13:15: warning: ‘spdlog::details::periodic_worker::active_’ should be initialized in the member initialization list [-Weffc++] 13 | SPDLOG_INLINE periodic_worker::periodic_worker(const std::function &callback_fun, std::chrono::seconds interval) | ^~~~~~~~~~~~~~~ ../../submodules/spdlog/include/spdlog/details/periodic_worker-inl.h:13:15: warning: ‘spdlog::details::periodic_worker::worker_thread_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/details/periodic_worker-inl.h:13:15: warning: ‘spdlog::details::periodic_worker::mutex_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/details/periodic_worker-inl.h:13:15: warning: ‘spdlog::details::periodic_worker::cv_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/common-inl.h: In constructor ‘spdlog::spdlog_ex::spdlog_ex(const string&, int)’: ../../submodules/spdlog/include/spdlog/common-inl.h:56:15: warning: ‘spdlog::spdlog_ex::msg_’ should be initialized in the member initialization list [-Weffc++] 56 | SPDLOG_INLINE spdlog_ex::spdlog_ex(const std::string &msg, int last_errno) | ^~~~~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h: In constructor ‘fmt::v8::detail::bigint::bigint()’: ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:433:3: warning: ‘fmt::v8::detail::bigint::bigits_’ should be initialized in the member initialization list [-Weffc++] 433 | bigint() : exp_(0) {} | ^~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h: In constructor ‘fmt::v8::detail::bigint::bigint(uint64_t)’: ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:434:12: warning: ‘fmt::v8::detail::bigint::bigits_’ should be initialized in the member initialization list [-Weffc++] 434 | explicit bigint(uint64_t n) { assign(n); } | ^~~~~~ ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:434:12: warning: ‘fmt::v8::detail::bigint::exp_’ should be initialized in the member initialization list [-Weffc++] ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h: In constructor ‘fmt::v8::detail::utf8_to_utf16::utf8_to_utf16(fmt::v8::string_view)’: ../../submodules/spdlog/include/spdlog/fmt/bundled/format-inl.h:2527:10: warning: ‘fmt::v8::detail::utf8_to_utf16::buffer_’ should be initialized in the member initialization list [-Weffc++] 2527 | FMT_FUNC detail::utf8_to_utf16::utf8_to_utf16(string_view s) { --- include/spdlog/async_logger.h | 4 +- include/spdlog/common.h | 2 +- include/spdlog/details/backtracer.h | 4 +- include/spdlog/details/circular_q.h | 2 +- include/spdlog/details/file_helper.h | 2 +- include/spdlog/details/log_msg.h | 8 ++-- include/spdlog/details/log_msg_buffer.h | 2 +- include/spdlog/details/mpmc_blocking_q.h | 8 ++-- include/spdlog/details/null_mutex.h | 2 +- include/spdlog/details/os-inl.h | 2 +- include/spdlog/details/periodic_worker.h | 8 ++-- include/spdlog/details/registry-inl.h | 3 +- include/spdlog/details/registry.h | 14 +++--- include/spdlog/details/thread_pool.h | 4 +- include/spdlog/fmt/bundled/core.h | 56 ++++++++++++------------ include/spdlog/fmt/bundled/format-inl.h | 10 ++--- include/spdlog/fmt/bundled/format.h | 16 +++---- include/spdlog/logger.h | 6 +-- include/spdlog/pattern_formatter-inl.h | 10 ++--- include/spdlog/pattern_formatter.h | 16 +++---- include/spdlog/sinks/ansicolor_sink.h | 8 ++-- include/spdlog/sinks/wincolor_sink.h | 8 ++-- include/spdlog/stopwatch.h | 2 +- 23 files changed, 100 insertions(+), 97 deletions(-) diff --git a/include/spdlog/async_logger.h b/include/spdlog/async_logger.h index 91a93fcb..dde6e345 100644 --- a/include/spdlog/async_logger.h +++ b/include/spdlog/async_logger.h @@ -58,8 +58,8 @@ protected: void backend_flush_(); private: - std::weak_ptr thread_pool_; - async_overflow_policy overflow_policy_; + std::weak_ptr thread_pool_{}; + async_overflow_policy overflow_policy_{}; }; } // namespace spdlog diff --git a/include/spdlog/common.h b/include/spdlog/common.h index ed0ab46c..a31b523a 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -231,7 +231,7 @@ public: const char *what() const SPDLOG_NOEXCEPT override; private: - std::string msg_; + std::string msg_{}; }; [[noreturn]] SPDLOG_API void throw_spdlog_ex(const std::string &msg, int last_errno); diff --git a/include/spdlog/details/backtracer.h b/include/spdlog/details/backtracer.h index b336ee77..550b3320 100644 --- a/include/spdlog/details/backtracer.h +++ b/include/spdlog/details/backtracer.h @@ -17,9 +17,9 @@ namespace spdlog { namespace details { class SPDLOG_API backtracer { - mutable std::mutex mutex_; + mutable std::mutex mutex_{}; std::atomic enabled_{false}; - circular_q messages_; + circular_q messages_{}; public: backtracer() = default; diff --git a/include/spdlog/details/circular_q.h b/include/spdlog/details/circular_q.h index 1f2712e7..0c83a385 100644 --- a/include/spdlog/details/circular_q.h +++ b/include/spdlog/details/circular_q.h @@ -16,7 +16,7 @@ class circular_q typename std::vector::size_type head_ = 0; typename std::vector::size_type tail_ = 0; size_t overrun_counter_ = 0; - std::vector v_; + std::vector v_{}; public: using value_type = T; diff --git a/include/spdlog/details/file_helper.h b/include/spdlog/details/file_helper.h index cfccaed2..c1d557be 100644 --- a/include/spdlog/details/file_helper.h +++ b/include/spdlog/details/file_helper.h @@ -49,7 +49,7 @@ private: const int open_tries_ = 5; const unsigned int open_interval_ = 10; std::FILE *fd_{nullptr}; - filename_t filename_; + filename_t filename_{}; }; } // namespace details } // namespace spdlog diff --git a/include/spdlog/details/log_msg.h b/include/spdlog/details/log_msg.h index fed51abd..29b28338 100644 --- a/include/spdlog/details/log_msg.h +++ b/include/spdlog/details/log_msg.h @@ -17,17 +17,17 @@ struct SPDLOG_API log_msg log_msg(const log_msg &other) = default; log_msg &operator=(const log_msg &other) = default; - string_view_t logger_name; + string_view_t logger_name{}; level::level_enum level{level::off}; - log_clock::time_point time; + log_clock::time_point time{}; size_t thread_id{0}; // wrapping the formatted text with color (updated by pattern_formatter). mutable size_t color_range_start{0}; mutable size_t color_range_end{0}; - source_loc source; - string_view_t payload; + source_loc source{}; + string_view_t payload{}; }; } // namespace details } // namespace spdlog diff --git a/include/spdlog/details/log_msg_buffer.h b/include/spdlog/details/log_msg_buffer.h index 81055065..12383791 100644 --- a/include/spdlog/details/log_msg_buffer.h +++ b/include/spdlog/details/log_msg_buffer.h @@ -13,7 +13,7 @@ namespace details { class SPDLOG_API log_msg_buffer : public log_msg { - memory_buf_t buffer; + memory_buf_t buffer{}; void update_string_views(); public: diff --git a/include/spdlog/details/mpmc_blocking_q.h b/include/spdlog/details/mpmc_blocking_q.h index 5c3cca76..bae954f1 100644 --- a/include/spdlog/details/mpmc_blocking_q.h +++ b/include/spdlog/details/mpmc_blocking_q.h @@ -117,10 +117,10 @@ public: } private: - std::mutex queue_mutex_; - std::condition_variable push_cv_; - std::condition_variable pop_cv_; - spdlog::details::circular_q q_; + std::mutex queue_mutex_{}; + std::condition_variable push_cv_{}; + std::condition_variable pop_cv_{}; + spdlog::details::circular_q q_{}; }; } // namespace details } // namespace spdlog diff --git a/include/spdlog/details/null_mutex.h b/include/spdlog/details/null_mutex.h index 83533d4f..9cc730a1 100644 --- a/include/spdlog/details/null_mutex.h +++ b/include/spdlog/details/null_mutex.h @@ -21,7 +21,7 @@ struct null_mutex struct null_atomic_int { - int value; + int value{0}; null_atomic_int() = default; explicit null_atomic_int(int new_value) diff --git a/include/spdlog/details/os-inl.h b/include/spdlog/details/os-inl.h index 4602782c..a95b1c49 100644 --- a/include/spdlog/details/os-inl.h +++ b/include/spdlog/details/os-inl.h @@ -396,7 +396,7 @@ SPDLOG_INLINE int pid() SPDLOG_NOEXCEPT #ifdef _WIN32 return static_cast(::GetCurrentProcessId()); #else - return static_cast(::getpid()); + return ::getpid(); #endif } diff --git a/include/spdlog/details/periodic_worker.h b/include/spdlog/details/periodic_worker.h index a300218d..2a57a3a2 100644 --- a/include/spdlog/details/periodic_worker.h +++ b/include/spdlog/details/periodic_worker.h @@ -27,10 +27,10 @@ public: ~periodic_worker(); private: - bool active_; - std::thread worker_thread_; - std::mutex mutex_; - std::condition_variable cv_; + bool active_{false}; + std::thread worker_thread_{}; + std::mutex mutex_{}; + std::condition_variable cv_{}; }; } // namespace details } // namespace spdlog diff --git a/include/spdlog/details/registry-inl.h b/include/spdlog/details/registry-inl.h index c55b5eea..795ad591 100644 --- a/include/spdlog/details/registry-inl.h +++ b/include/spdlog/details/registry-inl.h @@ -31,7 +31,8 @@ namespace spdlog { namespace details { SPDLOG_INLINE registry::registry() - : formatter_(new pattern_formatter()) + : formatter_(new pattern_formatter()), + periodic_flusher_(nullptr) { #ifndef SPDLOG_DISABLE_DEFAULT_LOGGER diff --git a/include/spdlog/details/registry.h b/include/spdlog/details/registry.h index 97473ea3..4ddb5b8c 100644 --- a/include/spdlog/details/registry.h +++ b/include/spdlog/details/registry.h @@ -92,17 +92,17 @@ private: void throw_if_exists_(const std::string &logger_name); void register_logger_(std::shared_ptr new_logger); bool set_level_from_cfg_(logger *logger); - std::mutex logger_map_mutex_, flusher_mutex_; - std::recursive_mutex tp_mutex_; - std::unordered_map> loggers_; - log_levels log_levels_; + std::mutex logger_map_mutex_{}, flusher_mutex_{}; + std::recursive_mutex tp_mutex_{}; + std::unordered_map> loggers_{}; + log_levels log_levels_{}; std::unique_ptr formatter_; spdlog::level::level_enum global_log_level_ = level::info; level::level_enum flush_level_ = level::off; - err_handler err_handler_; - std::shared_ptr tp_; + err_handler err_handler_{}; + std::shared_ptr tp_{}; std::unique_ptr periodic_flusher_; - std::shared_ptr default_logger_; + std::shared_ptr default_logger_{}; bool automatic_registration_ = true; size_t backtrace_n_messages_ = 0; }; diff --git a/include/spdlog/details/thread_pool.h b/include/spdlog/details/thread_pool.h index 86187e40..3ad6202d 100644 --- a/include/spdlog/details/thread_pool.h +++ b/include/spdlog/details/thread_pool.h @@ -99,9 +99,9 @@ public: size_t queue_size(); private: - q_type q_; + q_type q_{0}; - std::vector threads_; + std::vector threads_{}; void post_async_msg_(async_msg &&new_msg, async_overflow_policy overflow_policy); void worker_loop_(); diff --git a/include/spdlog/fmt/bundled/core.h b/include/spdlog/fmt/bundled/core.h index b33293eb..35f1a80e 100644 --- a/include/spdlog/fmt/bundled/core.h +++ b/include/spdlog/fmt/bundled/core.h @@ -435,8 +435,8 @@ FMT_END_DETAIL_NAMESPACE */ template class basic_string_view { private: - const Char* data_; - size_t size_; + const Char* data_{nullptr}; + size_t size_{0}; public: using value_type = Char; @@ -619,8 +619,8 @@ template using char_t = typename detail::char_t_impl::type; template class basic_format_parse_context : private ErrorHandler { private: - basic_string_view format_str_; - int next_arg_id_; + basic_string_view format_str_{}; + int next_arg_id_{0}; public: using char_type = Char; @@ -748,9 +748,9 @@ FMT_CONSTEXPR auto copy_str(const Char* begin, const Char* end, Char* out) */ template class buffer { private: - T* ptr_; - size_t size_; - size_t capacity_; + T* ptr_{nullptr}; + size_t size_{0}; + size_t capacity_{0}; protected: // Don't initialize ptr_ since it is not accessed to save a few cycles. @@ -840,7 +840,7 @@ struct buffer_traits { class fixed_buffer_traits { private: size_t count_ = 0; - size_t limit_; + size_t limit_ = 0; public: explicit fixed_buffer_traits(size_t limit) : limit_(limit) {} @@ -856,9 +856,9 @@ class fixed_buffer_traits { template class iterator_buffer final : public Traits, public buffer { private: - OutputIt out_; + OutputIt out_ = {}; enum { buffer_size = 256 }; - T data_[buffer_size]; + T data_[buffer_size] = {}; protected: void grow(size_t) final FMT_OVERRIDE { @@ -924,7 +924,7 @@ class iterator_buffer, template class counting_buffer final : public buffer { private: enum { buffer_size = 256 }; - T data_[buffer_size]; + T data_[buffer_size]{}; size_t count_ = 0; protected: @@ -1385,8 +1385,8 @@ class appender : public std::back_insert_iterator> { // allow storage in basic_memory_buffer. template class basic_format_arg { private: - detail::value value_; - detail::type type_; + detail::value value_ = {}; + detail::type type_ = {}; template friend FMT_CONSTEXPR auto detail::make_arg(const T& value) @@ -1419,7 +1419,7 @@ template class basic_format_arg { } private: - detail::custom_value custom_; + detail::custom_value custom_{}; }; constexpr basic_format_arg() : type_(detail::type::none_type) {} @@ -1528,7 +1528,7 @@ struct is_contiguous_back_insert_iterator : std::true_type {}; // A type-erased reference to an std::locale to avoid heavy include. class locale_ref { private: - const void* locale_; // A type-erased pointer to std::locale. + const void* locale_{nullptr}; // A type-erased pointer to std::locale. public: constexpr locale_ref() : locale_(nullptr) {} @@ -1585,9 +1585,9 @@ template class basic_format_context { using char_type = Char; private: - OutputIt out_; - basic_format_args args_; - detail::locale_ref loc_; + OutputIt out_{}; + basic_format_args args_{}; + detail::locale_ref loc_{}; public: using iterator = OutputIt; @@ -1747,7 +1747,7 @@ template class basic_format_args { // If the number of arguments is less or equal to max_packed_args then // argument types are passed in the descriptor. This reduces binary code size // per formatting function call. - unsigned long long desc_; + unsigned long long desc_{0}; union { // If is_packed() returns true then argument values are stored in values_; // otherwise they are stored in args_. This is done to improve cache @@ -1876,6 +1876,7 @@ template struct fill_t { unsigned char size_ = 1; public: + // GCC's effective C++ warning mis-identifies this as an assignment // operator, and therefore recommends returning a reference to *this. #pragma GCC diagnostic push @@ -1919,7 +1920,8 @@ template struct basic_format_specs { align(align::none), sign(sign::none), alt(false), - localized(false) {} + localized(false), + fill() {} }; using format_specs = basic_format_specs; @@ -1958,8 +1960,8 @@ template struct arg_ref { // different sets of arguments (precompilation of format strings). template struct dynamic_format_specs : basic_format_specs { - arg_ref width_ref; - arg_ref precision_ref; + arg_ref width_ref{}; + arg_ref precision_ref{}; }; struct auto_id {}; @@ -2461,7 +2463,7 @@ template class compile_parse_context : public basic_format_parse_context { private: - int num_args_; + int num_args_{0}; using base = basic_format_parse_context; public: @@ -2599,7 +2601,7 @@ FMT_CONSTEXPR void check_pointer_type_spec(Char spec, ErrorHandler&& eh) { // the argument type. template class specs_checker : public Handler { private: - detail::type arg_type_; + detail::type arg_type_{}; FMT_CONSTEXPR void require_numeric_argument() { if (!is_arithmetic_type(arg_type_)) @@ -2686,7 +2688,7 @@ class format_string_checker { // Format specifier parsing function. using parse_func = const Char* (*)(parse_context_type&); - parse_context_type context_; + parse_context_type context_{}; parse_func parse_funcs_[num_args > 0 ? num_args : 1]; public: @@ -2757,7 +2759,7 @@ struct formatter::value != detail::type::custom_type>> { private: - detail::dynamic_format_specs specs_; + detail::dynamic_format_specs specs_{}; public: // Parses format specifiers stopping either at the end of the range or at the @@ -2834,7 +2836,7 @@ template struct basic_runtime { basic_string_view str; }; template class basic_format_string { private: - basic_string_view str_; + basic_string_view str_{}; public: template ; public: - significand_type f; - int e; + significand_type f{0}; + int e{0}; // All sizes are in bits. // Subtract 1 to account for an implicit most significant bit in the @@ -367,8 +367,8 @@ class bigint { using bigit = uint32_t; using double_bigit = uint64_t; enum { bigits_capacity = 32 }; - basic_memory_buffer bigits_; - int exp_; + basic_memory_buffer bigits_{}; + int exp_{0}; bigit operator[](int index) const { return bigits_[to_unsigned(index)]; } bigit& operator[](int index) { return bigits_[to_unsigned(index)]; } @@ -2524,7 +2524,7 @@ template <> struct formatter { } }; -FMT_FUNC detail::utf8_to_utf16::utf8_to_utf16(string_view s) { +FMT_FUNC detail::utf8_to_utf16::utf8_to_utf16(string_view s) : buffer_() { for_each_codepoint(s, [this](uint32_t cp, int error) { if (error != 0) FMT_THROW(std::runtime_error("invalid utf8")); if (cp <= 0xFFFF) { diff --git a/include/spdlog/fmt/bundled/format.h b/include/spdlog/fmt/bundled/format.h index 5398a23a..79fa6065 100644 --- a/include/spdlog/fmt/bundled/format.h +++ b/include/spdlog/fmt/bundled/format.h @@ -623,10 +623,10 @@ template > class basic_memory_buffer final : public detail::buffer { private: - T store_[SIZE]; + T store_[SIZE]{}; // Don't inherit from Allocator avoid generating type_info for it. - Allocator alloc_; + Allocator alloc_{}; // Deallocate memory allocated by the buffer. void deallocate() { @@ -2275,8 +2275,8 @@ class format_int { // Buffer should be large enough to hold all digits (digits10 + 1), // a sign and a null character. enum { buffer_size = std::numeric_limits::digits10 + 3 }; - mutable char buffer_[buffer_size]; - char* str_; + mutable char buffer_[buffer_size]{}; + char* str_{nullptr}; template auto format_unsigned(UInt value) -> char* { auto n = static_cast>(value); @@ -2401,8 +2401,8 @@ struct formatter : formatter, Char> { // }; template class dynamic_formatter { private: - detail::dynamic_format_specs specs_; - const Char* format_str_; + detail::dynamic_format_specs specs_{}; + const Char* format_str_{nullptr}; struct null_handler : detail::error_handler { void on_align(align_t) {} @@ -2461,7 +2461,7 @@ template auto ptr(const std::shared_ptr& p) -> const void* { class bytes { private: - string_view data_; + string_view data_{}; friend struct formatter; public: @@ -2470,7 +2470,7 @@ class bytes { template <> struct formatter { private: - detail::dynamic_format_specs specs_; + detail::dynamic_format_specs specs_{}; public: template diff --git a/include/spdlog/logger.h b/include/spdlog/logger.h index eea0afc2..2be690cb 100644 --- a/include/spdlog/logger.h +++ b/include/spdlog/logger.h @@ -316,12 +316,12 @@ public: virtual std::shared_ptr clone(std::string logger_name); protected: - std::string name_; - std::vector sinks_; + std::string name_{}; + std::vector sinks_{}; spdlog::level_t level_{level::info}; spdlog::level_t flush_level_{level::off}; err_handler custom_err_handler_{nullptr}; - details::backtracer tracer_; + details::backtracer tracer_{}; // common implementation for after templated public api has been resolved template diff --git a/include/spdlog/pattern_formatter-inl.h b/include/spdlog/pattern_formatter-inl.h index ec727032..b20cfb54 100644 --- a/include/spdlog/pattern_formatter-inl.h +++ b/include/spdlog/pattern_formatter-inl.h @@ -88,7 +88,7 @@ private: const padding_info &padinfo_; memory_buf_t &dest_; - long remaining_pad_; + long remaining_pad_ {0}; string_view_t spaces_{" ", 64}; }; @@ -704,7 +704,7 @@ public: } private: - char ch_; + char ch_ = 0; }; // aggregate user chars to display as is @@ -723,7 +723,7 @@ public: } private: - std::string str_; + std::string str_{}; }; // mark the color range. expect it to be in the form of "%^colored text%$" @@ -921,7 +921,7 @@ public: } private: - log_clock::time_point last_message_time_; + log_clock::time_point last_message_time_ = {}; }; // Full info formatter @@ -1009,7 +1009,7 @@ public: private: std::chrono::seconds cache_timestamp_{0}; - memory_buf_t cached_datetime_; + memory_buf_t cached_datetime_{}; }; } // namespace details diff --git a/include/spdlog/pattern_formatter.h b/include/spdlog/pattern_formatter.h index e9ccfaa7..240d9a62 100644 --- a/include/spdlog/pattern_formatter.h +++ b/include/spdlog/pattern_formatter.h @@ -58,7 +58,7 @@ public: virtual void format(const details::log_msg &msg, const std::tm &tm_time, memory_buf_t &dest) = 0; protected: - padding_info padinfo_; + padding_info padinfo_{}; }; } // namespace details @@ -100,13 +100,13 @@ public: void set_pattern(std::string pattern); private: - std::string pattern_; - std::string eol_; - pattern_time_type pattern_time_type_; - std::tm cached_tm_; - std::chrono::seconds last_log_secs_; - std::vector> formatters_; - custom_flags custom_handlers_; + std::string pattern_{}; + std::string eol_{}; + pattern_time_type pattern_time_type_{}; + std::tm cached_tm_ = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + std::chrono::seconds last_log_secs_{}; + std::vector> formatters_{}; + custom_flags custom_handlers_{}; std::tm get_time_(const details::log_msg &msg); template diff --git a/include/spdlog/sinks/ansicolor_sink.h b/include/spdlog/sinks/ansicolor_sink.h index 39d966bc..4a6b9c22 100644 --- a/include/spdlog/sinks/ansicolor_sink.h +++ b/include/spdlog/sinks/ansicolor_sink.h @@ -80,11 +80,11 @@ public: const string_view_t bold_on_red = "\033[1m\033[41m"; private: - FILE *target_file_; - mutex_t &mutex_; - bool should_do_colors_; + FILE *target_file_{nullptr}; + mutex_t &mutex_{}; + bool should_do_colors_{false}; std::unique_ptr formatter_; - std::array colors_; + std::array colors_{}; void print_ccode_(const string_view_t &color_code); void print_range_(const memory_buf_t &formatted, size_t start, size_t end); static std::string to_string_(const string_view_t &sv); diff --git a/include/spdlog/sinks/wincolor_sink.h b/include/spdlog/sinks/wincolor_sink.h index 9b030fc1..11e2445c 100644 --- a/include/spdlog/sinks/wincolor_sink.h +++ b/include/spdlog/sinks/wincolor_sink.h @@ -40,11 +40,11 @@ public: protected: using mutex_t = typename ConsoleMutex::mutex_t; - void *out_handle_; - mutex_t &mutex_; - bool should_do_colors_; + void *out_handle_{nullptr}; + mutex_t &mutex_{}; + bool should_do_colors_{false}; std::unique_ptr formatter_; - std::array colors_; + std::array colors_{}; // set foreground color and return the orig console attributes (for resetting later) std::uint16_t set_foreground_color_(std::uint16_t attribs); diff --git a/include/spdlog/stopwatch.h b/include/spdlog/stopwatch.h index bb976b19..e2b6b6cc 100644 --- a/include/spdlog/stopwatch.h +++ b/include/spdlog/stopwatch.h @@ -28,7 +28,7 @@ namespace spdlog { class stopwatch { using clock = std::chrono::steady_clock; - std::chrono::time_point start_tp_; + std::chrono::time_point start_tp_{}; public: stopwatch()