core/src/panic.h

#ifndef PANIC_H
#define PANIC_H

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdbool.h>
#include <SDL3/SDL.h>

static void panic(const char *why, ...) {
	if (!why) return;
	va_list ap;
	va_start(ap, why);
	vfprintf(stderr, why, ap);
	fprintf(stderr, "\n");
	va_end(ap);
	abort();
}

#define must(result) ({ \
	typeof(result) must_result = result; \
	if (!must_result) { \
		panic("SDL: %s", SDL_GetError()); \
	} \
	must_result; \
})

#endif