@@ -76,8 +76,8 @@ extern int _upf_test_status;
7676// them to get expanded before stringification.
7777#define _upf_stringify_va_args (...) #__VA_ARGS__
7878
79- // The noop instruction is required to keep the return PC within the scope of the
80- // caller function. Otherwise, it might be optimized to return outside of it .
79+ // The noop instruction is required to prevent tail call optimization
80+ // and keep the return PC within the scope of the caller function .
8181#define uprintf (fmt, ...) \
8282 do { \
8383 _upf_uprintf (__FILE__, __LINE__, fmt, _upf_stringify_va_args (__VA_ARGS__), __VA_ARGS__); \
@@ -86,7 +86,7 @@ extern int _upf_test_status;
8686
8787#endif // UPRINTF_H
8888
89- // ====================== SOURCE ==== ======================
89+ // ================== IMPLEMENTATION ======================
9090
9191#ifdef UPRINTF_IMPLEMENTATION
9292
@@ -4458,7 +4458,7 @@ __attribute__((noinline)) void _upf_uprintf(const char *file_path, int line, con
44584458 ptrdiff_t pc = pc_ptr - _upf_state.base ;
44594459
44604460 _upf_state.current_cu = _upf_find_cu (pc);
4461- _UPF_ASSERT (_upf_state.current_cu != NULL );
4461+ if (_upf_state.current_cu == NULL ) _UPF_ERROR ( " Failed to find the current compilation unit. " );
44624462
44634463 _upf_state.current_scopes .length = 0 ;
44644464 _upf_find_scopes (pc, &_upf_state.current_cu ->scope , &_upf_state.current_scopes );
0 commit comments