From 88534b92ebf8dde58594b3807b2dbb739c9dc3c2 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Tue, 23 Apr 2024 12:50:13 -0400 Subject: [PATCH 01/16] CONTRIBUTING.adoc: mention bt2c::makeSpan() Signed-off-by: Philippe Proulx Change-Id: I6b5340fd353cbd4ef40f9e75322588842f10a788 Reviewed-on: https://review.lttng.org/c/babeltrace/+/12455 Reviewed-by: Simon Marchi --- CONTRIBUTING.adoc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc index 2e1e136e..171fcb14 100644 --- a/CONTRIBUTING.adoc +++ b/CONTRIBUTING.adoc @@ -1728,6 +1728,11 @@ When possible, prefer using this over the C{nbsp}logging API. One important benefit is that this API uses {fmt} to format the logging message instead of `vsnprintf()`. +`make-span.hpp`:: + The function template `bt2c::makeSpan()` which is an alternative to + https://en.cppreference.com/w/cpp/language/class_template_argument_deduction[CTAD] + (a {cpp}17 feature). + `prio-heap.hpp`:: The `bt2c::PrioHeap` class template: an efficient heap data structure. @@ -1814,6 +1819,11 @@ the `bt2s` namespace, instead of using this directly. + IMPORTANT: Use the symbols of `src/cpp-common/bt2s/span.hpp`, under the `bt2s` namespace, instead of using this directly. ++ +TIP: `src/cpp-common/bt2c/make-span.hpp` offers `bt2c::makeSpan()` which +is an alternative to +https://en.cppreference.com/w/cpp/language/class_template_argument_deduction[CTAD] +(a {cpp}17 feature). `string-view-lite`:: https://github.com/martinmoene/string-view-lite[string_view lite]. -- 2.34.1 From 53e1eccee216a75e77d30084d1797fd6b1dc589e Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Tue, 23 Apr 2024 13:07:55 -0400 Subject: [PATCH 02/16] bt2c/logging.hpp: use `std::span` for mem. data `std::span` is also the `bt2c::Logger::MemData` alias. Adapt `src/plugins/ctf/common/src/msg-iter/msg-iter.cpp` accordingly. Signed-off-by: Philippe Proulx Change-Id: I553c0bbb0fb532bd23506a9760155371820e773d Reviewed-on: https://review.lttng.org/c/babeltrace/+/12456 Reviewed-by: Simon Marchi Tested-by: jenkins --- src/cpp-common/bt2c/logging.hpp | 166 ++++++++---------- .../ctf/common/src/msg-iter/msg-iter.cpp | 3 +- 2 files changed, 80 insertions(+), 89 deletions(-) diff --git a/src/cpp-common/bt2c/logging.hpp b/src/cpp-common/bt2c/logging.hpp index a092251b..fb21ec4e 100644 --- a/src/cpp-common/bt2c/logging.hpp +++ b/src/cpp-common/bt2c/logging.hpp @@ -22,6 +22,7 @@ #include "cpp-common/bt2/self-component-port.hpp" #include "cpp-common/bt2/self-message-iterator.hpp" #include "cpp-common/bt2s/optional.hpp" +#include "cpp-common/bt2s/span.hpp" #include "cpp-common/vendor/fmt/core.h" #include "cpp-common/vendor/wise-enum/wise_enum.h" #include "logging/log-api.h" @@ -45,6 +46,8 @@ namespace bt2c { class Logger final { public: + using MemData = bt2s::span; + /* clang-format off */ /* Available log levels */ @@ -262,9 +265,8 @@ private: struct _StdLogWriter final { static void write(const char * const fileName, const char * const funcName, - const unsigned lineNo, const Level level, const char * const tag, - const void *, unsigned int, const char * const initMsg, - const char * const msg) noexcept + const unsigned lineNo, const Level level, const char * const tag, MemData, + const char * const initMsg, const char * const msg) noexcept { BT_ASSERT_DBG(initMsg && std::strcmp(initMsg, "") == 0); bt_log_write(fileName, funcName, lineNo, static_cast(level), tag, msg); @@ -285,8 +287,8 @@ public: void log(const char * const fileName, const char * const funcName, const unsigned int lineNo, const char * const fmt, ArgTs&&...args) const { - this->_log<_StdLogWriter, LevelV, AppendCauseV>(fileName, funcName, lineNo, nullptr, 0, "", - fmt, std::forward(args)...); + this->_log<_StdLogWriter, LevelV, AppendCauseV>(fileName, funcName, lineNo, {}, "", fmt, + std::forward(args)...); } /* @@ -299,8 +301,7 @@ public: void logStr(const char * const fileName, const char * const funcName, const unsigned int lineNo, const char * const msg) const { - this->_logStr<_StdLogWriter, LevelV, AppendCauseV>(fileName, funcName, lineNo, nullptr, 0, - "", msg); + this->_logStr<_StdLogWriter, LevelV, AppendCauseV>(fileName, funcName, lineNo, {}, "", msg); } /* @@ -358,9 +359,8 @@ private: struct _InitMsgLogWriter final { static void write(const char * const fileName, const char * const funcName, - const unsigned lineNo, const Level level, const char * const tag, - const void *, unsigned int, const char * const initMsg, - const char * const msg) noexcept + const unsigned lineNo, const Level level, const char * const tag, MemData, + const char * const initMsg, const char * const msg) noexcept { bt_log_write_printf(funcName, fileName, lineNo, static_cast(level), tag, "%s%s", initMsg, msg); @@ -383,7 +383,7 @@ public: const unsigned int lineNo, const char * const initMsg, const char * const fmt, ArgTs&&...args) const { - this->_log<_InitMsgLogWriter, LevelV, AppendCauseV>(fileName, funcName, lineNo, nullptr, 0, + this->_log<_InitMsgLogWriter, LevelV, AppendCauseV>(fileName, funcName, lineNo, {}, this->_errnoIntroStr(initMsg).c_str(), fmt, std::forward(args)...); } @@ -403,7 +403,7 @@ public: const char * const msg) const { this->_logStr<_InitMsgLogWriter, LevelV, AppendCauseV>( - fileName, funcName, lineNo, nullptr, 0, this->_errnoIntroStr(initMsg).c_str(), msg); + fileName, funcName, lineNo, {}, this->_errnoIntroStr(initMsg).c_str(), msg); } /* @@ -468,11 +468,10 @@ private: { static void write(const char * const fileName, const char * const funcName, const unsigned lineNo, const Level level, const char * const tag, - const void * const memData, const unsigned int memLen, const char *, - const char * const msg) noexcept + const MemData memData, const char *, const char * const msg) noexcept { bt_log_write_mem(funcName, fileName, lineNo, static_cast(level), tag, - memData, memLen, msg); + memData.data(), memData.size(), msg); } }; @@ -485,11 +484,10 @@ public: */ template void logMem(const char * const fileName, const char * const funcName, const unsigned int lineNo, - const void * const memData, const unsigned int memLen, const char * const fmt, - ArgTs&&...args) const + const MemData memData, const char * const fmt, ArgTs&&...args) const { - this->_log<_MemLogWriter, LevelV, false>(fileName, funcName, lineNo, memData, memLen, "", - fmt, std::forward(args)...); + this->_log<_MemLogWriter, LevelV, false>(fileName, funcName, lineNo, memData, "", fmt, + std::forward(args)...); } /* @@ -498,11 +496,9 @@ public: */ template void logMemStr(const char * const fileName, const char * const funcName, - const unsigned int lineNo, const void * const memData, const unsigned int memLen, - const char * const msg) const + const unsigned int lineNo, const MemData memData, const char * const msg) const { - this->_logStr<_MemLogWriter, LevelV, false>(fileName, funcName, lineNo, memData, memLen, "", - msg); + this->_logStr<_MemLogWriter, LevelV, false>(fileName, funcName, lineNo, memData, "", msg); } private: @@ -512,8 +508,8 @@ private: */ template void _log(const char * const fileName, const char * const funcName, const unsigned int lineNo, - const void * const memData, const std::size_t memLen, const char * const initMsg, - const char * const fmt, ArgTs&&...args) const + const MemData memData, const char * const initMsg, const char * const fmt, + ArgTs&&...args) const { /* Only format arguments if logging or appending an error cause */ if (G_UNLIKELY(this->wouldLog(LevelV) || AppendCauseV)) { @@ -526,7 +522,7 @@ private: _mBuf.push_back('\0'); } - this->_logStr(fileName, funcName, lineNo, memData, memLen, + this->_logStr(fileName, funcName, lineNo, memData, initMsg, _mBuf.data()); } @@ -540,8 +536,8 @@ private: */ template void _logStr(const char * const fileName, const char * const funcName, - const unsigned int lineNo, const void * const memData, const std::size_t memLen, - const char * const initMsg, const char * const msg) const + const unsigned int lineNo, const MemData memData, const char * const initMsg, + const char * const msg) const { /* Initial message and main message are required */ BT_ASSERT(initMsg); @@ -549,8 +545,8 @@ private: /* Log if needed */ if (this->wouldLog(LevelV)) { - LogWriterT::write(fileName, funcName, lineNo, LevelV, _mTag.data(), memData, memLen, - initMsg, msg); + LogWriterT::write(fileName, funcName, lineNo, LevelV, _mTag.data(), memData, initMsg, + msg); } /* Append an error cause if needed */ @@ -680,10 +676,10 @@ inline const char *maybeNull(const char * const s) noexcept /* * Calls logMem() on `_logger` to log using the level `_lvl`. */ -#define BT_CPPLOG_MEM_EX(_lvl, _logger, _memData, _memLen, _fmt, ...) \ +#define BT_CPPLOG_MEM_EX(_lvl, _logger, _memData, _fmt, ...) \ do { \ if (G_UNLIKELY((_logger).wouldLog(_lvl))) { \ - (_logger).logMem<(_lvl)>(__FILE__, __func__, __LINE__, (_memData), (_memLen), (_fmt), \ + (_logger).logMem<(_lvl)>(__FILE__, __func__, __LINE__, (_memData), (_fmt), \ ##__VA_ARGS__); \ } \ } while (0) @@ -691,80 +687,74 @@ inline const char *maybeNull(const char * const s) noexcept /* * BT_CPPLOG_MEM_EX() with specific logging levels. */ -#define BT_CPPLOGT_MEM_SPEC(_logger, _memData, _memLen, _fmt, ...) \ - BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Trace, (_logger), (_memData), (_memLen), (_fmt), \ - ##__VA_ARGS__) -#define BT_CPPLOGD_MEM_SPEC(_logger, _memData, _memLen, _fmt, ...) \ - BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Debug, (_logger), (_memData), (_memLen), (_fmt), \ - ##__VA_ARGS__) -#define BT_CPPLOGI_MEM_SPEC(_logger, _memData, _memLen, _fmt, ...) \ - BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Info, (_logger), (_memData), (_memLen), (_fmt), \ - ##__VA_ARGS__) -#define BT_CPPLOGW_MEM_SPEC(_logger, _memData, _memLen, _fmt, ...) \ - BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Warning, (_logger), (_memData), (_memLen), (_fmt), \ - ##__VA_ARGS__) -#define BT_CPPLOGE_MEM_SPEC(_logger, _memData, _memLen, _fmt, ...) \ - BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Error, (_logger), (_memData), (_memLen), (_fmt), \ - ##__VA_ARGS__) -#define BT_CPPLOGF_MEM_SPEC(_logger, _memData, _memLen, _fmt, ...) \ - BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Fatal, (_logger), (_memData), (_memLen), (_fmt), \ - ##__VA_ARGS__) +#define BT_CPPLOGT_MEM_SPEC(_logger, _memData, _fmt, ...) \ + BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Trace, (_logger), (_memData), (_fmt), ##__VA_ARGS__) +#define BT_CPPLOGD_MEM_SPEC(_logger, _memData, _fmt, ...) \ + BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Debug, (_logger), (_memData), (_fmt), ##__VA_ARGS__) +#define BT_CPPLOGI_MEM_SPEC(_logger, _memData, _fmt, ...) \ + BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Info, (_logger), (_memData), (_fmt), ##__VA_ARGS__) +#define BT_CPPLOGW_MEM_SPEC(_logger, _memData, _fmt, ...) \ + BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Warning, (_logger), (_memData), (_fmt), ##__VA_ARGS__) +#define BT_CPPLOGE_MEM_SPEC(_logger, _memData, _fmt, ...) \ + BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Error, (_logger), (_memData), (_fmt), ##__VA_ARGS__) +#define BT_CPPLOGF_MEM_SPEC(_logger, _memData, _fmt, ...) \ + BT_CPPLOG_MEM_EX(bt2c::Logger::Level::Fatal, (_logger), (_memData), (_fmt), ##__VA_ARGS__) /* * BT_CPPLOG_MEM_EX() with specific logging levels and using the default * logger. */ -#define BT_CPPLOGT_MEM(_memData, _memLen, _fmt, ...) \ - BT_CPPLOGT_MEM_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_memLen), (_fmt), ##__VA_ARGS__) -#define BT_CPPLOGD_MEM(_memData, _memLen, _fmt, ...) \ - BT_CPPLOGD_MEM_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_memLen), (_fmt), ##__VA_ARGS__) -#define BT_CPPLOGI_MEM(_memData, _memLen, _fmt, ...) \ - BT_CPPLOGI_MEM_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_memLen), (_fmt), ##__VA_ARGS__) -#define BT_CPPLOGW_MEM(_memData, _memLen, _fmt, ...) \ - BT_CPPLOGW_MEM_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_memLen), (_fmt), ##__VA_ARGS__) -#define BT_CPPLOGE_MEM(_memData, _memLen, _fmt, ...) \ - BT_CPPLOGE_MEM_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_memLen), (_fmt), ##__VA_ARGS__) -#define BT_CPPLOGF_MEM(_memData, _memLen, _fmt, ...) \ - BT_CPPLOGF_MEM_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_memLen), (_fmt), ##__VA_ARGS__) +#define BT_CPPLOGT_MEM(_memData, _fmt, ...) \ + BT_CPPLOGT_MEM_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_fmt), ##__VA_ARGS__) +#define BT_CPPLOGD_MEM(_memData, _fmt, ...) \ + BT_CPPLOGD_MEM_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_fmt), ##__VA_ARGS__) +#define BT_CPPLOGI_MEM(_memData, _fmt, ...) \ + BT_CPPLOGI_MEM_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_fmt), ##__VA_ARGS__) +#define BT_CPPLOGW_MEM(_memData, _fmt, ...) \ + BT_CPPLOGW_MEM_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_fmt), ##__VA_ARGS__) +#define BT_CPPLOGE_MEM(_memData, _fmt, ...) \ + BT_CPPLOGE_MEM_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_fmt), ##__VA_ARGS__) +#define BT_CPPLOGF_MEM(_memData, _fmt, ...) \ + BT_CPPLOGF_MEM_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_fmt), ##__VA_ARGS__) /* * Calls logMemStr() on `_logger` to log using the level `_lvl`. */ -#define BT_CPPLOG_MEM_STR_EX(_lvl, _logger, _memData, _memLen, _msg) \ - (_logger).logMemStr<(_lvl)>(__FILE__, __func__, __LINE__, (_memData), (_memLen), (_msg)) +#define BT_CPPLOG_MEM_STR_EX(_lvl, _logger, _memData, _msg) \ + (_logger).logMemStr<(_lvl)>(__FILE__, __func__, __LINE__, (_memData), (_msg)) /* * BT_CPPLOG_MEM_STR_EX() with specific logging levels. */ -#define BT_CPPLOGT_MEM_STR_SPEC(_logger, _memData, _memLen, _msg) \ - BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::TRACE, (_logger), (_memData), (_memLen), (_msg)) -#define BT_CPPLOGD_MEM_STR_SPEC(_logger, _memData, _memLen, _msg) \ - BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::DEBUG, (_logger), (_memData), (_memLen), (_msg)) -#define BT_CPPLOGI_MEM_STR_SPEC(_logger, _memData, _memLen, _msg) \ - BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::INFO, (_logger), (_memData), (_memLen), (_msg)) -#define BT_CPPLOGW_MEM_STR_SPEC(_logger, _memData, _memLen, _msg) \ - BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::WARNING, (_logger), (_memData), (_memLen), (_msg)) -#define BT_CPPLOGE_MEM_STR_SPEC(_logger, _memData, _memLen, _msg) \ - BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::Error, (_logger), (_memData), (_memLen), (_msg)) -#define BT_CPPLOGF_MEM_STR_SPEC(_logger, _memData, _memLen, _msg) \ - BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::FATAL, (_logger), (_memData), (_memLen), (_msg)) +#define BT_CPPLOGT_MEM_STR_SPEC(_logger, _memData, _msg) \ + BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::TRACE, (_logger), (_memData), (_msg)) +#define BT_CPPLOGD_MEM_STR_SPEC(_logger, _memData, _msg) \ + BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::DEBUG, (_logger), (_memData), (_msg)) +#define BT_CPPLOGI_MEM_STR_SPEC(_logger, _memData, _msg) \ + BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::INFO, (_logger), (_memData), (_msg)) +#define BT_CPPLOGW_MEM_STR_SPEC(_logger, _memData, _msg) \ + BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::WARNING, (_logger), (_memData), (_msg)) +#define BT_CPPLOGE_MEM_STR_SPEC(_logger, _memData, _msg) \ + BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::Error, (_logger), (_memData), (_msg)) +#define BT_CPPLOGF_MEM_STR_SPEC(_logger, _memData, _msg) \ + BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::FATAL, (_logger), (_memData), (_msg)) /* * BT_CPPLOG_MEM_STR_EX() with specific logging levels and using the * default logger. */ -#define BT_CPPLOGT_MEM_STR(_memData, _memLen, _msg) \ - BT_CPPLOGT_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_memLen), (_msg)) -#define BT_CPPLOGD_MEM_STR(_memData, _memLen, _msg) \ - BT_CPPLOGD_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_memLen), (_msg)) -#define BT_CPPLOGI_MEM_STR(_memData, _memLen, _msg) \ - BT_CPPLOGI_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_memLen), (_msg)) -#define BT_CPPLOGW_MEM_STR(_memData, _memLen, _msg) \ - BT_CPPLOGW_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_memLen), (_msg)) -#define BT_CPPLOGE_MEM_STR(_memData, _memLen, _msg) \ - BT_CPPLOGE_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_memLen), (_msg)) -#define BT_CPPLOGF_MEM_STR(_memData, _memLen, _msg) \ - BT_CPPLOGF_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_memLen), (_msg)) +#define BT_CPPLOGT_MEM_STR(_memData, _msg) \ + BT_CPPLOGT_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg)) +#define BT_CPPLOGD_MEM_STR(_memData, _msg) \ + BT_CPPLOGD_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg)) +#define BT_CPPLOGI_MEM_STR(_memData, _msg) \ + BT_CPPLOGI_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg)) +#define BT_CPPLOGW_MEM_STR(_memData, _msg) \ + BT_CPPLOGW_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg)) +#define BT_CPPLOGE_MEM_STR(_memData, _msg) \ + BT_CPPLOGE_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg)) +#define BT_CPPLOGF_MEM_STR(_memData, _msg) \ + BT_CPPLOGF_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg)) /* * Calls logErrno() on `_logger` to log using the level `_lvl` and diff --git a/src/plugins/ctf/common/src/msg-iter/msg-iter.cpp b/src/plugins/ctf/common/src/msg-iter/msg-iter.cpp index 4ab970bd..1d146f3d 100644 --- a/src/plugins/ctf/common/src/msg-iter/msg-iter.cpp +++ b/src/plugins/ctf/common/src/msg-iter/msg-iter.cpp @@ -15,6 +15,7 @@ #include "common/common.h" #include "cpp-common/bt2c/fmt.hpp" #include "cpp-common/bt2c/logging.hpp" +#include "cpp-common/bt2c/make-span.hpp" #include "cpp-common/vendor/fmt/format.h" #include "../bfcr/bfcr.hpp" @@ -523,7 +524,7 @@ static enum ctf_msg_iter_status request_medium_bytes(struct ctf_msg_iter *msg_it "packet-offset={}, cur={}, size={}, addr={}", msg_it->buf.packet_offset, msg_it->buf.at, msg_it->buf.sz, fmt::ptr(msg_it->buf.addr)); - BT_CPPLOGT_MEM_SPEC(msg_it->logger, buffer_addr, buffer_sz, + BT_CPPLOGT_MEM_SPEC(msg_it->logger, bt2c::makeSpan(buffer_addr, buffer_sz), "Returned bytes at {}:", fmt::ptr(buffer_addr)); } else if (m_status == CTF_MSG_ITER_MEDIUM_STATUS_EOF) { /* -- 2.34.1 From dafde0c1db4f4526ef9c7ee923fc3639d7b36e63 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Tue, 23 Apr 2024 13:02:48 -0400 Subject: [PATCH 03/16] .gitignore: add missing test binaries Signed-off-by: Philippe Proulx Change-Id: Ie78f6483a0e3810535ed8611d4cb033ca96b9b4b Reviewed-on: https://review.lttng.org/c/babeltrace/+/12457 --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 2267bc7b..22e401ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ /tests/bitfield/test-bitfield /tests/argpar/test-argpar +/tests/cpp-common/test-c-string-view +/tests/cpp-common/test-uuid /tests/ctf-writer/ctf-writer /tests/lib/plugin /tests/lib/test-bt-uuid @@ -10,6 +12,9 @@ /tests/lib/test-simple-sink /tests/lib/test-remove-destruction-listener-in-destruction-listener /tests/lib/conds/conds-triggers +/tests/lib/test-plugin-init-fail +/tests/lib/test-plugins +/tests/plugins/flt.utils.muxer/test-clock-compatibility /tests/param-validation/test-param-validation /tests/plugins/flt.lttng-utils.debug-info/test-bin-info /tests/plugins/flt.lttng-utils.debug-info/test-dwarf -- 2.34.1 From e6767949939c8b03250e0d42ad3fcf1e8ff5c75f Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 17 Apr 2024 13:45:47 -0400 Subject: [PATCH 04/16] cpp-common/bt2c: remove `dummy.cpp` There is another source file (file-utils.cpp), so dummy.cpp is no longer needed. Change-Id: I7429a005c49498d6d2e500c5afe4b3d07640d654 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/12413 Reviewed-by: Philippe Proulx --- src/Makefile.am | 1 - src/cpp-common/bt2c/dummy.cpp | 0 2 files changed, 1 deletion(-) delete mode 100644 src/cpp-common/bt2c/dummy.cpp diff --git a/src/Makefile.am b/src/Makefile.am index d2cec231..72a71463 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -162,7 +162,6 @@ cpp_common_libcpp_common_la_SOURCES = \ cpp-common/bt2c/call.hpp \ cpp-common/bt2c/contains.hpp \ cpp-common/bt2c/data-len.hpp \ - cpp-common/bt2c/dummy.cpp \ cpp-common/bt2c/endian.hpp \ cpp-common/bt2c/exc.hpp \ cpp-common/bt2c/file-utils.cpp \ diff --git a/src/cpp-common/bt2c/dummy.cpp b/src/cpp-common/bt2c/dummy.cpp deleted file mode 100644 index e69de29b..00000000 -- 2.34.1 From 580c25a54f55788fcf8d0dacce972952fb1ebc8f Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 24 Apr 2024 15:45:50 -0400 Subject: [PATCH 05/16] tests: test_dwarf.c: initialize `tag` variable On Arch Linux, When configuring with: $ /home/smarchi/src/babeltrace/configure CFLAGS='-O2 -flto=auto' LDFLAGS='-flto=auto' I get: CCLD test_dwarf In function 'test_bt_dwarf', inlined from 'main' at /home/smarchi/src/babeltrace/tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c:163:2: /home/smarchi/src/babeltrace/tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c:136:9: error: 'tag' may be used uninitialized [-Werror=maybe-uninitialized] 136 | ok(tag == DW_TAG_typedef, "bt_dwarf_die_get_tag - correct tag value"); | ^ /home/smarchi/src/babeltrace/tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c: In function 'main': /home/smarchi/src/babeltrace/tests/plugins/flt.lttng-utils.debug-info/test_dwarf.c:79:22: note: 'tag' was declared here 79 | int fd, ret, tag; | ^ Indeed, `tag` is not set if `bt_dwarf_die_get_tag()` fails, and I suppose that LTO is able to "see" through the function call, despite the implementation being in another compilation unit. Fix this by initializing `tag` to an invalid DIE tag value. For some reason, I only see this error on the stable-2.0 branch, not on master. But I think it wouldn't hurt to merge this patch to both master and stable-2.0. I caught this when trying to build the 2.0.6 release as an Arch package, using the official PKGBUILD as a base. [1] https://gitlab.archlinux.org/archlinux/packaging/packages/babeltrace2/-/blob/d6c58a3a8e0dbbbac7424dec28212f0fd1720eb7/PKGBUILD Change-Id: I5475efdf095511404ecf8a214ab33358b41230fa Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/12473 Reviewed-by: Michael Jeanson Reviewed-by: Philippe Proulx Tested-by: jenkins --- tests/plugins/flt.lttng-utils.debug-info/test-dwarf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/plugins/flt.lttng-utils.debug-info/test-dwarf.c b/tests/plugins/flt.lttng-utils.debug-info/test-dwarf.c index b74eabf4..e50d1c44 100644 --- a/tests/plugins/flt.lttng-utils.debug-info/test-dwarf.c +++ b/tests/plugins/flt.lttng-utils.debug-info/test-dwarf.c @@ -63,7 +63,7 @@ void test_bt_no_dwarf(const char *data_dir) static void test_bt_dwarf(const char *data_dir) { - int fd, ret, tag; + int fd, ret, tag = -1; char *path; char *die_name = NULL; struct bt_dwarf_cu *cu = NULL; -- 2.34.1 From eabba0421f7a6e7261ab179377fcd5e18ea47a96 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 24 Apr 2024 02:25:33 -0400 Subject: [PATCH 06/16] .gitignore: cleanup test files MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Given that, under the `tests` directory: ✔ All shell file names end with `.sh`. ✔ All C file names end with `.c` or `.h`. ✔ All C++ file names end with `.cpp` or `.hpp`. ✔ No Python file name contains `-`. Then it's safe to ignore everything named `test-` except the files of which the name ends with one of the extensions above. Also sort the list of remaining specific file names. Signed-off-by: Philippe Proulx Change-Id: I2a4d541bd9624ed48051c944789c0b5f075a917b Reviewed-on: https://review.lttng.org/c/babeltrace/+/12466 Reviewed-by: Simon Marchi --- .gitignore | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 22e401ee..a91e121d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,13 @@ -/tests/bitfield/test-bitfield -/tests/argpar/test-argpar -/tests/cpp-common/test-c-string-view -/tests/cpp-common/test-uuid +/tests/**/test-* +!/tests/**/test-*.sh +!/tests/**/test-*.[hc] +!/tests/**/test-*.[hc]pp /tests/ctf-writer/ctf-writer -/tests/lib/plugin -/tests/lib/test-bt-uuid -/tests/lib/test-bt-values -/tests/lib/test-fields-bin -/tests/lib/test-graph-topo -/tests/lib/test-trace-ir-ref -/tests/lib/test-simple-sink -/tests/lib/test-remove-destruction-listener-in-destruction-listener /tests/lib/conds/conds-triggers -/tests/lib/test-plugin-init-fail -/tests/lib/test-plugins -/tests/plugins/flt.utils.muxer/test-clock-compatibility -/tests/param-validation/test-param-validation -/tests/plugins/flt.lttng-utils.debug-info/test-bin-info -/tests/plugins/flt.lttng-utils.debug-info/test-dwarf -/tests/plugins/src.ctf.fs/succeed/gen-trace-simple -/tests/plugins/sink.ctf.fs/succeed/gen-trace-float +/tests/lib/plugin /tests/plugins/sink.ctf.fs/succeed/gen-trace-double +/tests/plugins/sink.ctf.fs/succeed/gen-trace-float +/tests/plugins/src.ctf.fs/succeed/gen-trace-simple /tests/utils/env.sh *~ *.o -- 2.34.1 From b75e024e1e28b40d83aa11c4c0494e85b17396c1 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 24 Apr 2024 02:28:33 -0400 Subject: [PATCH 07/16] .gitignore: ignore all `/src/cli/*.bin` Signed-off-by: Philippe Proulx Change-Id: Ie1c0138d2a1d766c386b4c237545b21a9903c027 Reviewed-on: https://review.lttng.org/c/babeltrace/+/12467 Reviewed-by: Simon Marchi --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index a91e121d..c7aaa1c1 100644 --- a/.gitignore +++ b/.gitignore @@ -26,10 +26,9 @@ /src/plugins/ctf/common/src/metadata/tsdl/parser.output /src/bindings/python/bt2/bt2.egg-info /src/bindings/python/bt2/dist +/src/cli/*.bin /src/cli/babeltrace2 -/src/cli/babeltrace2.bin /src/cli/babeltrace2-log -/src/cli/babeltrace2-log.bin /src/common/config.h /src/common/config.h.in /src/common/version.i -- 2.34.1 From d97afa4a658caf7aeeab3c8b595948f5fd88d83f Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 24 Apr 2024 02:30:20 -0400 Subject: [PATCH 08/16] .gitignore: ignore all `/src/plugins/ctf/[...]/tsdl/parser.*pp` Signed-off-by: Philippe Proulx Change-Id: I3d8e45d6a8482552d11c7292ddcdb21514e683b9 Reviewed-on: https://review.lttng.org/c/babeltrace/+/12468 Reviewed-by: Simon Marchi --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c7aaa1c1..74b1123f 100644 --- a/.gitignore +++ b/.gitignore @@ -21,8 +21,7 @@ *.trs .dirstamp /src/plugins/ctf/common/src/metadata/tsdl/lexer.cpp -/src/plugins/ctf/common/src/metadata/tsdl/parser.cpp -/src/plugins/ctf/common/src/metadata/tsdl/parser.hpp +/src/plugins/ctf/common/src/metadata/tsdl/parser.*pp /src/plugins/ctf/common/src/metadata/tsdl/parser.output /src/bindings/python/bt2/bt2.egg-info /src/bindings/python/bt2/dist -- 2.34.1 From fed63719ba0d55d580b7ffc8a25a713760f7d034 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 24 Apr 2024 02:30:52 -0400 Subject: [PATCH 09/16] .gitignore: ignore all `*.egg-info` Signed-off-by: Philippe Proulx Change-Id: I804bbb158ba2ccb5dbe326b4eb12d5e13d06c62a Reviewed-on: https://review.lttng.org/c/babeltrace/+/12469 Reviewed-by: Simon Marchi --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 74b1123f..e3bb84fd 100644 --- a/.gitignore +++ b/.gitignore @@ -23,7 +23,6 @@ /src/plugins/ctf/common/src/metadata/tsdl/lexer.cpp /src/plugins/ctf/common/src/metadata/tsdl/parser.*pp /src/plugins/ctf/common/src/metadata/tsdl/parser.output -/src/bindings/python/bt2/bt2.egg-info /src/bindings/python/bt2/dist /src/cli/*.bin /src/cli/babeltrace2 @@ -59,6 +58,7 @@ cscope* *.html *.stamp *.swp +*.egg-info .theia compile_commands.json /version -- 2.34.1 From 3b4f52ad45c87421f2610fcce009d419cf3bc8ee Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 24 Apr 2024 02:51:27 -0400 Subject: [PATCH 10/16] .gitignore: categorize rules and sort them per category Signed-off-by: Philippe Proulx Change-Id: I4a80709271b189469ba6b3869410ff41196ae551 Reviewed-on: https://review.lttng.org/c/babeltrace/+/12470 --- .gitignore | 107 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 65 insertions(+), 42 deletions(-) diff --git a/.gitignore b/.gitignore index e3bb84fd..456c58d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,64 +1,87 @@ -/tests/**/test-* -!/tests/**/test-*.sh -!/tests/**/test-*.[hc] -!/tests/**/test-*.[hc]pp -/tests/ctf-writer/ctf-writer -/tests/lib/conds/conds-triggers -/tests/lib/plugin -/tests/plugins/sink.ctf.fs/succeed/gen-trace-double -/tests/plugins/sink.ctf.fs/succeed/gen-trace-float -/tests/plugins/src.ctf.fs/succeed/gen-trace-simple -/tests/utils/env.sh -*~ -*.o +# Generated build files *.a +*.exe *.la *.lo -*.exe -.libs -.deps -*.bkp +*.o *.trs +.deps +.libs + +# Generated Autotools files .dirstamp -/src/plugins/ctf/common/src/metadata/tsdl/lexer.cpp -/src/plugins/ctf/common/src/metadata/tsdl/parser.*pp -/src/plugins/ctf/common/src/metadata/tsdl/parser.output -/src/bindings/python/bt2/dist -/src/cli/*.bin -/src/cli/babeltrace2 -/src/cli/babeltrace2-log -/src/common/config.h -/src/common/config.h.in -/src/common/version.i -/src/common/version.i.tmp -/config.status -*.log aclocal.m4 +/autom4te.cache/ +/config.status +/config/ +/configure +libtool /m4/libtool.m4 -/m4/lt~obsolete.m4 /m4/ltoptions.m4 /m4/ltsugar.m4 /m4/ltversion.m4 -libtool -/configure +/m4/lt~obsolete.m4 Makefile Makefile.in -autom4te.cache/ -config/ -core stamp-h1 + +# Generated Python files +*.egg-info __pycache__ -/src/babeltrace2.pc +/src/bindings/python/bt2/dist + +# Generated pkg-config files /src/babeltrace2-ctf-writer.pc -TAGS -cscope* -*.gcno +/src/babeltrace2.pc + +# Generated configuration/version header files +/src/common/config.h +/src/common/config.h.in +/src/common/version.i +/src/common/version.i.tmp + +# Generated CLI binaries +/src/cli/*.bin +/src/cli/babeltrace2 +/src/cli/babeltrace2-log + +# Generated `ctf` plugin lexer/parser files +/src/plugins/ctf/common/src/metadata/tsdl/lexer.cpp +/src/plugins/ctf/common/src/metadata/tsdl/parser.*pp +/src/plugins/ctf/common/src/metadata/tsdl/parser.output + +# Generated test files +/tests/**/test-* +!/tests/**/test-*.sh +!/tests/**/test-*.[hc] +!/tests/**/test-*.[hc]pp +/tests/ctf-writer/ctf-writer +/tests/lib/conds/conds-triggers +/tests/lib/plugin +/tests/plugins/sink.ctf.fs/succeed/gen-trace-double +/tests/plugins/sink.ctf.fs/succeed/gen-trace-float +/tests/plugins/src.ctf.fs/succeed/gen-trace-simple +/tests/utils/env.sh + +# Version extra information +/version + +# IDE, editor, development tool, and other files +*.bkp *.gcda +*.gcno *.gcov *.html +*.ide +*.log *.stamp +*.sublime-project +*.sublime-workspace *.swp -*.egg-info +*~ +.cache/ .theia compile_commands.json -/version +cscope* +/install/ +TAGS -- 2.34.1 From eced29fcde500cecbec69231bf8d4b1d9f8fe556 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 24 Apr 2024 03:00:19 -0400 Subject: [PATCH 11/16] Keep a single `.gitignore` file We have a few arbitrary directory-specific `.gitignore` files and I'd like to keep things consistent here: either dedicated `.gitignore` files or a single root `.gitignore` file. Choose the latter as it's simpler to maintain. Signed-off-by: Philippe Proulx Change-Id: Ib679a19cd20adb0034860073e04388d7d6e084f6 Reviewed-on: https://review.lttng.org/c/babeltrace/+/12471 --- .gitignore | 2 ++ doc/api/libbabeltrace2/.gitignore | 3 --- doc/man/.gitignore | 5 ----- src/bindings/python/bt2/.gitignore | 11 ----------- tests/bindings/python/bt2/.gitignore | 2 -- tests/python-plugin-provider/.gitignore | 2 -- 6 files changed, 2 insertions(+), 23 deletions(-) delete mode 100644 doc/api/libbabeltrace2/.gitignore delete mode 100644 doc/man/.gitignore delete mode 100644 src/bindings/python/bt2/.gitignore delete mode 100644 tests/bindings/python/bt2/.gitignore delete mode 100644 tests/python-plugin-provider/.gitignore diff --git a/.gitignore b/.gitignore index 456c58d7..904372ce 100644 --- a/.gitignore +++ b/.gitignore @@ -80,8 +80,10 @@ __pycache__ *.swp *~ .cache/ +.coverage .theia compile_commands.json cscope* +htmlcov/ /install/ TAGS diff --git a/doc/api/libbabeltrace2/.gitignore b/doc/api/libbabeltrace2/.gitignore deleted file mode 100644 index 15523a73..00000000 --- a/doc/api/libbabeltrace2/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -output -Doxyfile -README.html diff --git a/doc/man/.gitignore b/doc/man/.gitignore deleted file mode 100644 index f54189ac..00000000 --- a/doc/man/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.1 -*.7 -*.xml -*.html -asciidoc-attrs.conf diff --git a/src/bindings/python/bt2/.gitignore b/src/bindings/python/bt2/.gitignore deleted file mode 100644 index fc7a23f1..00000000 --- a/src/bindings/python/bt2/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -# SPDX-FileCopyrightText: 2019-2020 EfficiOS, Inc. -# SPDX-License-Identifier: MIT - -bt2/native_bt.py -bt2/native_bt.c -bt2/native_bt.d -bt2/version.py -build -build-python-bindings.stamp -installed_files.txt -setup.py diff --git a/tests/bindings/python/bt2/.gitignore b/tests/bindings/python/bt2/.gitignore deleted file mode 100644 index 7446a35d..00000000 --- a/tests/bindings/python/bt2/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -htmlcov -.coverage diff --git a/tests/python-plugin-provider/.gitignore b/tests/python-plugin-provider/.gitignore deleted file mode 100644 index 7446a35d..00000000 --- a/tests/python-plugin-provider/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -htmlcov -.coverage -- 2.34.1 From e40ac8f6684dbeb4b6a0715baa7b25667b53f1e6 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 24 Apr 2024 17:11:48 -0400 Subject: [PATCH 12/16] Fix: cpp-common/bt2c/logging.hpp: add missing `template` keyword In very specific contexts, it's possible that a `bt2c::Logger` reference is a dependent type, for example: template struct X { const bt2c::Logger& logger() const noexcept { return /* some logger reference */; } void log() { BT_CPPLOGI_SPEC(this->logger(), "Hello!"); } }; In that case, the BT_CPPLOGI_SPEC() macro eventually expands to something like: this->logger().log(__FILE__, __func__, __LINE__, "Hello!"); `this->logger()` is basically `X::logger()`. Therefore, from the log() method template point of view, the type of `this` depends on `T`, that is, it's a dependent name. This example above won't build. In that case, we need the `template` keyword to call the method: this->logger().template log(__FILE__, __func__, __LINE__, "Hello!"); Using the `template` keyword or not would normally be a per-call decision, but those BT_CPPLOG*() macros do the call themselves. Knowing this, this patch adds the `template` keyword to all the logging method calls from the BT_CPPLOG*() macros, just in case. The current project builds because it doesn't have this specific situation, but it could happen in the future. Signed-off-by: Philippe Proulx Change-Id: I2847105746825d94cf71ed3abbd56fac0f160a2d Reviewed-on: https://review.lttng.org/c/babeltrace/+/12477 Reviewed-by: Simon Marchi Tested-by: jenkins --- src/cpp-common/bt2c/logging.hpp | 56 ++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/src/cpp-common/bt2c/logging.hpp b/src/cpp-common/bt2c/logging.hpp index fb21ec4e..90db909b 100644 --- a/src/cpp-common/bt2c/logging.hpp +++ b/src/cpp-common/bt2c/logging.hpp @@ -609,7 +609,8 @@ inline const char *maybeNull(const char * const s) noexcept #define BT_CPPLOG_EX(_lvl, _logger, _fmt, ...) \ do { \ if (G_UNLIKELY((_logger).wouldLog(_lvl))) { \ - (_logger).log<(_lvl), false>(__FILE__, __func__, __LINE__, (_fmt), ##__VA_ARGS__); \ + (_logger).template log<(_lvl), false>(__FILE__, __func__, __LINE__, (_fmt), \ + ##__VA_ARGS__); \ } \ } while (0) @@ -644,7 +645,7 @@ inline const char *maybeNull(const char * const s) noexcept * Calls logStr() on `_logger` to log using the level `_lvl`. */ #define BT_CPPLOG_STR_EX(_lvl, _logger, _msg) \ - (_logger).logStr<(_lvl), false>(__FILE__, __func__, __LINE__, (_msg)) + (_logger).template logStr<(_lvl), false>(__FILE__, __func__, __LINE__, (_msg)) /* * BT_CPPLOG_STR_EX() with specific logging levels. @@ -679,8 +680,8 @@ inline const char *maybeNull(const char * const s) noexcept #define BT_CPPLOG_MEM_EX(_lvl, _logger, _memData, _fmt, ...) \ do { \ if (G_UNLIKELY((_logger).wouldLog(_lvl))) { \ - (_logger).logMem<(_lvl)>(__FILE__, __func__, __LINE__, (_memData), (_fmt), \ - ##__VA_ARGS__); \ + (_logger).template logMem<(_lvl)>(__FILE__, __func__, __LINE__, (_memData), (_fmt), \ + ##__VA_ARGS__); \ } \ } while (0) @@ -721,7 +722,7 @@ inline const char *maybeNull(const char * const s) noexcept * Calls logMemStr() on `_logger` to log using the level `_lvl`. */ #define BT_CPPLOG_MEM_STR_EX(_lvl, _logger, _memData, _msg) \ - (_logger).logMemStr<(_lvl)>(__FILE__, __func__, __LINE__, (_memData), (_msg)) + (_logger).template logMemStr<(_lvl)>(__FILE__, __func__, __LINE__, (_memData), (_msg)) /* * BT_CPPLOG_MEM_STR_EX() with specific logging levels. @@ -763,8 +764,8 @@ inline const char *maybeNull(const char * const s) noexcept #define BT_CPPLOG_ERRNO_EX(_lvl, _logger, _initMsg, _fmt, ...) \ do { \ if (G_UNLIKELY((_logger).wouldLog(_lvl))) { \ - (_logger).logErrno<(_lvl), false>(__FILE__, __func__, __LINE__, (_initMsg), (_fmt), \ - ##__VA_ARGS__); \ + (_logger).template logErrno<(_lvl), false>(__FILE__, __func__, __LINE__, (_initMsg), \ + (_fmt), ##__VA_ARGS__); \ } \ } while (0) @@ -806,7 +807,7 @@ inline const char *maybeNull(const char * const s) noexcept * initial message `_initMsg`. */ #define BT_CPPLOG_ERRNO_STR_EX(_lvl, _logger, _initMsg, _msg) \ - (_logger).logErrnoStr<(_lvl), false>(__FILE__, __func__, __LINE__, (_initMsg), (_msg)) + (_logger).template logErrnoStr<(_lvl), false>(__FILE__, __func__, __LINE__, (_initMsg), (_msg)) /* * BT_CPPLOG_ERRNO_STR_EX() with specific logging levels. @@ -846,8 +847,8 @@ inline const char *maybeNull(const char * const s) noexcept * append a cause to the error of the current thread. */ #define BT_CPPLOGE_APPEND_CAUSE_SPEC(_logger, _fmt, ...) \ - (_logger).log(__FILE__, __func__, __LINE__, (_fmt), \ - ##__VA_ARGS__) + (_logger).template log(__FILE__, __func__, __LINE__, (_fmt), \ + ##__VA_ARGS__) /* * BT_CPPLOGE_APPEND_CAUSE_SPEC() using the default logger. @@ -860,7 +861,8 @@ inline const char *maybeNull(const char * const s) noexcept * append a cause to the error of the current thread. */ #define BT_CPPLOGE_STR_APPEND_CAUSE_SPEC(_logger, _msg) \ - (_logger).logStr(__FILE__, __func__, __LINE__, (_msg)) + (_logger).template logStr(__FILE__, __func__, __LINE__, \ + (_msg)) /* * BT_CPPLOGE_STR_APPEND_CAUSE_SPEC() using the default logger. @@ -874,7 +876,8 @@ inline const char *maybeNull(const char * const s) noexcept * `_excCls`. */ #define BT_CPPLOGE_APPEND_CAUSE_AND_THROW_SPEC(_logger, _excCls, _fmt, ...) \ - (_logger).logErrorAndThrow(__FILE__, __func__, __LINE__, (_fmt), ##__VA_ARGS__) + (_logger).template logErrorAndThrow(__FILE__, __func__, __LINE__, (_fmt), \ + ##__VA_ARGS__) /* * BT_CPPLOGE_APPEND_CAUSE_AND_THROW_SPEC() using the default logger. @@ -888,7 +891,7 @@ inline const char *maybeNull(const char * const s) noexcept * `_excCls`. */ #define BT_CPPLOGE_STR_APPEND_CAUSE_AND_THROW_SPEC(_logger, _excCls, _msg) \ - (_logger).logErrorStrAndThrow(__FILE__, __func__, __LINE__, (_msg)) + (_logger).template logErrorStrAndThrow(__FILE__, __func__, __LINE__, (_msg)) /* * BT_CPPLOGE_STR_APPEND_CAUSE_AND_THROW_SPEC() using the default @@ -903,7 +906,7 @@ inline const char *maybeNull(const char * const s) noexcept * `_excCls`. */ #define BT_CPPLOGE_APPEND_CAUSE_AND_RETHROW_SPEC(_logger, _fmt, ...) \ - (_logger).logErrorAndRethrow(__FILE__, __func__, __LINE__, (_fmt), ##__VA_ARGS__) + (_logger).template logErrorAndRethrow(__FILE__, __func__, __LINE__, (_fmt), ##__VA_ARGS__) /* * BT_CPPLOGE_APPEND_CAUSE_AND_RETHROW_SPEC() using the default logger. @@ -917,7 +920,7 @@ inline const char *maybeNull(const char * const s) noexcept * `_excCls`. */ #define BT_CPPLOGE_STR_APPEND_CAUSE_AND_RETHROW_SPEC(_logger, _msg) \ - (_logger).logErrorStrAndRethrow(__FILE__, __func__, __LINE__, (_msg)) + (_logger).template logErrorStrAndRethrow(__FILE__, __func__, __LINE__, (_msg)) /* * BT_CPPLOGE_STR_APPEND_CAUSE_AND_RETHROW_SPEC() using the default @@ -931,8 +934,8 @@ inline const char *maybeNull(const char * const s) noexcept * error and append a cause to the error of the current thread. */ #define BT_CPPLOGE_ERRNO_APPEND_CAUSE_SPEC(_logger, _initMsg, _fmt, ...) \ - (_logger).logErrno(__FILE__, __func__, __LINE__, (_initMsg), \ - (_fmt), ##__VA_ARGS__) + (_logger).template logErrno( \ + __FILE__, __func__, __LINE__, (_initMsg), (_fmt), ##__VA_ARGS__) /* * BT_CPPLOGE_ERRNO_APPEND_CAUSE_SPEC() using the default logger. @@ -945,8 +948,8 @@ inline const char *maybeNull(const char * const s) noexcept * an error and append a cause to the error of the current thread. */ #define BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_SPEC(_logger, _initMsg, _msg) \ - (_logger).logErrnoStr(__FILE__, __func__, __LINE__, \ - (_initMsg), (_msg)) + (_logger).template logErrnoStr(__FILE__, __func__, __LINE__, \ + (_initMsg), (_msg)) /* * BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_SPEC() using the default logger. @@ -960,8 +963,8 @@ inline const char *maybeNull(const char * const s) noexcept * `_excCls`. */ #define BT_CPPLOGE_ERRNO_APPEND_CAUSE_AND_THROW_SPEC(_logger, _excCls, _initMsg, _fmt, ...) \ - (_logger).logErrorErrnoAndThrow(__FILE__, __func__, __LINE__, (_initMsg), \ - (_fmt), ##__VA_ARGS__) + (_logger).template logErrorErrnoAndThrow(__FILE__, __func__, __LINE__, \ + (_initMsg), (_fmt), ##__VA_ARGS__) /* * BT_CPPLOGE_ERRNO_APPEND_CAUSE_AND_THROW_SPEC() using the default @@ -977,8 +980,8 @@ inline const char *maybeNull(const char * const s) noexcept * `_excCls`. */ #define BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_THROW_SPEC(_logger, _excCls, _initMsg, _msg) \ - (_logger).logErrorErrnoStrAndThrow(__FILE__, __func__, __LINE__, (_initMsg), \ - (_msg)) + (_logger).template logErrorErrnoStrAndThrow(__FILE__, __func__, __LINE__, \ + (_initMsg), (_msg)) /* * BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_THROW_SPEC() using the default @@ -994,8 +997,8 @@ inline const char *maybeNull(const char * const s) noexcept * `_excCls`. */ #define BT_CPPLOGE_ERRNO_APPEND_CAUSE_AND_RETHROW_SPEC(_logger, _initMsg, _fmt, ...) \ - (_logger).logErrorErrnoAndRethrow(__FILE__, __func__, __LINE__, (_initMsg), (_fmt), \ - ##__VA_ARGS__) + (_logger).template logErrorErrnoAndRethrow(__FILE__, __func__, __LINE__, (_initMsg), \ + (_fmt), ##__VA_ARGS__) /* * BT_CPPLOGE_ERRNO_APPEND_CAUSE_AND_RETHROW_SPEC() using the default @@ -1011,7 +1014,8 @@ inline const char *maybeNull(const char * const s) noexcept * instance of `_excCls`. */ #define BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_RETHROW_SPEC(_logger, _initMsg, _msg) \ - (_logger).logErrorErrnoStrAndRethrow(__FILE__, __func__, __LINE__, (_initMsg), (_msg)) + (_logger).template logErrorErrnoStrAndRethrow(__FILE__, __func__, __LINE__, (_initMsg), \ + (_msg)) /* * BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_RETHROW_SPEC() using the -- 2.34.1 From e27adb90396a8c985b7d27004f82c56ff9c31b3d Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 25 Apr 2024 00:05:09 -0400 Subject: [PATCH 13/16] cpp-common/bt2c/logging.hpp: remove no-formatting ("str") alternatives MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch removes everything named bt2c::Logger::log*Str*() and BT_CPPLOG*STR*(). The no-formatting versions existed to avoid a call to fmt::format_to() when you need to log a literal string as is, without any formatting. It was also useful to pass a user string as is. However, in the end, I don't think such an optimization is necessary: • We don't use the no-formatting versions that much compared to messages with a format string. • fmt::format_to() is pretty fast without any replacement field. • We're talking about logging performance. • This patch removes a lot of often redudant code from `logging.hpp`. Adapt the current no-formatting logging calls accordingly. Signed-off-by: Philippe Proulx Change-Id: Ie02ea492e220c7ce9b72aaf8728fb7d2211e0bc0 Reviewed-on: https://review.lttng.org/c/babeltrace/+/12479 Reviewed-by: Simon Marchi Tested-by: jenkins --- src/cpp-common/bt2c/logging.hpp | 345 +----------------- src/plugins/ctf/common/src/bfcr/bfcr.cpp | 20 +- .../src/metadata/tsdl/ctf-meta-resolve.cpp | 2 +- .../decoder-packetized-file-stream-to-buf.cpp | 2 +- .../ctf/common/src/metadata/tsdl/lexer.lpp | 2 +- .../ctf/common/src/metadata/tsdl/objstack.cpp | 4 +- .../ctf/common/src/metadata/tsdl/parser.ypp | 5 +- .../src/metadata/tsdl/visitor-generate-ir.cpp | 4 +- .../ctf/common/src/msg-iter/msg-iter.cpp | 14 +- src/plugins/ctf/fs-sink/fs-sink-trace.cpp | 36 +- src/plugins/ctf/fs-sink/fs-sink.cpp | 3 +- .../fs-sink/translate-trace-ir-to-ctf-ir.cpp | 12 +- src/plugins/ctf/fs-src/data-stream-file.cpp | 25 +- src/plugins/ctf/fs-src/fs.cpp | 14 +- src/plugins/ctf/lttng-live/lttng-live.cpp | 2 +- src/plugins/utils/muxer/comp.cpp | 8 +- src/plugins/utils/muxer/msg-iter.cpp | 9 +- 17 files changed, 97 insertions(+), 410 deletions(-) diff --git a/src/cpp-common/bt2c/logging.hpp b/src/cpp-common/bt2c/logging.hpp index 90db909b..970ff9b7 100644 --- a/src/cpp-common/bt2c/logging.hpp +++ b/src/cpp-common/bt2c/logging.hpp @@ -291,19 +291,6 @@ public: std::forward(args)...); } - /* - * Logs `msg` using the level `LevelV`. - * - * If `AppendCauseV` is true, this method also appends a cause to - * the error of the current thread using the same message. - */ - template - void logStr(const char * const fileName, const char * const funcName, const unsigned int lineNo, - const char * const msg) const - { - this->_logStr<_StdLogWriter, LevelV, AppendCauseV>(fileName, funcName, lineNo, {}, "", msg); - } - /* * Like log() with the `Level::Error` level, but also throws a * default-constructed instance of `ExcT`. @@ -318,18 +305,6 @@ public: throw ExcT {}; } - /* - * Like logStr() with the `Level::Error` level, but also throws a - * default-constructed instance of `ExcT`. - */ - template - [[noreturn]] void logErrorStrAndThrow(const char * const fileName, const char * const funcName, - const unsigned int lineNo, const char * const msg) const - { - this->logStr(fileName, funcName, lineNo, msg); - throw ExcT {}; - } - /* * Like log() with the `Level::Error` level, but also rethrows. */ @@ -343,18 +318,6 @@ public: throw; } - /* - * Like logStr() with the `Level::Error` level, but also rethrows. - */ - template - [[noreturn]] void logErrorStrAndRethrow(const char * const fileName, - const char * const funcName, const unsigned int lineNo, - const char * const msg) const - { - this->logStr(fileName, funcName, lineNo, msg); - throw; - } - private: struct _InitMsgLogWriter final { @@ -388,24 +351,6 @@ public: fmt, std::forward(args)...); } - /* - * Logs the message of `errno` using the level `LevelV`. - * - * The log message starts with `initMsg`, is followed with the - * message for `errno`, and then with `msg`. - * - * If `AppendCauseV` is true, this method also appends a cause to - * the error of the current thread using the same message. - */ - template - void logErrnoStr(const char * const fileName, const char * const funcName, - const unsigned int lineNo, const char * const initMsg, - const char * const msg) const - { - this->_logStr<_InitMsgLogWriter, LevelV, AppendCauseV>( - fileName, funcName, lineNo, {}, this->_errnoIntroStr(initMsg).c_str(), msg); - } - /* * Like logErrno() with the `Level::Error` level, but also throws a * default-constructed instance of `ExcT`. @@ -421,20 +366,6 @@ public: throw ExcT {}; } - /* - * Like logErrnoStr() with the `Level::Error` level, but also throws - * a default-constructed instance of `ExcT`. - */ - template - [[noreturn]] void - logErrorErrnoStrAndThrow(const char * const fileName, const char * const funcName, - const unsigned int lineNo, const char * const initMsg, - const char * const msg) const - { - this->logErrnoStr(fileName, funcName, lineNo, initMsg, msg); - throw ExcT {}; - } - /* * Like logErrno() with the `Level::Error` level, but also rethrows. */ @@ -449,20 +380,6 @@ public: throw; } - /* - * Like logErrnoStr() with the `Level::Error` level, but also - * rethrows. - */ - template - [[noreturn]] void - logErrorErrnoStrAndRethrow(const char * const fileName, const char * const funcName, - const unsigned int lineNo, const char * const initMsg, - const char * const msg) const - { - this->logErrnoStr(fileName, funcName, lineNo, initMsg, msg); - throw; - } - private: struct _MemLogWriter final { @@ -490,80 +407,61 @@ public: std::forward(args)...); } - /* - * Logs memory data using the level `LevelV`, starting with the - * message `msg`. - */ - template - void logMemStr(const char * const fileName, const char * const funcName, - const unsigned int lineNo, const MemData memData, const char * const msg) const - { - this->_logStr<_MemLogWriter, LevelV, false>(fileName, funcName, lineNo, memData, "", msg); - } - private: /* * Formats a log message with fmt::format() given `fmt` and `args`, - * and then forwards everything to _logStr(). + * and then: + * + * 1. Calls LogWriterT::write() with its arguments to log using the + * level `LevelV`. + * + * 2. If `AppendCauseV` is true, this method also appends a cause to + * the error of the current thread using the concatenation of + * `initMsg` and `msg` as the message. */ template void _log(const char * const fileName, const char * const funcName, const unsigned int lineNo, const MemData memData, const char * const initMsg, const char * const fmt, ArgTs&&...args) const { + const auto wouldLog = this->wouldLog(LevelV); + /* Only format arguments if logging or appending an error cause */ - if (G_UNLIKELY(this->wouldLog(LevelV) || AppendCauseV)) { + if (G_UNLIKELY(wouldLog || AppendCauseV)) { /* * Format arguments to our buffer (fmt::format_to() doesn't * append a null character). */ _mBuf.clear(); + BT_ASSERT(fmt); fmt::format_to(std::back_inserter(_mBuf), fmt, std::forward(args)...); _mBuf.push_back('\0'); } - this->_logStr(fileName, funcName, lineNo, memData, - initMsg, _mBuf.data()); - } - - /* - * Calls LogWriterT::write() with its arguments to log using the - * level `LevelV`. - * - * If `AppendCauseV` is true, this method also appends a cause to - * the error of the current thread using the concatenation of - * `initMsg` and `msg` as the message. - */ - template - void _logStr(const char * const fileName, const char * const funcName, - const unsigned int lineNo, const MemData memData, const char * const initMsg, - const char * const msg) const - { - /* Initial message and main message are required */ + /* Initial message is required */ BT_ASSERT(initMsg); - BT_ASSERT(msg); /* Log if needed */ - if (this->wouldLog(LevelV)) { + if (wouldLog) { LogWriterT::write(fileName, funcName, lineNo, LevelV, _mTag.data(), memData, initMsg, - msg); + _mBuf.data()); } /* Append an error cause if needed */ if (AppendCauseV) { if (_mSelfMsgIter) { bt_current_thread_error_append_cause_from_message_iterator( - _mSelfMsgIter->libObjPtr(), fileName, lineNo, "%s%s", initMsg, msg); + _mSelfMsgIter->libObjPtr(), fileName, lineNo, "%s%s", initMsg, _mBuf.data()); } else if (_mSelfComp) { bt_current_thread_error_append_cause_from_component( - _mSelfComp->libObjPtr(), fileName, lineNo, "%s%s", initMsg, msg); + _mSelfComp->libObjPtr(), fileName, lineNo, "%s%s", initMsg, _mBuf.data()); } else if (_mSelfCompCls) { bt_current_thread_error_append_cause_from_component_class( - _mSelfCompCls->libObjPtr(), fileName, lineNo, "%s%s", initMsg, msg); + _mSelfCompCls->libObjPtr(), fileName, lineNo, "%s%s", initMsg, _mBuf.data()); } else { BT_ASSERT(_mModuleName); - bt_current_thread_error_append_cause_from_unknown(_mModuleName->data(), fileName, - lineNo, "%s%s", initMsg, msg); + bt_current_thread_error_append_cause_from_unknown( + _mModuleName->data(), fileName, lineNo, "%s%s", initMsg, _mBuf.data()); } } } @@ -641,39 +539,6 @@ inline const char *maybeNull(const char * const s) noexcept #define BT_CPPLOGE(_fmt, ...) BT_CPPLOGE_SPEC(_BT_CPPLOG_DEF_LOGGER, (_fmt), ##__VA_ARGS__) #define BT_CPPLOGF(_fmt, ...) BT_CPPLOGF_SPEC(_BT_CPPLOG_DEF_LOGGER, (_fmt), ##__VA_ARGS__) -/* - * Calls logStr() on `_logger` to log using the level `_lvl`. - */ -#define BT_CPPLOG_STR_EX(_lvl, _logger, _msg) \ - (_logger).template logStr<(_lvl), false>(__FILE__, __func__, __LINE__, (_msg)) - -/* - * BT_CPPLOG_STR_EX() with specific logging levels. - */ -#define BT_CPPLOGT_STR_SPEC(_logger, _msg) \ - BT_CPPLOG_STR_EX(bt2c::Logger::Level::Trace, (_logger), (_msg)) -#define BT_CPPLOGD_STR_SPEC(_logger, _msg) \ - BT_CPPLOG_STR_EX(bt2c::Logger::Level::Debug, (_logger), (_msg)) -#define BT_CPPLOGI_STR_SPEC(_logger, _msg) \ - BT_CPPLOG_STR_EX(bt2c::Logger::Level::Info, (_logger), (_msg)) -#define BT_CPPLOGW_STR_SPEC(_logger, _msg) \ - BT_CPPLOG_STR_EX(bt2c::Logger::Level::Warning, (_logger), (_msg)) -#define BT_CPPLOGE_STR_SPEC(_logger, _msg) \ - BT_CPPLOG_STR_EX(bt2c::Logger::Level::Error, (_logger), (_msg)) -#define BT_CPPLOGF_STR_SPEC(_logger, _msg) \ - BT_CPPLOG_STR_EX(bt2c::Logger::Level::Fatal, (_logger), (_msg)) - -/* - * BT_CPPLOG_STR_EX() with specific logging levels and using the default - * logger. - */ -#define BT_CPPLOGT_STR(_msg) BT_CPPLOGT_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_msg)) -#define BT_CPPLOGD_STR(_msg) BT_CPPLOGD_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_msg)) -#define BT_CPPLOGI_STR(_msg) BT_CPPLOGI_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_msg)) -#define BT_CPPLOGW_STR(_msg) BT_CPPLOGW_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_msg)) -#define BT_CPPLOGE_STR(_msg) BT_CPPLOGE_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_msg)) -#define BT_CPPLOGF_STR(_msg) BT_CPPLOGF_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_msg)) - /* * Calls logMem() on `_logger` to log using the level `_lvl`. */ @@ -718,45 +583,6 @@ inline const char *maybeNull(const char * const s) noexcept #define BT_CPPLOGF_MEM(_memData, _fmt, ...) \ BT_CPPLOGF_MEM_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_fmt), ##__VA_ARGS__) -/* - * Calls logMemStr() on `_logger` to log using the level `_lvl`. - */ -#define BT_CPPLOG_MEM_STR_EX(_lvl, _logger, _memData, _msg) \ - (_logger).template logMemStr<(_lvl)>(__FILE__, __func__, __LINE__, (_memData), (_msg)) - -/* - * BT_CPPLOG_MEM_STR_EX() with specific logging levels. - */ -#define BT_CPPLOGT_MEM_STR_SPEC(_logger, _memData, _msg) \ - BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::TRACE, (_logger), (_memData), (_msg)) -#define BT_CPPLOGD_MEM_STR_SPEC(_logger, _memData, _msg) \ - BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::DEBUG, (_logger), (_memData), (_msg)) -#define BT_CPPLOGI_MEM_STR_SPEC(_logger, _memData, _msg) \ - BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::INFO, (_logger), (_memData), (_msg)) -#define BT_CPPLOGW_MEM_STR_SPEC(_logger, _memData, _msg) \ - BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::WARNING, (_logger), (_memData), (_msg)) -#define BT_CPPLOGE_MEM_STR_SPEC(_logger, _memData, _msg) \ - BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::Error, (_logger), (_memData), (_msg)) -#define BT_CPPLOGF_MEM_STR_SPEC(_logger, _memData, _msg) \ - BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::FATAL, (_logger), (_memData), (_msg)) - -/* - * BT_CPPLOG_MEM_STR_EX() with specific logging levels and using the - * default logger. - */ -#define BT_CPPLOGT_MEM_STR(_memData, _msg) \ - BT_CPPLOGT_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg)) -#define BT_CPPLOGD_MEM_STR(_memData, _msg) \ - BT_CPPLOGD_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg)) -#define BT_CPPLOGI_MEM_STR(_memData, _msg) \ - BT_CPPLOGI_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg)) -#define BT_CPPLOGW_MEM_STR(_memData, _msg) \ - BT_CPPLOGW_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg)) -#define BT_CPPLOGE_MEM_STR(_memData, _msg) \ - BT_CPPLOGE_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg)) -#define BT_CPPLOGF_MEM_STR(_memData, _msg) \ - BT_CPPLOGF_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg)) - /* * Calls logErrno() on `_logger` to log using the level `_lvl` and * initial message `_initMsg`. @@ -802,46 +628,6 @@ inline const char *maybeNull(const char * const s) noexcept #define BT_CPPLOGF_ERRNO(_initMsg, _fmt, ...) \ BT_CPPLOGF_ERRNO_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_fmt), ##__VA_ARGS__) -/* - * Calls logErrnoStr() on `_logger` to log using the level `_lvl` and - * initial message `_initMsg`. - */ -#define BT_CPPLOG_ERRNO_STR_EX(_lvl, _logger, _initMsg, _msg) \ - (_logger).template logErrnoStr<(_lvl), false>(__FILE__, __func__, __LINE__, (_initMsg), (_msg)) - -/* - * BT_CPPLOG_ERRNO_STR_EX() with specific logging levels. - */ -#define BT_CPPLOGT_ERRNO_STR_SPEC(_logger, _initMsg, _msg) \ - BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Trace, (_logger), (_initMsg), (_msg)) -#define BT_CPPLOGD_ERRNO_STR_SPEC(_logger, _initMsg, _msg) \ - BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Debug, (_logger), (_initMsg), (_msg)) -#define BT_CPPLOGI_ERRNO_STR_SPEC(_logger, _initMsg, _msg) \ - BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Info, (_logger), (_initMsg), (_msg)) -#define BT_CPPLOGW_ERRNO_STR_SPEC(_logger, _initMsg, _msg) \ - BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Warning, (_logger), (_initMsg), (_msg)) -#define BT_CPPLOGE_ERRNO_STR_SPEC(_logger, _initMsg, _msg) \ - BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Error, (_logger), (_initMsg), (_msg)) -#define BT_CPPLOGF_ERRNO_STR_SPEC(_logger, _initMsg, _msg) \ - BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Fatal, (_logger), (_initMsg), (_msg)) - -/* - * BT_CPPLOG_ERRNO_STR_EX() with specific logging levels and using the - * default logger. - */ -#define BT_CPPLOGT_ERRNO_STR(_initMsg, _msg) \ - BT_CPPLOGT_ERRNO_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_msg)) -#define BT_CPPLOGD_ERRNO_STR(_initMsg, _msg) \ - BT_CPPLOGD_ERRNO_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_msg)) -#define BT_CPPLOGI_ERRNO_STR(_initMsg, _msg) \ - BT_CPPLOGI_ERRNO_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_msg)) -#define BT_CPPLOGW_ERRNO_STR(_initMsg, _msg) \ - BT_CPPLOGW_ERRNO_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_msg)) -#define BT_CPPLOGE_ERRNO_STR(_initMsg, _msg) \ - BT_CPPLOGE_ERRNO_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_msg)) -#define BT_CPPLOGF_ERRNO_STR(_initMsg, _msg) \ - BT_CPPLOGF_ERRNO_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_msg)) - /* * Calls log() on `_logger` with the `Error` level to log an error and * append a cause to the error of the current thread. @@ -856,20 +642,6 @@ inline const char *maybeNull(const char * const s) noexcept #define BT_CPPLOGE_APPEND_CAUSE(_fmt, ...) \ BT_CPPLOGE_APPEND_CAUSE_SPEC(_BT_CPPLOG_DEF_LOGGER, (_fmt), ##__VA_ARGS__) -/* - * Calls logStr() on `_logger` with the `Error` level to log an error and - * append a cause to the error of the current thread. - */ -#define BT_CPPLOGE_STR_APPEND_CAUSE_SPEC(_logger, _msg) \ - (_logger).template logStr(__FILE__, __func__, __LINE__, \ - (_msg)) - -/* - * BT_CPPLOGE_STR_APPEND_CAUSE_SPEC() using the default logger. - */ -#define BT_CPPLOGE_STR_APPEND_CAUSE(_msg) \ - BT_CPPLOGE_STR_APPEND_CAUSE_SPEC(_BT_CPPLOG_DEF_LOGGER, (_msg)) - /* * Calls logErrorAndThrow() on `_logger` to log an error, append a cause * to the error of the current thread, and throw an instance of @@ -885,21 +657,6 @@ inline const char *maybeNull(const char * const s) noexcept #define BT_CPPLOGE_APPEND_CAUSE_AND_THROW(_excCls, _fmt, ...) \ BT_CPPLOGE_APPEND_CAUSE_AND_THROW_SPEC(_BT_CPPLOG_DEF_LOGGER, _excCls, (_fmt), ##__VA_ARGS__) -/* - * Calls logErrorStrAndThrow() on `_logger` to log an error, append a - * cause to the error of the current thread, and throw an instance of - * `_excCls`. - */ -#define BT_CPPLOGE_STR_APPEND_CAUSE_AND_THROW_SPEC(_logger, _excCls, _msg) \ - (_logger).template logErrorStrAndThrow(__FILE__, __func__, __LINE__, (_msg)) - -/* - * BT_CPPLOGE_STR_APPEND_CAUSE_AND_THROW_SPEC() using the default - * logger. - */ -#define BT_CPPLOGE_STR_APPEND_CAUSE_AND_THROW(_excCls, _msg) \ - BT_CPPLOGE_STR_APPEND_CAUSE_AND_THROW_SPEC(_BT_CPPLOG_DEF_LOGGER, _excCls, (_msg)) - /* * Calls logErrorAndRethrow() on `_logger` to log an error, append a * cause to the error of the current thread, and throw an instance of @@ -914,21 +671,6 @@ inline const char *maybeNull(const char * const s) noexcept #define BT_CPPLOGE_APPEND_CAUSE_AND_RETHROW(_fmt, ...) \ BT_CPPLOGE_APPEND_CAUSE_AND_RETHROW_SPEC(_BT_CPPLOG_DEF_LOGGER, (_fmt), ##__VA_ARGS__) -/* - * Calls logErrorStrAndRethrow() on `_logger` to log an error, append a - * cause to the error of the current thread, and throw an instance of - * `_excCls`. - */ -#define BT_CPPLOGE_STR_APPEND_CAUSE_AND_RETHROW_SPEC(_logger, _msg) \ - (_logger).template logErrorStrAndRethrow(__FILE__, __func__, __LINE__, (_msg)) - -/* - * BT_CPPLOGE_STR_APPEND_CAUSE_AND_RETHROW_SPEC() using the default - * logger. - */ -#define BT_CPPLOGE_STR_APPEND_CAUSE_AND_RETHROW(_msg) \ - BT_CPPLOGE_STR_APPEND_CAUSE_AND_RETHROW_SPEC(_BT_CPPLOG_DEF_LOGGER, (_msg)) - /* * Calls logErrno() on `_logger` with the `Level::Error` level to log an * error and append a cause to the error of the current thread. @@ -943,20 +685,6 @@ inline const char *maybeNull(const char * const s) noexcept #define BT_CPPLOGE_ERRNO_APPEND_CAUSE(_initMsg, _fmt, ...) \ BT_CPPLOGE_ERRNO_APPEND_CAUSE_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_fmt), ##__VA_ARGS__) -/* - * Calls logErrnoStr() on `_logger` with the `Level::Error` level to log - * an error and append a cause to the error of the current thread. - */ -#define BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_SPEC(_logger, _initMsg, _msg) \ - (_logger).template logErrnoStr(__FILE__, __func__, __LINE__, \ - (_initMsg), (_msg)) - -/* - * BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_SPEC() using the default logger. - */ -#define BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE(_initMsg, _msg) \ - BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_msg)) - /* * Calls logErrorErrnoAndThrow() on `_logger` to log an error, append a * cause to the error of the current thread, and throw an instance of @@ -974,23 +702,6 @@ inline const char *maybeNull(const char * const s) noexcept BT_CPPLOGE_ERRNO_APPEND_CAUSE_AND_THROW_SPEC(_BT_CPPLOG_DEF_LOGGER, _excCls, (_initMsg), \ (_fmt), ##__VA_ARGS__) -/* - * Calls logErrorErrnoStrAndThrow() on `_logger` to log an error, append - * a cause to the error of the current thread, and throw an instance of - * `_excCls`. - */ -#define BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_THROW_SPEC(_logger, _excCls, _initMsg, _msg) \ - (_logger).template logErrorErrnoStrAndThrow(__FILE__, __func__, __LINE__, \ - (_initMsg), (_msg)) - -/* - * BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_THROW_SPEC() using the default - * logger. - */ -#define BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_THROW(_excCls, _initMsg, _msg) \ - BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_THROW_SPEC(_BT_CPPLOG_DEF_LOGGER, _excCls, (_initMsg), \ - (_msg)) - /* * Calls logErrorErrnoAndRethrow() on `_logger` to log an error, append * a cause to the error of the current thread, and throw an instance of @@ -1008,20 +719,4 @@ inline const char *maybeNull(const char * const s) noexcept BT_CPPLOGE_ERRNO_APPEND_CAUSE_AND_RETHROW_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_fmt), \ ##__VA_ARGS__) -/* - * Calls logErrorErrnoStrAndRethrow() on `_logger` to log an error, - * append a cause to the error of the current thread, and throw an - * instance of `_excCls`. - */ -#define BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_RETHROW_SPEC(_logger, _initMsg, _msg) \ - (_logger).template logErrorErrnoStrAndRethrow(__FILE__, __func__, __LINE__, (_initMsg), \ - (_msg)) - -/* - * BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_RETHROW_SPEC() using the - * default logger. - */ -#define BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_RETHROW(_initMsg, _msg) \ - BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_RETHROW_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_msg)) - #endif /* BABELTRACE_CPP_COMMON_BT2C_LOGGING_HPP */ diff --git a/src/plugins/ctf/common/src/bfcr/bfcr.cpp b/src/plugins/ctf/common/src/bfcr/bfcr.cpp index 2b5cb79a..4ee3548c 100644 --- a/src/plugins/ctf/common/src/bfcr/bfcr.cpp +++ b/src/plugins/ctf/common/src/bfcr/bfcr.cpp @@ -176,14 +176,14 @@ static struct stack *stack_new(struct bt_bfcr *bfcr) stack = g_new0(struct stack, 1); if (!stack) { - BT_CPPLOGE_STR_SPEC(bfcr->logger, "Failed to allocate one stack."); + BT_CPPLOGE_SPEC(bfcr->logger, "Failed to allocate one stack."); goto error; } stack->bfcr = bfcr; stack->entries = g_array_new(FALSE, TRUE, sizeof(struct stack_entry)); if (!stack->entries) { - BT_CPPLOGE_STR_SPEC(bfcr->logger, "Failed to allocate a GArray."); + BT_CPPLOGE_SPEC(bfcr->logger, "Failed to allocate a GArray."); goto error; } @@ -675,8 +675,8 @@ read_bit_array_class_and_call_continue(struct bt_bfcr *bfcr, } /* We are here; it means we don't have enough data to decode this */ - BT_CPPLOGT_STR_SPEC( - bfcr->logger, "Not enough data to read the next basic field: appending to stitch buffer."); + BT_CPPLOGT_SPEC(bfcr->logger, + "Not enough data to read the next basic field: appending to stitch buffer."); stitch_append_from_remaining_buf(bfcr); status = BT_BFCR_STATUS_EOF; @@ -734,8 +734,8 @@ read_bit_array_class_and_call_begin(struct bt_bfcr *bfcr, } /* We are here; it means we don't have enough data to decode this */ - BT_CPPLOGT_STR_SPEC(bfcr->logger, - "Not enough data to read the next basic field: setting stitch buffer."); + BT_CPPLOGT_SPEC(bfcr->logger, + "Not enough data to read the next basic field: setting stitch buffer."); stitch_set_from_remaining_buf(bfcr); bfcr->state = BFCR_STATE_READ_BASIC_CONTINUE; status = BT_BFCR_STATUS_EOF; @@ -1116,12 +1116,12 @@ static inline enum bt_bfcr_status handle_state(struct bt_bfcr *bfcr) struct bt_bfcr *bt_bfcr_create(struct bt_bfcr_cbs cbs, void *data, const bt2c::Logger& logger) { - BT_CPPLOGD_STR_SPEC(logger, "Creating binary field class reader (BFCR)."); + BT_CPPLOGD_SPEC(logger, "Creating binary field class reader (BFCR)."); bt_bfcr *bfcr = new bt_bfcr {logger}; bfcr->stack = stack_new(bfcr); if (!bfcr->stack) { - BT_CPPLOGE_STR_SPEC(bfcr->logger, "Cannot create BFCR's stack."); + BT_CPPLOGE_SPEC(bfcr->logger, "Cannot create BFCR's stack."); bt_bfcr_destroy(bfcr); bfcr = NULL; goto end; @@ -1216,7 +1216,7 @@ size_t bt_bfcr_start(struct bt_bfcr *bfcr, struct ctf_field_class *cls, const ui } /* Run the machine! */ - BT_CPPLOGT_STR_SPEC(bfcr->logger, "Running the state machine."); + BT_CPPLOGT_SPEC(bfcr->logger, "Running the state machine."); while (true) { *status = handle_state(bfcr); @@ -1249,7 +1249,7 @@ size_t bt_bfcr_continue(struct bt_bfcr *bfcr, const uint8_t *buf, size_t sz, fmt::ptr(bfcr), fmt::ptr(buf), sz); /* Continue running the machine */ - BT_CPPLOGT_STR_SPEC(bfcr->logger, "Running the state machine."); + BT_CPPLOGT_SPEC(bfcr->logger, "Running the state machine."); while (true) { *status = handle_state(bfcr); diff --git a/src/plugins/ctf/common/src/metadata/tsdl/ctf-meta-resolve.cpp b/src/plugins/ctf/common/src/metadata/tsdl/ctf-meta-resolve.cpp index 0de4c675..4420746a 100644 --- a/src/plugins/ctf/common/src/metadata/tsdl/ctf-meta-resolve.cpp +++ b/src/plugins/ctf/common/src/metadata/tsdl/ctf-meta-resolve.cpp @@ -550,7 +550,7 @@ static int relative_ptokens_to_field_path(GList *ptokens, struct ctf_field_path ret = ptokens_to_field_path(ptokens, &tail_field_path, parent_class, cur_index, ctx); if (ret) { /* Not found... yet */ - BT_CPPLOGD_STR_SPEC(ctx->logger, "Not found at this point."); + BT_CPPLOGD_SPEC(ctx->logger, "Not found at this point."); ctf_field_path_clear(&tail_field_path); } else { /* Found: stitch tail field path to head field path */ diff --git a/src/plugins/ctf/common/src/metadata/tsdl/decoder-packetized-file-stream-to-buf.cpp b/src/plugins/ctf/common/src/metadata/tsdl/decoder-packetized-file-stream-to-buf.cpp index 846df316..b6de4d61 100644 --- a/src/plugins/ctf/common/src/metadata/tsdl/decoder-packetized-file-stream-to-buf.cpp +++ b/src/plugins/ctf/common/src/metadata/tsdl/decoder-packetized-file-stream-to-buf.cpp @@ -165,7 +165,7 @@ static int decode_packet(FILE *in_fp, FILE *out_fp, int byte_order, bool *is_uui toread = (header.packet_size - header.content_size) / CHAR_BIT; fseek_ret = fseek(in_fp, toread, SEEK_CUR); if (fseek_ret < 0) { - BT_CPPLOGW_STR_SPEC(logger, "Missing padding at the end of the metadata stream."); + BT_CPPLOGW_SPEC(logger, "Missing padding at the end of the metadata stream."); } break; } diff --git a/src/plugins/ctf/common/src/metadata/tsdl/lexer.lpp b/src/plugins/ctf/common/src/metadata/tsdl/lexer.lpp index 826cca14..8bc0eeda 100644 --- a/src/plugins/ctf/common/src/metadata/tsdl/lexer.lpp +++ b/src/plugins/ctf/common/src/metadata/tsdl/lexer.lpp @@ -12,7 +12,7 @@ #include "plugins/ctf/common/src/metadata/tsdl/parser-wrap.hpp" #include "plugins/ctf/common/src/metadata/tsdl/scanner.hpp" -#define YY_FATAL_ERROR(_msg) BT_CPPLOGF_STR_SPEC(currentCtfScanner->logger, _msg) +#define YY_FATAL_ERROR(_msg) BT_CPPLOGF_SPEC(currentCtfScanner->logger, "{}", _msg) #define PARSE_INTEGER_LITERAL(base) \ do { \ diff --git a/src/plugins/ctf/common/src/metadata/tsdl/objstack.cpp b/src/plugins/ctf/common/src/metadata/tsdl/objstack.cpp index cb13f63b..d124b3f3 100644 --- a/src/plugins/ctf/common/src/metadata/tsdl/objstack.cpp +++ b/src/plugins/ctf/common/src/metadata/tsdl/objstack.cpp @@ -45,7 +45,7 @@ objstack *objstack_create(const bt2c::Logger& parentLogger) objstack = new ::objstack {parentLogger}; node = (objstack_node *) calloc(sizeof(struct objstack_node) + OBJSTACK_INIT_LEN, sizeof(char)); if (!node) { - BT_CPPLOGE_STR_SPEC(objstack->logger, "Failed to allocate one object stack node."); + BT_CPPLOGE_SPEC(objstack->logger, "Failed to allocate one object stack node."); delete objstack; return NULL; } @@ -94,7 +94,7 @@ static struct objstack_node *objstack_append_node(struct objstack *objstack) new_node = (objstack_node *) calloc(sizeof(struct objstack_node) + (last_node->len << 1), sizeof(char)); if (!new_node) { - BT_CPPLOGE_STR_SPEC(objstack->logger, "Failed to allocate one object stack node."); + BT_CPPLOGE_SPEC(objstack->logger, "Failed to allocate one object stack node."); return NULL; } bt_list_add_tail(&new_node->node, &objstack->head); diff --git a/src/plugins/ctf/common/src/metadata/tsdl/parser.ypp b/src/plugins/ctf/common/src/metadata/tsdl/parser.ypp index 7ae25b69..bf2d90c5 100644 --- a/src/plugins/ctf/common/src/metadata/tsdl/parser.ypp +++ b/src/plugins/ctf/common/src/metadata/tsdl/parser.ypp @@ -31,7 +31,7 @@ thread_local const ctf_scanner *currentCtfScanner; std::string str(size, '\0'); \ int written = snprintf(&str[0], size + 1, (_fmt), ##args); \ BT_ASSERT(size == written); \ - BT_CPPLOGT_STR_SPEC(currentCtfScanner->logger, str.c_str()); \ + BT_CPPLOGT_SPEC(currentCtfScanner->logger, "{}", str.c_str()); \ } while (0) /* Join two lists, put "add" at the end of "head". */ @@ -803,8 +803,7 @@ static int set_parent_node(struct ctf_node *node, switch (node->type) { case NODE_ROOT: - BT_CPPLOGE_STR_SPEC(currentCtfScanner->logger, - "Trying to reparent root node."); + BT_CPPLOGE_SPEC(currentCtfScanner->logger, "Trying to reparent root node."); return -EINVAL; case NODE_EVENT: diff --git a/src/plugins/ctf/common/src/metadata/tsdl/visitor-generate-ir.cpp b/src/plugins/ctf/common/src/metadata/tsdl/visitor-generate-ir.cpp index 7900662a..48034a3f 100644 --- a/src/plugins/ctf/common/src/metadata/tsdl/visitor-generate-ir.cpp +++ b/src/plugins/ctf/common/src/metadata/tsdl/visitor-generate-ir.cpp @@ -4436,7 +4436,7 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *ctx, stru { int ret = 0; - BT_CPPLOGI_STR_SPEC(ctx->logger, "Visiting metadata's AST to generate CTF IR objects."); + BT_CPPLOGI_SPEC(ctx->logger, "Visiting metadata's AST to generate CTF IR objects."); switch (node->type) { case NODE_ROOT: @@ -4472,7 +4472,7 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *ctx, stru } if (!got_trace_decl) { - BT_CPPLOGD_STR_SPEC(ctx->logger, "Incomplete AST: need trace (`trace` block)."); + BT_CPPLOGD_SPEC(ctx->logger, "Incomplete AST: need trace (`trace` block)."); ret = -EINCOMPLETE; goto end; } diff --git a/src/plugins/ctf/common/src/msg-iter/msg-iter.cpp b/src/plugins/ctf/common/src/msg-iter/msg-iter.cpp index 1d146f3d..50a545bb 100644 --- a/src/plugins/ctf/common/src/msg-iter/msg-iter.cpp +++ b/src/plugins/ctf/common/src/msg-iter/msg-iter.cpp @@ -599,11 +599,11 @@ read_dscope_begin_state(struct ctf_msg_iter *msg_it, struct ctf_field_class *dsc switch (bfcr_status) { case BT_BFCR_STATUS_OK: /* Field class was read completely */ - BT_CPPLOGT_STR_SPEC(msg_it->logger, "Field was completely decoded."); + BT_CPPLOGT_SPEC(msg_it->logger, "Field was completely decoded."); msg_it->state = done_state; break; case BT_BFCR_STATUS_EOF: - BT_CPPLOGT_STR_SPEC(msg_it->logger, "BFCR needs more data to decode field completely."); + BT_CPPLOGT_SPEC(msg_it->logger, "BFCR needs more data to decode field completely."); msg_it->state = continue_state; break; default: @@ -655,12 +655,12 @@ static enum ctf_msg_iter_status read_dscope_continue_state(struct ctf_msg_iter * switch (bfcr_status) { case BT_BFCR_STATUS_OK: /* Type was read completely. */ - BT_CPPLOGT_STR_SPEC(msg_it->logger, "Field was completely decoded."); + BT_CPPLOGT_SPEC(msg_it->logger, "Field was completely decoded."); msg_it->state = done_state; break; case BT_BFCR_STATUS_EOF: /* Stay in this continue state. */ - BT_CPPLOGT_STR_SPEC(msg_it->logger, "BFCR needs more data to decode field completely."); + BT_CPPLOGT_SPEC(msg_it->logger, "BFCR needs more data to decode field completely."); break; default: BT_CPPLOGE_APPEND_CAUSE_SPEC(msg_it->logger, @@ -2728,7 +2728,7 @@ void ctf_msg_iter_destroy(struct ctf_msg_iter *msg_it) fmt::ptr(msg_it)); if (msg_it->stack) { - BT_CPPLOGD_STR_SPEC(msg_it->logger, "Destroying field stack."); + BT_CPPLOGD_SPEC(msg_it->logger, "Destroying field stack."); stack_destroy(msg_it->stack); } @@ -2761,7 +2761,7 @@ enum ctf_msg_iter_status ctf_msg_iter_get_next_message(struct ctf_msg_iter *msg_ while (true) { status = handle_state(msg_it); if (G_UNLIKELY(status == CTF_MSG_ITER_STATUS_AGAIN)) { - BT_CPPLOGD_STR_SPEC(msg_it->logger, "Medium returned CTF_MSG_ITER_STATUS_AGAIN."); + BT_CPPLOGD_SPEC(msg_it->logger, "Medium returned CTF_MSG_ITER_STATUS_AGAIN."); goto end; } else if (G_UNLIKELY(status != CTF_MSG_ITER_STATUS_OK)) { BT_CPPLOGE_APPEND_CAUSE_SPEC(msg_it->logger, @@ -2895,7 +2895,7 @@ static enum ctf_msg_iter_status decode_until_state(struct ctf_msg_iter *msg_it, status = handle_state(msg_it); if (G_UNLIKELY(status == CTF_MSG_ITER_STATUS_AGAIN)) { - BT_CPPLOGD_STR_SPEC(msg_it->logger, "Medium returned CTF_MSG_ITER_STATUS_AGAIN."); + BT_CPPLOGD_SPEC(msg_it->logger, "Medium returned CTF_MSG_ITER_STATUS_AGAIN."); goto end; } else if (G_UNLIKELY(status != CTF_MSG_ITER_STATUS_OK)) { BT_CPPLOGE_APPEND_CAUSE_SPEC(msg_it->logger, diff --git a/src/plugins/ctf/fs-sink/fs-sink-trace.cpp b/src/plugins/ctf/fs-sink/fs-sink-trace.cpp index 79d4839a..cebf19f6 100644 --- a/src/plugins/ctf/fs-sink/fs-sink-trace.cpp +++ b/src/plugins/ctf/fs-sink/fs-sink-trace.cpp @@ -157,8 +157,8 @@ static int append_lttng_trace_path_ust_uid(const struct fs_sink_trace *trace, GS v = bt_trace_borrow_environment_entry_value_by_name_const(tc, "tracer_buffering_id"); if (!v || !bt_value_is_signed_integer(v)) { - BT_CPPLOGI_STR_SPEC(trace->logger, - "Couldn't get environment value: name=\"tracer_buffering_id\""); + BT_CPPLOGI_SPEC(trace->logger, + "Couldn't get environment value: name=\"tracer_buffering_id\""); goto error; } @@ -166,8 +166,8 @@ static int append_lttng_trace_path_ust_uid(const struct fs_sink_trace *trace, GS v = bt_trace_borrow_environment_entry_value_by_name_const(tc, "architecture_bit_width"); if (!v || !bt_value_is_signed_integer(v)) { - BT_CPPLOGI_STR_SPEC(trace->logger, - "Couldn't get environment value: name=\"architecture_bit_width\""); + BT_CPPLOGI_SPEC(trace->logger, + "Couldn't get environment value: name=\"architecture_bit_width\""); goto error; } @@ -193,7 +193,7 @@ static int append_lttng_trace_path_ust_pid(const struct fs_sink_trace *trace, GS v = bt_trace_borrow_environment_entry_value_by_name_const(tc, "procname"); if (!v || !bt_value_is_string(v)) { - BT_CPPLOGI_STR_SPEC(trace->logger, "Couldn't get environment value: name=\"procname\""); + BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"procname\""); goto error; } @@ -201,7 +201,7 @@ static int append_lttng_trace_path_ust_pid(const struct fs_sink_trace *trace, GS v = bt_trace_borrow_environment_entry_value_by_name_const(tc, "vpid"); if (!v || !bt_value_is_signed_integer(v)) { - BT_CPPLOGI_STR_SPEC(trace->logger, "Couldn't get environment value: name=\"vpid\""); + BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"vpid\""); goto error; } @@ -209,8 +209,7 @@ static int append_lttng_trace_path_ust_pid(const struct fs_sink_trace *trace, GS v = bt_trace_borrow_environment_entry_value_by_name_const(tc, "vpid_datetime"); if (!v || !bt_value_is_string(v)) { - BT_CPPLOGI_STR_SPEC(trace->logger, - "Couldn't get environment value: name=\"vpid_datetime\""); + BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"vpid_datetime\""); goto error; } @@ -250,7 +249,7 @@ static GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace) v = bt_trace_borrow_environment_entry_value_by_name_const(trace->ir_trace, "tracer_name"); if (!v || !bt_value_is_string(v)) { - BT_CPPLOGI_STR_SPEC(trace->logger, "Couldn't get environment value: name=\"tracer_name\""); + BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"tracer_name\""); goto error; } @@ -263,7 +262,7 @@ static GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace) v = bt_trace_borrow_environment_entry_value_by_name_const(trace->ir_trace, "tracer_major"); if (!v || !bt_value_is_signed_integer(v)) { - BT_CPPLOGI_STR_SPEC(trace->logger, "Couldn't get environment value: name=\"tracer_major\""); + BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"tracer_major\""); goto error; } @@ -271,7 +270,7 @@ static GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace) v = bt_trace_borrow_environment_entry_value_by_name_const(trace->ir_trace, "tracer_minor"); if (!v || !bt_value_is_signed_integer(v)) { - BT_CPPLOGI_STR_SPEC(trace->logger, "Couldn't get environment value: name=\"tracer_minor\""); + BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"tracer_minor\""); goto error; } @@ -286,8 +285,7 @@ static GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace) v = bt_trace_borrow_environment_entry_value_by_name_const(trace->ir_trace, "hostname"); if (!v || !bt_value_is_string(v)) { - BT_CPPLOGI_STR_SPEC(trace->logger, - "Couldn't get environment value: name=\"tracer_hostname\""); + BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"tracer_hostname\""); goto error; } @@ -295,7 +293,7 @@ static GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace) v = bt_trace_borrow_environment_entry_value_by_name_const(trace->ir_trace, "trace_name"); if (!v || !bt_value_is_string(v)) { - BT_CPPLOGI_STR_SPEC(trace->logger, "Couldn't get environment value: name=\"trace_name\""); + BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"trace_name\""); goto error; } @@ -304,8 +302,8 @@ static GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace) v = bt_trace_borrow_environment_entry_value_by_name_const(trace->ir_trace, "trace_creation_datetime"); if (!v || !bt_value_is_string(v)) { - BT_CPPLOGI_STR_SPEC(trace->logger, - "Couldn't get environment value: name=\"trace_creation_datetime\""); + BT_CPPLOGI_SPEC(trace->logger, + "Couldn't get environment value: name=\"trace_creation_datetime\""); goto error; } @@ -319,7 +317,7 @@ static GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace) v = bt_trace_borrow_environment_entry_value_by_name_const(trace->ir_trace, "domain"); if (!v || !bt_value_is_string(v)) { - BT_CPPLOGI_STR_SPEC(trace->logger, "Couldn't get environment value: name=\"domain\""); + BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"domain\""); goto error; } @@ -332,8 +330,8 @@ static GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace) v = bt_trace_borrow_environment_entry_value_by_name_const(trace->ir_trace, "tracer_buffering_scheme"); if (!v || !bt_value_is_string(v)) { - BT_CPPLOGI_STR_SPEC(trace->logger, - "Couldn't get environment value: name=\"tracer_buffering_scheme\""); + BT_CPPLOGI_SPEC(trace->logger, + "Couldn't get environment value: name=\"tracer_buffering_scheme\""); goto error; } diff --git a/src/plugins/ctf/fs-sink/fs-sink.cpp b/src/plugins/ctf/fs-sink/fs-sink.cpp index 52d3d426..6b0c88da 100644 --- a/src/plugins/ctf/fs-sink/fs-sink.cpp +++ b/src/plugins/ctf/fs-sink/fs-sink.cpp @@ -965,8 +965,7 @@ bt_component_class_sink_consume_method_status ctf_fs_sink_consume(bt_self_compon break; case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY: /* Ignore */ - BT_CPPLOGD_STR_SPEC(fs_sink->logger, - "Ignoring message iterator inactivity message."); + BT_CPPLOGD_SPEC(fs_sink->logger, "Ignoring message iterator inactivity message."); break; case BT_MESSAGE_TYPE_STREAM_BEGINNING: status = handle_stream_beginning_msg(fs_sink, msg); diff --git a/src/plugins/ctf/fs-sink/translate-trace-ir-to-ctf-ir.cpp b/src/plugins/ctf/fs-sink/translate-trace-ir-to-ctf-ir.cpp index 5c8cf801..ca634b95 100644 --- a/src/plugins/ctf/fs-sink/translate-trace-ir-to-ctf-ir.cpp +++ b/src/plugins/ctf/fs-sink/translate-trace-ir-to-ctf-ir.cpp @@ -880,13 +880,13 @@ static inline int translate_option_field_class(ctf::sink::TraceIrToCtfIrCtx *ctx append_to_parent_field_class(ctx, &fc->base); ret = cur_path_stack_push(ctx, NULL, false, content_ir_fc, &fc->base); if (ret) { - BT_CPPLOGE_STR_SPEC(ctx->logger, "Cannot translate option field class content."); + BT_CPPLOGE_SPEC(ctx->logger, "Cannot translate option field class content."); goto end; } ret = translate_field_class(ctx); if (ret) { - BT_CPPLOGE_STR_SPEC(ctx->logger, "Cannot translate option field class content."); + BT_CPPLOGE_SPEC(ctx->logger, "Cannot translate option field class content."); goto end; } @@ -1071,13 +1071,13 @@ static inline int translate_static_array_field_class(ctf::sink::TraceIrToCtfIrCt append_to_parent_field_class(ctx, &fc->base.base); ret = cur_path_stack_push(ctx, NULL, false, elem_ir_fc, &fc->base.base); if (ret) { - BT_CPPLOGE_STR_SPEC(ctx->logger, "Cannot translate static array field class element."); + BT_CPPLOGE_SPEC(ctx->logger, "Cannot translate static array field class element."); goto end; } ret = translate_field_class(ctx); if (ret) { - BT_CPPLOGE_STR_SPEC(ctx->logger, "Cannot translate static array field class element."); + BT_CPPLOGE_SPEC(ctx->logger, "Cannot translate static array field class element."); goto end; } @@ -1111,13 +1111,13 @@ static inline int translate_dynamic_array_field_class(ctf::sink::TraceIrToCtfIrC append_to_parent_field_class(ctx, &fc->base.base); ret = cur_path_stack_push(ctx, NULL, false, elem_ir_fc, &fc->base.base); if (ret) { - BT_CPPLOGE_STR_SPEC(ctx->logger, "Cannot translate dynamic array field class element."); + BT_CPPLOGE_SPEC(ctx->logger, "Cannot translate dynamic array field class element."); goto end; } ret = translate_field_class(ctx); if (ret) { - BT_CPPLOGE_STR_SPEC(ctx->logger, "Cannot translate dynamic array field class element."); + BT_CPPLOGE_SPEC(ctx->logger, "Cannot translate dynamic array field class element."); goto end; } diff --git a/src/plugins/ctf/fs-src/data-stream-file.cpp b/src/plugins/ctf/fs-src/data-stream-file.cpp index 22aa309f..d2f7e102 100644 --- a/src/plugins/ctf/fs-src/data-stream-file.cpp +++ b/src/plugins/ctf/fs-src/data-stream-file.cpp @@ -392,8 +392,7 @@ build_index_from_idx_file(struct ctf_fs_ds_file *ds_file, struct ctf_fs_ds_file_ ctf_msg_iter_packet_properties props; int ret = ctf_msg_iter_get_packet_properties(msg_iter, &props); if (ret) { - BT_CPPLOGI_STR_SPEC(ds_file->logger, - "Cannot read first packet's header and context fields."); + BT_CPPLOGI_SPEC(ds_file->logger, "Cannot read first packet's header and context fields."); return bt2s::nullopt; } @@ -401,7 +400,7 @@ build_index_from_idx_file(struct ctf_fs_ds_file *ds_file, struct ctf_fs_ds_file_ ctf_trace_class_borrow_stream_class_by_id(ds_file->metadata->tc, props.stream_class_id); BT_ASSERT(sc); if (!sc->default_clock_class) { - BT_CPPLOGI_STR_SPEC(ds_file->logger, "Cannot find stream class's default clock class."); + BT_CPPLOGI_SPEC(ds_file->logger, "Cannot find stream class's default clock class."); return bt2s::nullopt; } @@ -448,8 +447,8 @@ build_index_from_idx_file(struct ctf_fs_ds_file *ds_file, struct ctf_fs_ds_file_ const char *file_pos = g_mapped_file_get_contents(mapped_file.get()) + sizeof(*header); if (be32toh(header->magic) != CTF_INDEX_MAGIC) { - BT_CPPLOGW_STR_SPEC(ds_file->logger, - "Invalid LTTng trace index: \"magic\" field validation failed"); + BT_CPPLOGW_SPEC(ds_file->logger, + "Invalid LTTng trace index: \"magic\" field validation failed"); return bt2s::nullopt; } @@ -522,7 +521,7 @@ build_index_from_idx_file(struct ctf_fs_ds_file *ds_file, struct ctf_fs_ds_file_ ret = convert_cycles_to_ns(sc->default_clock_class, index_entry.timestamp_begin, &index_entry.timestamp_begin_ns); if (ret) { - BT_CPPLOGI_STR_SPEC( + BT_CPPLOGI_SPEC( ds_file->logger, "Failed to convert raw timestamp to nanoseconds since Epoch during index parsing"); return bt2s::nullopt; @@ -530,7 +529,7 @@ build_index_from_idx_file(struct ctf_fs_ds_file *ds_file, struct ctf_fs_ds_file_ ret = convert_cycles_to_ns(sc->default_clock_class, index_entry.timestamp_end, &index_entry.timestamp_end_ns); if (ret) { - BT_CPPLOGI_STR_SPEC( + BT_CPPLOGI_SPEC( ds_file->logger, "Failed to convert raw timestamp to nanoseconds since Epoch during LTTng trace index parsing"); return bt2s::nullopt; @@ -574,8 +573,8 @@ static int init_index_entry(ctf_fs_ds_index_entry& entry, struct ctf_fs_ds_file int ret = convert_cycles_to_ns(sc->default_clock_class, props->snapshots.beginning_clock, &entry.timestamp_begin_ns); if (ret) { - BT_CPPLOGI_STR_SPEC(ds_file->logger, - "Failed to convert raw timestamp to nanoseconds since Epoch."); + BT_CPPLOGI_SPEC(ds_file->logger, + "Failed to convert raw timestamp to nanoseconds since Epoch."); return ret; } } else { @@ -590,8 +589,8 @@ static int init_index_entry(ctf_fs_ds_index_entry& entry, struct ctf_fs_ds_file int ret = convert_cycles_to_ns(sc->default_clock_class, props->snapshots.end_clock, &entry.timestamp_end_ns); if (ret) { - BT_CPPLOGI_STR_SPEC(ds_file->logger, - "Failed to convert raw timestamp to nanoseconds since Epoch."); + BT_CPPLOGI_SPEC(ds_file->logger, + "Failed to convert raw timestamp to nanoseconds since Epoch."); return ret; } } else { @@ -615,8 +614,8 @@ build_index_from_stream_file(struct ctf_fs_ds_file *ds_file, struct ctf_fs_ds_fi struct ctf_msg_iter_packet_properties props; if (currentPacketOffset.bytes() > ds_file->file->size) { - BT_CPPLOGE_STR_SPEC(ds_file->logger, - "Unexpected current packet's offset (larger than file)."); + BT_CPPLOGE_SPEC(ds_file->logger, + "Unexpected current packet's offset (larger than file)."); return bt2s::nullopt; } else if (currentPacketOffset.bytes() == ds_file->file->size) { /* No more data */ diff --git a/src/plugins/ctf/fs-src/fs.cpp b/src/plugins/ctf/fs-src/fs.cpp index e0f73440..e86d30ce 100644 --- a/src/plugins/ctf/fs-src/fs.cpp +++ b/src/plugins/ctf/fs-src/fs.cpp @@ -406,7 +406,7 @@ static int add_ds_file_to_ds_file_group(struct ctf_fs_trace *ctf_fs_trace, const bt_common_get_page_size(static_cast(ctf_fs_trace->logger.level())) * 8, ctf_fs_ds_file_medops, ds_file.get(), nullptr, ctf_fs_trace->logger); if (!msg_iter) { - BT_CPPLOGE_STR_SPEC(ctf_fs_trace->logger, "Cannot create a CTF message iterator."); + BT_CPPLOGE_SPEC(ctf_fs_trace->logger, "Cannot create a CTF message iterator."); return -1; } @@ -1282,7 +1282,7 @@ static int fix_packet_index_tracer_bugs(ctf_fs_trace *trace) * are needed. Failing to extract these entries is not * an error. */ - BT_CPPLOGI_STR_SPEC( + BT_CPPLOGI_SPEC( trace->logger, "Cannot extract tracer information necessary to compare with buggy versions."); return 0; @@ -1290,9 +1290,8 @@ static int fix_packet_index_tracer_bugs(ctf_fs_trace *trace) /* Check if the trace may be affected by old tracer bugs. */ if (is_tracer_affected_by_lttng_event_after_packet_bug(¤t_tracer_info)) { - BT_CPPLOGI_STR_SPEC( - trace->logger, - "Trace may be affected by LTTng tracer packet timestamp bug. Fixing up."); + BT_CPPLOGI_SPEC(trace->logger, + "Trace may be affected by LTTng tracer packet timestamp bug. Fixing up."); ret = fix_index_lttng_event_after_packet_bug(trace); if (ret) { BT_CPPLOGE_APPEND_CAUSE_SPEC(trace->logger, @@ -1303,9 +1302,8 @@ static int fix_packet_index_tracer_bugs(ctf_fs_trace *trace) } if (is_tracer_affected_by_barectf_event_before_packet_bug(¤t_tracer_info)) { - BT_CPPLOGI_STR_SPEC( - trace->logger, - "Trace may be affected by barectf tracer packet timestamp bug. Fixing up."); + BT_CPPLOGI_SPEC(trace->logger, + "Trace may be affected by barectf tracer packet timestamp bug. Fixing up."); ret = fix_index_barectf_event_before_packet_bug(trace); if (ret) { BT_CPPLOGE_APPEND_CAUSE_SPEC(trace->logger, diff --git a/src/plugins/ctf/lttng-live/lttng-live.cpp b/src/plugins/ctf/lttng-live/lttng-live.cpp index 79fbe550..63681810 100644 --- a/src/plugins/ctf/lttng-live/lttng-live.cpp +++ b/src/plugins/ctf/lttng-live/lttng-live.cpp @@ -1387,7 +1387,7 @@ lttng_live_msg_iter_next(bt_self_message_iterator *self_msg_it, bt_message_array * that of the current candidate message. We * must break the tie in a predictable manner. */ - BT_CPPLOGD_STR_SPEC( + BT_CPPLOGD_SPEC( lttng_live_msg_iter->logger, "Two of the next message candidates have the same timestamps, pick one deterministically."); /* diff --git a/src/plugins/utils/muxer/comp.cpp b/src/plugins/utils/muxer/comp.cpp index ea2df4d0..fb2a1119 100644 --- a/src/plugins/utils/muxer/comp.cpp +++ b/src/plugins/utils/muxer/comp.cpp @@ -13,7 +13,7 @@ namespace bt2mux { Comp::Comp(const bt2::SelfFilterComponent selfComp, const bt2::ConstMapValue params, void *) : bt2::UserFilterComponent {selfComp, "PLUGIN/FLT.UTILS.MUXER"} { - BT_CPPLOGI_STR("Initializing component."); + BT_CPPLOGI("Initializing component."); /* No parameters expected */ if (!params.isEmpty()) { @@ -28,10 +28,10 @@ Comp::Comp(const bt2::SelfFilterComponent selfComp, const bt2::ConstMapValue par try { this->_addOutputPort("out"); } catch (const bt2c::Error&) { - BT_CPPLOGE_STR_APPEND_CAUSE_AND_RETHROW("Failed to add a single output port."); + BT_CPPLOGE_APPEND_CAUSE_AND_RETHROW("Failed to add a single output port."); } - BT_CPPLOGI_STR("Initialized component."); + BT_CPPLOGI("Initialized component."); } void Comp::_inputPortConnected(const bt2::SelfComponentInputPort, const bt2::ConstOutputPort) @@ -44,7 +44,7 @@ void Comp::_addAvailInputPort() try { this->_addInputPort(fmt::format("in{}", this->_inputPorts().length())); } catch (const bt2c::Error&) { - BT_CPPLOGE_STR_APPEND_CAUSE_AND_RETHROW("Failed to add an available input port."); + BT_CPPLOGE_APPEND_CAUSE_AND_RETHROW("Failed to add an available input port."); } BT_CPPLOGI("Added one available input port: name={}", this->_inputPorts().back().name()); diff --git a/src/plugins/utils/muxer/msg-iter.cpp b/src/plugins/utils/muxer/msg-iter.cpp index c3e8c3db..2754bb11 100644 --- a/src/plugins/utils/muxer/msg-iter.cpp +++ b/src/plugins/utils/muxer/msg-iter.cpp @@ -367,18 +367,17 @@ bool MsgIter::_HeapComparator::operator()( * the oldest one, that is, the one having the smallest * timestamp. */ - BT_CPPLOGT_STR("Timestamp of message A is less than timestamp of message B: oldest=A"); + BT_CPPLOGT("Timestamp of message A is less than timestamp of message B: oldest=A"); return true; } else if (*msgTsA > *msgTsB) { - BT_CPPLOGT_STR( - "Timestamp of message A is greater than timestamp of message B: oldest=B"); + BT_CPPLOGT("Timestamp of message A is greater than timestamp of message B: oldest=B"); return false; } } else if (msgTsA && !msgTsB) { - BT_CPPLOGT_STR("Message A has a timestamp, but message B has none: oldest=B"); + BT_CPPLOGT("Message A has a timestamp, but message B has none: oldest=B"); return false; } else if (!msgTsA && msgTsB) { - BT_CPPLOGT_STR("Message B has a timestamp, but message A has none: oldest=A"); + BT_CPPLOGT("Message B has a timestamp, but message A has none: oldest=A"); return true; } -- 2.34.1 From c0db1f10976eb329a6f66ae48c178bb0de54ef11 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Mon, 18 Mar 2024 17:20:34 -0400 Subject: [PATCH 14/16] bt2::CommonEnumerationFieldClass::addMapping(): add missing static assertion Signed-off-by: Philippe Proulx Change-Id: Ie5a90126d0c25c92f00dce0af962f1e64048bdbc Reviewed-on: https://review.lttng.org/c/babeltrace/+/12481 CI-Build: Simon Marchi --- src/cpp-common/bt2/field-class.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cpp-common/bt2/field-class.hpp b/src/cpp-common/bt2/field-class.hpp index 83cd5215..71e32e41 100644 --- a/src/cpp-common/bt2/field-class.hpp +++ b/src/cpp-common/bt2/field-class.hpp @@ -864,6 +864,9 @@ public: CommonEnumerationFieldClass addMapping(const bt2c::CStringView label, const typename Mapping::RangeSet ranges) const { + static_assert(!std::is_const::value, + "Not available with `bt2::Const*EnumerationFieldClass`."); + const auto status = internal::CommonEnumerationFieldClassSpec::addMapping( this->libObjPtr(), label, ranges.libObjPtr()); -- 2.34.1 From f79594fd463ed6adb2f2da9a401b6e492c3f3260 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 25 Apr 2024 14:56:54 +0000 Subject: [PATCH 15/16] .clang-tidy: add some checks These checks seem reasonable, enable them. Change-Id: I4ed416a9deee2385af38c305a125cd616ec94aa0 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/12482 Reviewed-by: Philippe Proulx --- .clang-tidy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.clang-tidy b/.clang-tidy index acbb1421..a9d4ceb8 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -66,8 +66,10 @@ Checks: '-*, misc-misleading-identifier, misc-non-copyable-objects, misc-throw-by-value-catch-by-reference, + misc-unused-alias-decls, misc-unused-parameters, misc-unused-using-decls, + misc-use-anonymous-namespace, modernize-avoid-bind, modernize-concat-nested-namespaces, modernize-loop-convert, -- 2.34.1 From 4e24e7b301c53b3fb75ee63dcb2a464c307b8890 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 25 Apr 2024 15:27:02 -0400 Subject: [PATCH 16/16] bt2c::Logger: remove unused cLevel() method Signed-off-by: Philippe Proulx Change-Id: I59fb2fd48bb2166b725d8236bbf113f2fe993f99 Reviewed-on: https://review.lttng.org/c/babeltrace/+/12485 Tested-by: jenkins --- src/cpp-common/bt2c/logging.hpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/cpp-common/bt2c/logging.hpp b/src/cpp-common/bt2c/logging.hpp index 970ff9b7..a1fc583f 100644 --- a/src/cpp-common/bt2c/logging.hpp +++ b/src/cpp-common/bt2c/logging.hpp @@ -155,16 +155,6 @@ public: return _mLevel; } - /* - * Current logging level converted to a `bt_log_level` value. - * - * For legacy code. - */ - bt_log_level cLevel() const noexcept - { - return static_cast(_mLevel); - } - /* * Whether or not this logger would log at the level `level`. */ -- 2.34.1