rutile/compiler/state.h
2025-01-12 18:20:42 -03:00

30 lines
693 B
C

#ifndef _state_h_
#define _state_h_
#include "pre.h"
#include "cgBackends.h"
/* Assert meant to catch compiler bugs. The difference with a normal assert is that
* this one stays on release builds. Better to crash than to deal with some weird bug
* seeping through codegen.
*/
#define compiler_assert(cm, pred) if (!(pred)) {compiler_assert_impl(cm, #pred);}
typedef struct {
struct {
bool color; /* colored diagnostics */
bool compile_only;
Str exe_out;
Str release_mode;
Vec(Str) defines;
enum CodegenBackends backend;
isize max_errors;
} opts;
Str current_filename;
isize error_count;
} Compiler;
void
compiler_assert_impl(Compiler *cm, const char *pred_s);
#endif