F1 PRINT_ERROR(): show file/line no for debuggability

Somewhat align with the E1 PRINT_ERROR(), but extend with information.
This commit is contained in:
Robert Schmidt
2025-06-27 11:40:54 +02:00
parent 8a772d362f
commit e4857991fc
+7 -11
View File
@@ -32,21 +32,17 @@
#include "f1ap_messages_types.h" #include "f1ap_messages_types.h"
#ifdef ENABLE_TESTS #ifdef ENABLE_TESTS
#define PRINT_ERROR(...) fprintf(stderr, ##__VA_ARGS__) #define PRINT_ERROR(fmt, ...) fprintf(stderr, "%s:%d: " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
#else #else
#define PRINT_ERROR(...) // Do nothing #define PRINT_ERROR(...) // Do nothing
#endif #endif
#define _F1_EQ_CHECK_GENERIC(condition, fmt, ...) \ #define _F1_EQ_CHECK_GENERIC(condition, fmt, ...) \
do { \ do { \
if (!(condition)) { \ if (!(condition)) { \
PRINT_ERROR("F1 Equality Check failure: %s:%d: Condition '%s' failed: " fmt " != " fmt "\n", \ PRINT_ERROR("Equality condition '%s' failed: " fmt " != " fmt "\n", #condition, ##__VA_ARGS__); \
__FILE__, \ return false; \
__LINE__, \ } \
#condition, \
##__VA_ARGS__); \
return false; \
} \
} while (0) } while (0)
#define _F1_EQ_CHECK_LONG(A, B) _F1_EQ_CHECK_GENERIC(A == B, "%ld", A, B); #define _F1_EQ_CHECK_LONG(A, B) _F1_EQ_CHECK_GENERIC(A == B, "%ld", A, B);