common.h 320 B

123456789
  1. #pragma once
  2. #include "libc.h"
  3. #define STR1(m) #m
  4. #define STR(m) STR1(m)
  5. #define PRINTF(fmt, ...) fprintf(stderr, __FILE__ ":" STR(__LINE__) ": " fmt "\n", __VA_ARGS__)
  6. #define PRINT(msg) fprintf(stderr, __FILE__ ":" STR(__LINE__) ": %s\n", msg)
  7. #define ASSERT(cond) if (!(cond)){PRINTF("%s failed", #cond); abort();}