From 5336eeda8196ddc2f0c66880ac2a526d9ad5201b Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 24 Sep 2025 12:21:48 +0200 Subject: [PATCH] DPL: allow closing a signpost interval with an error The error will be printed regardless of the signposts being enabled. In case the signposts are actually enabled, the error will be the closing message of the signpost interval. In case the signposts are not enabled, the error will be printed as a standard error. --- Framework/Foundation/include/Framework/Signpost.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Framework/Foundation/include/Framework/Signpost.h b/Framework/Foundation/include/Framework/Signpost.h index 7ed544c529303..51d1b0433b0de 100644 --- a/Framework/Foundation/include/Framework/Signpost.h +++ b/Framework/Foundation/include/Framework/Signpost.h @@ -611,6 +611,16 @@ void o2_debug_log_set_stacktrace(_o2_log_t* log, int stacktrace) } else if (O2_BUILTIN_UNLIKELY(private_o2_log_##log->stacktrace)) { \ _o2_signpost_interval_end(private_o2_log_##log, id, name, remove_engineering_type(format).data(), ##__VA_ARGS__); \ } +// Print out a message at error level in any case even if the signpost is not enable. +// If it is enabled, behaves like O2_SIGNPOST_END. +#define O2_SIGNPOST_END_WITH_ERROR(log, id, name, format, ...) \ + if (O2_BUILTIN_UNLIKELY(O2_SIGNPOST_ENABLED_MAC(log))) { \ + O2_SIGNPOST_END_MAC(log, id, name, format, ##__VA_ARGS__); \ + } else if (O2_BUILTIN_UNLIKELY(private_o2_log_##log->stacktrace)) { \ + _o2_signpost_interval_end(private_o2_log_##log, id, name, remove_engineering_type(format).data(), ##__VA_ARGS__); \ + } else { \ + O2_LOG_MACRO_RAW(error, remove_engineering_type(format).data(), ##__VA_ARGS__); \ + } #else // This is the release implementation, it does nothing. #define O2_DECLARE_DYNAMIC_LOG(x) #define O2_DECLARE_DYNAMIC_STACKTRACE_LOG(x)