@@ -26,9 +26,8 @@ struct o2_log_handle_t {
2626
2727// Helper function which replaces engineering types with a printf
2828// compatible format string.
29- // FIXME: make this consteval when available in C++20
3029template <auto N>
31- constexpr auto remove_engineering_type (char const (&src)[N])
30+ consteval auto remove_engineering_type (char const (&src)[N])
3231{
3332 std::array<char , N> res = {};
3433 // do whatever string manipulation you want in res.
@@ -501,7 +500,7 @@ void o2_debug_log_set_stacktrace(_o2_log_t* log, int stacktrace)
501500 } else if (O2_BUILTIN_UNLIKELY (private_o2_log_##log->stacktrace )) { \
502501 _o2_signpost_event_emit (private_o2_log_##log, id, name, remove_engineering_type (format).data (), ##__VA_ARGS__); \
503502 } else { \
504- O2_LOG_MACRO_RAW (info, format, ##__VA_ARGS__); \
503+ O2_LOG_MACRO_RAW (info, remove_engineering_type ( format). data () , ##__VA_ARGS__); \
505504 } \
506505})
507506
@@ -512,7 +511,7 @@ void o2_debug_log_set_stacktrace(_o2_log_t* log, int stacktrace)
512511 } else if (O2_BUILTIN_UNLIKELY (private_o2_log_##log->stacktrace )) { \
513512 _o2_signpost_event_emit (private_o2_log_##log, id, name, remove_engineering_type (format).data (), ##__VA_ARGS__); \
514513 } \
515- O2_LOG_MACRO_RAW (error, format, ##__VA_ARGS__); \
514+ O2_LOG_MACRO_RAW (error, remove_engineering_type ( format). data () , ##__VA_ARGS__); \
516515})
517516
518517// Similar to the above, however it will also print a normal warning message regardless of the signpost being enabled or not.
@@ -522,7 +521,7 @@ void o2_debug_log_set_stacktrace(_o2_log_t* log, int stacktrace)
522521 } else if (O2_BUILTIN_UNLIKELY (private_o2_log_##log->stacktrace )) { \
523522 _o2_signpost_event_emit (private_o2_log_##log, id, name, remove_engineering_type (format).data (), ##__VA_ARGS__); \
524523 } \
525- O2_LOG_MACRO_RAW (warn, format, ##__VA_ARGS__); \
524+ O2_LOG_MACRO_RAW (warn, remove_engineering_type ( format). data () , ##__VA_ARGS__); \
526525})
527526
528527#define O2_SIGNPOST_START (log, id, name, format, ...) \
0 commit comments