util: ifndef the etrace and trace macros

This macros are incredibly useful to use globally so let's ifdef them
out in case developers have them sitting around in global headers.

Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/378>
This commit is contained in:
Peter Hutterer 2026-03-06 13:51:02 +10:00
parent aa5571ec08
commit 32abd87cc7

View file

@ -71,6 +71,7 @@
static int _once_per_##__func__ = 0; \
for (; _once_per_##__func__ == 0; _once_per_##__func__ = 1)
#if !defined(trace) && !defined(etrace)
#define trace(...) \
do { \
char buf_[1024]; \
@ -84,3 +85,4 @@
snprintf(buf_, sizeof(buf_), __VA_ARGS__); \
fprintf(stderr, "\x1B[0;34m" "%s():%d - " "\x1B[0;31m" "%s" "\x1B[0m" "\n", __func__, __LINE__, buf_); \
} while (0)
#endif