From 4b787b3044cce8aa7a9f96ca0a1b2a5680355232 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sat, 7 Dec 2024 10:48:16 +0200 Subject: [PATCH] Cleanup template instantiations --- src/sinks/base_sink.cpp | 13 +++++++------ src/sinks/basic_file_sink.cpp | 13 +++++++------ src/sinks/rotating_file_sink.cpp | 12 +++++++----- src/sinks/stdout_sinks.cpp | 16 +++++++++------- src/sinks/wincolor_sink.cpp | 7 +------ 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/sinks/base_sink.cpp b/src/sinks/base_sink.cpp index ab393ba4..ab01cdc6 100644 --- a/src/sinks/base_sink.cpp +++ b/src/sinks/base_sink.cpp @@ -4,9 +4,7 @@ #include "spdlog/sinks/base_sink.h" #include -#include #include "spdlog/common.h" -#include "spdlog/details/null_mutex.h" #include "spdlog/pattern_formatter.h" namespace spdlog { @@ -54,9 +52,12 @@ void base_sink::set_formatter_(std::unique_ptr sink_formatter) formatter_ = std::move(sink_formatter); } -// template instantiations -template class SPDLOG_API base_sink; -template class SPDLOG_API base_sink; - } // namespace sinks } // namespace spdlog + + +// template instantiations +#include +#include "spdlog/details/null_mutex.h" +template class SPDLOG_API spdlog::sinks::base_sink; +template class SPDLOG_API spdlog::sinks::base_sink; diff --git a/src/sinks/basic_file_sink.cpp b/src/sinks/basic_file_sink.cpp index f0d0203b..c120592c 100644 --- a/src/sinks/basic_file_sink.cpp +++ b/src/sinks/basic_file_sink.cpp @@ -3,8 +3,6 @@ #include "spdlog/sinks/basic_file_sink.h" #include "spdlog/common.h" -#include "spdlog/details/null_mutex.h" -#include namespace spdlog { namespace sinks { @@ -32,9 +30,12 @@ void basic_file_sink::flush_() { file_helper_.flush(); } -// template instantiations -template class SPDLOG_API basic_file_sink; -template class SPDLOG_API basic_file_sink; - } // namespace sinks } // namespace spdlog + + +// template instantiations +#include +#include "spdlog/details/null_mutex.h" +template class SPDLOG_API spdlog::sinks::basic_file_sink; +template class SPDLOG_API spdlog::sinks::basic_file_sink; \ No newline at end of file diff --git a/src/sinks/rotating_file_sink.cpp b/src/sinks/rotating_file_sink.cpp index 0d7c1b67..490fbcc2 100644 --- a/src/sinks/rotating_file_sink.cpp +++ b/src/sinks/rotating_file_sink.cpp @@ -12,7 +12,6 @@ #include "spdlog/common.h" #include "spdlog/details/file_helper.h" #include "spdlog/details/os.h" -#include "spdlog/details/null_mutex.h" namespace spdlog { namespace sinks { @@ -137,9 +136,12 @@ bool rotating_file_sink::rename_file_(const filename_t &src_filename, con return details::os::rename(src_filename, target_filename); } -// template instantiations -template class SPDLOG_API rotating_file_sink; -template class SPDLOG_API rotating_file_sink; - } // namespace sinks } // namespace spdlog + + +// template instantiations +#include +#include "spdlog/details/null_mutex.h" +template class SPDLOG_API spdlog::sinks::rotating_file_sink; +template class SPDLOG_API spdlog::sinks::rotating_file_sink; \ No newline at end of file diff --git a/src/sinks/stdout_sinks.cpp b/src/sinks/stdout_sinks.cpp index 4eb8d083..efee54cf 100644 --- a/src/sinks/stdout_sinks.cpp +++ b/src/sinks/stdout_sinks.cpp @@ -4,7 +4,6 @@ #include "spdlog/sinks/stdout_sinks.h" #include - #include "spdlog/details/os.h" #include "spdlog/pattern_formatter.h" @@ -81,11 +80,14 @@ template stderr_sink::stderr_sink() : stdout_sink_base(stderr) {} -// template installations -template class SPDLOG_API stdout_sink; -template class SPDLOG_API stdout_sink; -template class SPDLOG_API stderr_sink; -template class SPDLOG_API stderr_sink; - } // namespace sinks } // namespace spdlog + + +// template instantiations +#include +#include "spdlog/details/null_mutex.h" +template class SPDLOG_API spdlog::sinks::stdout_sink; +template class SPDLOG_API spdlog::sinks::stdout_sink; +template class SPDLOG_API spdlog::sinks::stderr_sink; +template class SPDLOG_API spdlog::sinks::stderr_sink; \ No newline at end of file diff --git a/src/sinks/wincolor_sink.cpp b/src/sinks/wincolor_sink.cpp index a6b0ab3f..d71aec1c 100644 --- a/src/sinks/wincolor_sink.cpp +++ b/src/sinks/wincolor_sink.cpp @@ -135,15 +135,10 @@ wincolor_stderr_sink::wincolor_stderr_sink(color_mode mode) } // namespace spdlog +// template instantiations #include #include "spdlog/details/null_mutex.h" - -// template instantiations -template class SPDLOG_API spdlog::sinks::wincolor_sink; -template class SPDLOG_API spdlog::sinks::wincolor_sink; - template class SPDLOG_API spdlog::sinks::wincolor_stdout_sink; template class SPDLOG_API spdlog::sinks::wincolor_stdout_sink; - template class SPDLOG_API spdlog::sinks::wincolor_stderr_sink; template class SPDLOG_API spdlog::sinks::wincolor_stderr_sink;