Skip to content

Commit 1dcb645

Browse files
committed
Fixes
1 parent aa2ce6b commit 1dcb645

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

tests/alt_linked_list.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ int main(void) {
2626
if (i % 2 == 0) {
2727
NodeB *cur = (NodeB *) _cur;
2828
NodeA *node = (NodeA *) malloc(sizeof(*node));
29-
if (node == NULL) return 1;
29+
if (node == NULL) return EXIT_FAILURE;
3030
node->value = i * 2;
3131
node->next = NULL;
3232

@@ -35,7 +35,7 @@ int main(void) {
3535
} else {
3636
NodeA *cur = (NodeA *) _cur;
3737
NodeB *node = (NodeB *) malloc(sizeof(*node));
38-
if (node == NULL) return 1;
38+
if (node == NULL) return EXIT_FAILURE;
3939
node->value = i * -1.23;
4040
node->next = NULL;
4141

tests/linked_list.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ int main(void) {
1717
Node *cur = &head;
1818
for (int i = 1; i < NODES; i++) {
1919
Node *node = (Node *) malloc(sizeof(*node));
20-
if (node == NULL) return 1;
20+
if (node == NULL) return EXIT_FAILURE;
2121
node->value = i * 2;
2222
node->next = NULL;
2323

uprintf.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)