diff options
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/codegen_decl.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/codegen/codegen_decl.c b/src/codegen/codegen_decl.c index e5d73a0..d59511d 100644 --- a/src/codegen/codegen_decl.c +++ b/src/codegen/codegen_decl.c @@ -22,7 +22,8 @@ static void emit_freestanding_preamble(FILE *out) "uint64_t\n", out); fputs("#define F32 float\n#define F64 double\n", out); - fputs("static inline const char* _z_bool_str(_Bool b) { return b ? \"true\" : \"false\"; }\n", out); + fputs("static inline const char* _z_bool_str(_Bool b) { return b ? \"true\" : \"false\"; }\n", + out); fputs("#define _z_str(x) _Generic((x), _Bool: \"%s\", char: \"%c\", " "signed char: \"%c\", unsigned char: \"%u\", short: \"%d\", " "unsigned short: \"%u\", int: \"%d\", unsigned int: \"%u\", " @@ -64,9 +65,11 @@ void emit_preamble(ParserContext *ctx, FILE *out) fputs("#define ZC_AUTO auto\n", out); fputs("#define ZC_CAST(T, x) static_cast<T>(x)\n", out); // C++ _z_str via overloads - fputs("inline const char* _z_bool_str(bool b) { return b ? \"true\" : \"false\"; }\n", out); + fputs("inline const char* _z_bool_str(bool b) { return b ? \"true\" : \"false\"; }\n", + out); fputs("inline const char* _z_str(bool) { return \"%s\"; }\n", out); - fputs("inline const char* _z_arg(bool b) { return _z_bool_str(b); }\n", out); + fputs("inline const char* _z_arg(bool b) { return _z_bool_str(b); }\n", + out); fputs("template<typename T> inline T _z_arg(T x) { return x; }\n", out); fputs("inline const char* _z_str(char) { return \"%c\"; }\n", out); fputs("inline const char* _z_str(int) { return \"%d\"; }\n", out); @@ -87,7 +90,9 @@ void emit_preamble(ParserContext *ctx, FILE *out) fputs("#define ZC_AUTO __auto_type\n", out); fputs("#define ZC_CAST(T, x) ((T)(x))\n", out); fputs("#ifdef __TINYC__\n#define __auto_type __typeof__\n#endif\n", out); - fputs("static inline const char* _z_bool_str(_Bool b) { return b ? \"true\" : \"false\"; }\n", out); + fputs("static inline const char* _z_bool_str(_Bool b) { return b ? \"true\" : " + "\"false\"; }\n", + out); fputs("#define _z_str(x) _Generic((x), _Bool: \"%s\", char: \"%c\", " "signed char: \"%c\", unsigned char: \"%u\", short: \"%d\", " "unsigned short: \"%u\", int: \"%d\", unsigned int: \"%u\", " |
