From fcedfddf00b3f994e4f4e40332ac7fc192c63244 Mon Sep 17 00:00:00 2001 From: polwex Date: Sun, 5 Oct 2025 21:56:51 +0700 Subject: claude is gud --- vere/pkg/noun/error.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 vere/pkg/noun/error.h (limited to 'vere/pkg/noun/error.h') diff --git a/vere/pkg/noun/error.h b/vere/pkg/noun/error.h new file mode 100644 index 0000000..57932bf --- /dev/null +++ b/vere/pkg/noun/error.h @@ -0,0 +1,38 @@ +/// @file + +#ifndef U3_ERROR_H +#define U3_ERROR_H + +#include "manage.h" + +/* Assert. Good to capture. + + TODO: determine which u3_assert calls can rather call c3_dessert, i.e. in + public releases, which calls to u3_assert should abort and which should + no-op? If the latter, is the assert useful inter-development to validate + conditions we might accidentally break or not useful at all? +*/ + +#if defined(ASAN_ENABLED) && defined(__clang__) +# define u3_assert(x) \ + do { \ + if (!(x)) { \ + u3m_bail(c3__oops); \ + abort(); \ + } \ + } while(0) +#else +# define u3_assert(x) \ + do { \ + if (!(x)) { \ + fflush(stderr); \ + fprintf(stderr, "\rAssertion '%s' " \ + "failed in %s:%d\r\n", \ + #x, __FILE__, __LINE__); \ + u3m_bail(c3__oops); \ + abort(); \ + } \ + } while(0) +#endif /* if defined(ASAN_ENABLED) && defined(__clang__) */ + +#endif /* ifndef U3_ERROR_H */ -- cgit v1.2.3